Created
July 23, 2011 01:03
-
-
Save ScottRadcliff/1100798 to your computer and use it in GitHub Desktop.
Test that the title is titleized
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
Scenario: Create a post with a lower case title | |
Given I am logged in | |
And I visit the new posts page | |
And I fill in "Title" with "I love coffeescript" | |
And I fill in "Content" with "Super cool" | |
And I press "Post" | |
Then the title should be "I Love Coffeescript" | |
# post_steps.rb | |
Then /^the title should be "([^"]*)"$/ do |title| | |
titleized = title.titleize | |
post = Factory.create(:post, :title => title) | |
post.title.should == titleized | |
end | |
# Then I wrote a spec for my before_save callback | |
it "makes the title titleized before saving" do | |
post = Post.new(:title => "i love coffeescript") | |
post.save | |
post.title.should == "I Love Coffeescript" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment