Last active
July 27, 2016 14:53
-
-
Save kevbuchanan/6611072 to your computer and use it in GitHub Desktop.
Revisions
-
KevinBuch revised this gist
Sep 25, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ ## A very basic intro to Jasmine tests for those familiar with RSpec ### let/before ```ruby let(:post) { Post.new("My Title", "My Content") } ``` -
KevinBuch revised this gist
Sep 18, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # RSpec vs Jasmine ## A very basic intro to Jasmine tests for those familiar with RSpec ### let ```ruby -
KevinBuch created this gist
Sep 18, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,60 @@ # RSpec vs Jasmine ## A basic intro to Jasmine tests for those familiar with RSpec ### let ```ruby let(:post) { Post.new("My Title", "My Content") } ``` ```javascript var post beforeEach(function() { post = new Post("My Title", "My Content") }) ``` ### describe ```ruby describe Post do end ``` ```javascript describe("Post", function() { // setup a post with a before block }) ``` ### it ```ruby it "should have a title" do expect(post.title).to eq("My Title") end ``` ```javascript it("should have a title", function() { expect(post.title).toEqual("My Title") }) ``` ### stub ```ruby before do Blog.stub(:add).and_return(true) end ``` ```javascript var blog beforeEach(function() { blog = new Blog() spyOn(blog, "add").andReturn(true) }) ``` ### be_a ```ruby expect(blog.posts.first).to be_a(Post) ``` ```javascript expect(blog.posts[0]).toEqual(jasmine.any(Post)) ```