{"id":228811,"date":"2014-07-06T05:24:02","date_gmt":"2014-07-06T01:24:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=228811"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=228811","title":{"rendered":"<span class=\"post_title\">BDD \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 Swift \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Sleipnir<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/078\/113\/01e\/07811301e0ca3addad82e27595ec0b57.png\"\/><br \/>  Objective-C \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u043c\u0438 \u0434\u043b\u044f BDD \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u0434\u0430. <br \/>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/pivotal\/cedar\">Cedar<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/kiwi-bdd\/Kiwi\">Kiwi<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/specta\/specta\">Specta<\/a><\/li>\n<\/ul>\n<p>  \u0421 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Swift \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0441\u0442\u0438\u043b\u0435 BDD \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c Swift, \u0431\u0435\u0437 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a Objective-C.<br \/>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0430\u0440\u044b \u043d\u0435\u0434\u0435\u043b\u044c \u0438\u043c\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u044b \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/github.com\/railsware\/Sleipnir\">Sleipnir<\/a>.<br \/>  Sleipnir \u0431\u044b\u043b \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u0435\u043d \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c <a href=\"https:\/\/github.com\/pivotal\/cedar\">Cedar<\/a> \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c BDD \u0442\u0435\u0441\u0442\u044b \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u0442\u0438\u043b\u0435:<\/p>\n<pre><code>class SampleSpec : SleipnirSpec {     var spec : () = describe(&quot;Horse&quot;) {         context(&quot;usual&quot;) {             it(&quot;is not awesome&quot;) {                 let usualHorse = UsualHorse()                 expect(usualHorse.legsCount).to(equal(4))                 expect(usualHorse.isAwesome()).to(beFalse())             }         }                  context(&quot;Sleipnir&quot;) {             it(&quot;is awesome&quot;) {                 let sleipnirHorse = Sleipnir()                 expect(sleipnirHorse.legsCount).to(equal(8))                 expect(sleipnirHorse.isAwesome()).to(beTrue())             }         }     } } <\/code><\/pre>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b Sleipnir<\/h3>\n<p>  <\/p>\n<ul>\n<li>Sleipnir \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 <code>NSObject<\/code>, \u044d\u0442\u043e BDD \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c Swift<\/li>\n<li>Sleipnir \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <code>XCTest<\/code><\/li>\n<li>Sleipnir \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0443\u0434\u043e\u0431\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0438\u043b\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432<\/li>\n<li>\u0414\u0440\u0443\u0433\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432, \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435\/\u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b \u0442\u0435\u0441\u0442\u043e\u0432<\/li>\n<\/ul>\n<p>  \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0448\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0434\u043b\u044f BDD \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 Swift, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/github.com\/modocache\/Quick\">Quick<\/a>. <br \/>  \u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u2014 \u0432\u043e\u043f\u0440\u043e\u0441 \u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<p>  \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u2014 <code>Book<\/code> \u0438 <code>Library<\/code> \u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u043b\u044f \u043d\u0438\u0445 \u0442\u0435\u0441\u0442\u044b.<br \/>  \u041a\u043b\u0430\u0441\u0441 <code>Book<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0430\u0432\u0442\u043e\u0440\u0435 \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0438 \u043a\u043d\u0438\u0433\u0438:  <\/p>\n<pre><code>class Book {         var title: String     var author: String          init(title: String, author: String) {         self.title = title         self.author = author     }    } <\/code><\/pre>\n<p>  \u041a\u043b\u0430\u0441\u0441 <code>Library<\/code> \u2014 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043a\u043d\u0438\u0433:  <\/p>\n<pre><code>class Library {       var books: Book[]          init() {         self.books = Book[]()     }          func addBook(book: Book) {         books.append(book)     }          func removeLastBook() {         books.removeLast()     }          func clear() {         books.removeAll()     }          func size() -&gt; Int {         return books.count     }          func hasBooks() -&gt; Bool {         return size() &gt; 0     }          func filterBy(#author: String) -&gt; Book[] {         return books.filter { $0.author == author }     }          func filterBy(#title: String) -&gt; Book[] {         return books.filter { !$0.title.rangeOfString(title).isEmpty }     } } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Book<\/code>:  <\/p>\n<pre><code>class LibrarySpec : SleipnirSpec {          var book : () = context(&quot;Book&quot;) {                  var swiftBook: Book?         beforeAll {             swiftBook = Book(title: &quot;Introduction to Swift&quot;, author: &quot;Apple Inc.&quot;)         }                  it(&quot;has title&quot;) {             expect(swiftBook!.title).to(equal(&quot;Introduction to Swift&quot;))         }                 it(&quot;has author&quot;) {             expect(swiftBook!.author).to(equal(&quot;Apple Inc.&quot;))         }     } } <\/code><\/pre>\n<p>  \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043a\u043b\u0430\u0441\u0441 <code>LibrarySpec<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>SleipnirSpec<\/code>. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 <code>context<\/code> \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0434\u0432\u0430 <code>exampla<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Book<\/code>.<\/p>\n<p>  \u041e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Book<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0431\u043b\u043e\u043a\u0435 <code>beforeAll{ }<\/code>.<br \/>  Sleipnir \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u043e\u043a\u043e\u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432: <i>beforeAll<\/i>, <i>afterAll<\/i>, <i>beforeEach<\/i> \u0438 <i>afterEach<\/i>.<\/p>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 \u0432\u0441\u0435\u0445 <code>exampl\u043e\u0432<\/code> (<i>describe<\/i> \u0438\u043b\u0438 <i>context<\/i>) \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0432 \u0442\u0435\u0441\u0442\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:  <\/p>\n<pre><code>var book : () = context(&quot;Book&quot;) {  } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Library<\/code>:  <\/p>\n<pre><code>class LibrarySpec : SleipnirSpec {          ...      var library : () = context(&quot;Library&quot;) {                  var swiftLibrary: Library?         beforeAll {             swiftLibrary = Library()         }                  afterAll {             swiftLibrary = nil         }                  describe(&quot;empty&quot;) {             it(&quot;has no books&quot;) {                 expect(swiftLibrary!.hasBooks()).to(beFalse())             }         }                  describe(&quot;with books&quot;) {                          beforeEach {                 swiftLibrary!.addBook(Book(title: &quot;Introduction to Swift&quot;, author: &quot;Apple Inc.&quot;))                 swiftLibrary!.addBook(Book(title: &quot;Using Swift with Cocoa&quot;, author: &quot;Apple Inc.&quot;))                 swiftLibrary!.addBook(Book(title: &quot;Swift tutorials&quot;, author: &quot;John Doe&quot;))                 swiftLibrary!.addBook(Book(title: &quot;Programming iOS with Swift&quot;, author: &quot;Vladimir Swiftin&quot;))             }                          afterEach {                 swiftLibrary!.clear()             }                          it(&quot;is not empty&quot;) {                 expect(swiftLibrary!.hasBooks()).to(beTrue())             }                          it(&quot;has correct number of books&quot;) {                 expect(swiftLibrary!.size()).to(equal(4))                 swiftLibrary!.removeLastBook()                 expect(swiftLibrary!.size()).to(equal(3))             }                          describe(&quot;filters books&quot;) {                 it(&quot;by author&quot;) {                     expect(swiftLibrary!.filterBy(author: &quot;Apple Inc.&quot;).count).to(equal(2))                 }                                  it(&quot;by title&quot;) {                     expect(swiftLibrary!.filterBy(title: &quot;tutorials&quot;).count).to(equal(1))                 }             }         }     } } <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a \u044d\u0442\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e:  <\/p>\n<pre><code>Running With Random Seed: 657464010  .......   Finished in 0.0091 seconds  7 examples, 0 failures <\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u043f\u0430\u0432\u0448\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0432\u044b\u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0444\u0430\u0439\u043b \u0438 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438:  <\/p>\n<pre><code>Running With Random Seed: 2027508247  ..F....  FAILURE Library with books has correct number of books: \/Users\/atermenji\/Coding\/objc\/Sleipnir\/Sample\/LibrarySpec.swift:64 Expected 3 to equal [2]   Finished in 0.0043 seconds  7 examples, 1 failures <\/code><\/pre>\n<p>  \u041c\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Library<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0435 expectaion\u044b \u0438 matcher\u044b.<br \/>  \u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 Sleipnir \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0438 \u0442\u0438\u043f\u0430 matcher\u043e\u0432: <i>equal<\/i>, <i>beTrue<\/i> \u0438 <i>beFalse<\/i>, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u0441\u043a\u043e\u0440\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u043e\u0432\u044b\u0435. <\/p>\n<h3>\u041f\u043b\u0430\u043d\u044b \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435<\/h3>\n<p>  \u0422\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0440\u0435\u043b\u0438\u0437, \u043c\u043d\u043e\u0433\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0435\u0449\u0435 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u043b\u0430\u043d \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0435 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442:  <\/p>\n<ul>\n<li>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430<\/li>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 <i>pending examples<\/i><\/li>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u0435\u043c\u044b\u0445\/\u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0445 \u0433\u0440\u0443\u043f\u043f \u0442\u0435\u0441\u0442\u043e\u0432<\/li>\n<li>\u0428\u0430\u0431\u043b\u043e\u043d\u044b XCode<\/li>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 <i>shared examples<\/i><\/li>\n<li>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 <i>should<\/i> (<code>some_value should equal(some_another_value)<\/code>)<\/li>\n<li>\u0412\u0438\u043a\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/li>\n<li>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Sleipnir\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Sleipnir\u0430<\/li>\n<li>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 matcher\u044b, \u0441\u0440\u0435\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445:<br \/> \n<ul>\n<li><i>beNil<\/i><\/li>\n<li><i>beGreaterThan<\/i>, <i>beLessThan<\/i>, <i>beInRangeOf<\/i><\/li>\n<li>\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 matcher\u044b (<i>will<\/i>, <i>willNot<\/i>, <i>after<\/i>)<\/li>\n<li>matcher\u044b \u0434\u043b\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0439 \u0438 \u0441\u0442\u0440\u043e\u043a (<i>contains<\/i>, <i>haveCount<\/i>, <i>beginWith<\/i>, <i>endWith<\/i>, \u0438 \u0442.\u0434.)<\/li>\n<\/ul>\n<p>  <\/li>\n<\/ul>\n<p>  \u041e\u0441\u0442\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u0431\u0430\u0433\u0440\u0435\u043f\u043e\u0440\u0442\u044b \u0438 \u0444\u0438\u0434\u0431\u0435\u043a \u043d\u0430 <a href=\"https:\/\/github.com\/railsware\/Sleipnir\">\u0433\u0438\u0442\u0445\u0430\u0431\u0435<\/a> \u0438\u043b\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0445 \u0438 <i>\u0441\u043b\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438<\/i>!   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/228811\/\"> http:\/\/habrahabr.ru\/post\/228811\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">       <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/078\/113\/01e\/07811301e0ca3addad82e27595ec0b57.png\"\/><br \/>  Objective-C \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u043c\u0438 \u0434\u043b\u044f BDD \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u0434\u0430. <br \/>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/pivotal\/cedar\">Cedar<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/kiwi-bdd\/Kiwi\">Kiwi<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/specta\/specta\">Specta<\/a><\/li>\n<\/ul>\n<p>  \u0421 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Swift \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0441\u0442\u0438\u043b\u0435 BDD \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c Swift, \u0431\u0435\u0437 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a Objective-C.<br \/>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0430\u0440\u044b \u043d\u0435\u0434\u0435\u043b\u044c \u0438\u043c\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u044b \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <a href=\"https:\/\/github.com\/railsware\/Sleipnir\">Sleipnir<\/a>.<br \/>  Sleipnir \u0431\u044b\u043b \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u0435\u043d \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c <a href=\"https:\/\/github.com\/pivotal\/cedar\">Cedar<\/a> \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c BDD \u0442\u0435\u0441\u0442\u044b \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u0442\u0438\u043b\u0435:<\/p>\n<pre><code>class SampleSpec : SleipnirSpec {     var spec : () = describe(&quot;Horse&quot;) {         context(&quot;usual&quot;) {             it(&quot;is not awesome&quot;) {                 let usualHorse = UsualHorse()                 expect(usualHorse.legsCount).to(equal(4))                 expect(usualHorse.isAwesome()).to(beFalse())             }         }                  context(&quot;Sleipnir&quot;) {             it(&quot;is awesome&quot;) {                 let sleipnirHorse = Sleipnir()                 expect(sleipnirHorse.legsCount).to(equal(8))                 expect(sleipnirHorse.isAwesome()).to(beTrue())             }         }     } } <\/code><\/pre>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-228811","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/228811","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=228811"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/228811\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=228811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=228811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=228811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}