/Swifixture

Swift library to load Json files and help to test better.

Primary LanguageSwiftMIT LicenseMIT

Swifixture

Twitter: @tplioy CI Status Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

        describe("these will pass") {

            it("should be able to load json") {
                let json = try! Swifixture("jsonfile").toSwiftyJSON()
                expect(json!["prop1"]) == "first prop"
            }

            it("should be able to map string to obj") {
                let object = try! Swifixture("jsonfile").mapTo(FixtureObjectMapper)
                expect(object!.prop1) == "first prop"
                expect(object!.prop2) == "second prop"
            }

            it("should be able to load json string") {
                let string = try! Swifixture("simple").toString()
                expect(string).toNot(beNil())

            }


        }

        describe("these will fail") {
            it("should fail if invalid json name is given") {
                expect{try Swifixture("invalid").toSwiftyJSON()}.to(throwError())
            }
        }

Requirements

Installation

Swifixture is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "Swifixture"

Author

Thiago Lioy, thiagolioy@gmail.com

License

Swifixture is available under the MIT license. See the LICENSE file for more info.