Add spec for blog post categories
This commit is contained in:
parent
5f31b50b61
commit
63ec02d44e
2 changed files with 34 additions and 0 deletions
23
features/category.feature
Normal file
23
features/category.feature
Normal file
|
@ -0,0 +1,23 @@
|
|||
@blog @blog_categories
|
||||
Feature: Blog Post Categories
|
||||
Blog posts can be assigned categories
|
||||
|
||||
Background:
|
||||
Given I am a logged in refinery user
|
||||
Given there is a category titled "Videos"
|
||||
|
||||
Scenario: The blog post new/edit form has category_list
|
||||
When I am on the new blog post form
|
||||
Then I should see "Tags"
|
||||
Then I should see "Videos"
|
||||
|
||||
Scenario: The blog post new/edit form saves categories
|
||||
When I am on the new blog post form
|
||||
And I fill in "Title" with "This is my blog post"
|
||||
And I fill in "blog_post_body" with "And I love it"
|
||||
And I check "Videos"
|
||||
And I press "Save"
|
||||
|
||||
Then there should be 1 blog post
|
||||
And the blog post should have "1" category
|
||||
And the blog post should have the category "Videos"
|
11
features/support/step_definitions/category_steps.rb
Normal file
11
features/support/step_definitions/category_steps.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
Given /^there is a category titled "([^"]*)"$/ do |title|
|
||||
@category = Factory(:blog_category, :title => title)
|
||||
end
|
||||
|
||||
Then /^the blog post should have "([^"]*)" category$/ do |num_category|
|
||||
BlogPost.last.categories.count.should == num_category
|
||||
end
|
||||
|
||||
Then /^the blog post should have the category "([^"]*)"$/ do |category|
|
||||
BlogPost.last.categories.first.title.should == category
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue