Skip to content

Commit

Permalink
Refactored to make use of our factories
Browse files Browse the repository at this point in the history
  • Loading branch information
baphled committed Jul 21, 2010
1 parent 7380350 commit c5117c8
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions features/step_definitions/feature_export_steps.rb
Expand Up @@ -5,28 +5,28 @@

Given /^we select a feature with stories$/ do
@steps = []
3.times { |steps| @steps << mock_model(Step).as_null_object}
@feature.stub!(:stories).and_return mock_model(Story,:id => 1, :steps => [@steps]).as_null_object
@feature.stories.should_not == []
3.times { |steps| @steps << Step.make }
@feature.stories << Story.make(:steps => [@steps])
Feature.stub!(:find).and_return @feature
end

Given /^the feature has a story with no steps$/ do
@feature = mock_model(Story,:id => 1, :steps => []).as_null_object
@feature.stories.first.steps.should == []
@has_no_steps = Story.make
@feature.stories << @has_no_steps
end

Given /^the feature has other stories with steps$/ do
@steps = []
3.times { |steps| @steps << mock_model(Step).as_null_object}
@feature = mock_model(Story,:id => 1, :steps => [@steps]).as_null_object
@feature.stub!(:stories).and_return mock_model(Story,:id => 1, :steps => [@steps]).as_null_object
end

When /^a user attempts to export a feature$/ do
click_link 'Export a feature'
end

When /^the export link should be viewable$/ do
response.should have_selector :a, attribute = {:href => "/features/1/export"}
response.should have_selector :a, attribute = {:href => "#{export_feature_path(@feature)}"}
end


Expand All @@ -36,11 +36,11 @@

Then /^the feature should be converted to the necessary cucumber feature format$/ do
@file = File.open("#{RAILS_ROOT}/spec/fixtures/test.feature")
response.should contain "Scenario: #{Story.find(1).scenario}"
response.should contain "Scenario: #{Story.first.scenario}"
end

Then /^that story is not added to the exported feature$/ do
response.should_not contain "Scenario: #{Story.find(2).scenario}"
response.should_not contain "Scenario: #{@has_no_steps.scenario}"
end

# @TODO Rename to a more appropriate title
Expand Down

0 comments on commit c5117c8

Please sign in to comment.