Skip to content

Instantly share code, notes, and snippets.

@ScottRadcliff
Created July 23, 2011 01:03
Show Gist options
  • Save ScottRadcliff/1100798 to your computer and use it in GitHub Desktop.
Save ScottRadcliff/1100798 to your computer and use it in GitHub Desktop.
Test that the title is titleized
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