gsampaio / Swifixture

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

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

License:MIT License


Languages

Language:Swift 81.9%Language:Objective-C 12.9%Language:Shell 4.7%Language:Ruby 0.5%