Tidy up cucumbers a tad.

This commit is contained in:
Mario Visic 2011-11-05 19:17:30 +11:00
parent ad0adc7153
commit 4d9c77d41a
4 changed files with 8 additions and 8 deletions

View File

@ -3,9 +3,6 @@ Feature: Has Many Association
In order to make dealing with models easier In order to make dealing with models easier
I want to be able to display other models that have a has many association I want to be able to display other models that have a has many association
Background:
Given I have the site: "test site" set up
Scenario: Paginating a has many association Scenario: Paginating a has many association
Given I have an "Articles" model which has many "Comments" Given I have a site set up
Then I should be able to view a paginated list of "Comments" per "Articles" Then I should be able to view a paginaed list of a has many association

View File

@ -4,5 +4,5 @@ Feature: Pagination
I want to be able to paginate through models I want to be able to paginate through models
Scenario: Paginating through a model Scenario: Paginating through a model
Given I have a site setup Given I have a site set up
Then I should be able to display paginated models Then I should be able to display paginated models

View File

@ -17,7 +17,10 @@ Given %r{^I have an? "([^"]*)" model which has many "([^"]*)"$} do |parent_model
}) })
end end
Then /^I should be able to view a paginated list of "([^"]*)" per "([^"]*)"$/ do |parent_model, child_model| Then /^I should be able to view a paginaed list of a has many association$/ do
# Create models
Given %{I have an "Articles" model which has many "Comments"}
# Create contents # Create contents
article = @parent_model.contents.create!(:slug => 'parent', :body => 'Parent') article = @parent_model.contents.create!(:slug => 'parent', :body => 'Parent')
@child_model.contents.create!(:slug => 'one', :body => 'One', :custom_field_2 => article.id.to_s) @child_model.contents.create!(:slug => 'one', :body => 'One', :custom_field_2 => article.id.to_s)

View File

@ -13,7 +13,7 @@ Given /^I have the site: "([^"]*)" set up(?: with #{capture_fields})?$/ do |site
@admin.should_not be_nil @admin.should_not be_nil
end end
Given /^I have a site setup$/ do Given /^I have a site set up$/ do
Given %{I have the site: "test site" set up} Given %{I have the site: "test site" set up}
end end