forked from vadymmarkov/Fakery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request vadymmarkov#116 from 51d4/Feature/Cat
Add Cat generator
- Loading branch information
Showing
7 changed files
with
229 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Foundation | ||
|
||
public final class Cat: Generator { | ||
public func name() -> String { | ||
return generate("cat.name") | ||
} | ||
|
||
public func breed() -> String { | ||
return generate("cat.breed") | ||
} | ||
|
||
public func registry() -> String { | ||
return generate("cat.registry") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import Quick | ||
import Nimble | ||
@testable import Fakery | ||
|
||
final class CatSpec: QuickSpec { | ||
override func spec() { | ||
describe("Cat") { | ||
var cat: Cat! | ||
|
||
beforeEach { | ||
let parser = Parser(locale: "en-TEST") | ||
cat = Cat(parser: parser) | ||
} | ||
|
||
describe("#name") { | ||
it("returns the correct text") { | ||
let name = cat.name() | ||
expect(name).to(equal("Shadow")) | ||
} | ||
} | ||
|
||
describe("#breed") { | ||
it("returns the correct text") { | ||
let breed = cat.breed() | ||
expect(breed).to(equal("British Semipi-longhair")) | ||
} | ||
} | ||
|
||
describe("#registry") { | ||
it("returns the correct text") { | ||
let registry = cat.registry() | ||
expect(registry).to(equal("American Cat Fanciers Association")) | ||
} | ||
} | ||
} | ||
} | ||
} |