From edd2bd5cf7ab7ffc2ff4bf6983f7a83dfe92e1e9 Mon Sep 17 00:00:00 2001 From: Yomi Colledge Date: Wed, 21 Apr 2010 17:25:56 +0100 Subject: [PATCH] Refactored steps. --- features/step_definitions/feature_file_steps.rb | 8 -------- .../step_definitions/information_and_summary_steps.rb | 3 ++- features/support/env.rb | 4 ++-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/features/step_definitions/feature_file_steps.rb b/features/step_definitions/feature_file_steps.rb index 05c4d15a..4e95e570 100644 --- a/features/step_definitions/feature_file_steps.rb +++ b/features/step_definitions/feature_file_steps.rb @@ -10,10 +10,6 @@ File.exists?("#{RAILS_ROOT}/spec/fixtures/test.feature").should be_true end -Given /^the feature file can be opened with Cucumbers FeatureFile object$/ do - @file = FeatureFile.new "#{RAILS_ROOT}/features/plain/enhancements.feature" -end - Given /^we create a FeatureFile from a cucumber feature file with a scenario outline$/ do @file = FeatureFile.new "#{RAILS_ROOT}/features/plain/enhancements.feature" end @@ -101,10 +97,6 @@ @file.export.stories.each { |story| story.scenario.should_not contain /^Scenario Outline:/} end -Then /^our parse FeatureFile should be called$/ do - @file.should_receive :parse -end - Then /^a scenario outline should be found$/ do @file.export.stories.first.examples.first.should_not be_nil end diff --git a/features/step_definitions/information_and_summary_steps.rb b/features/step_definitions/information_and_summary_steps.rb index 013be212..f2be9647 100644 --- a/features/step_definitions/information_and_summary_steps.rb +++ b/features/step_definitions/information_and_summary_steps.rb @@ -1,10 +1,11 @@ Given /^there is a "([^\"]*)"$/ do |model| - pending 'This step seems to cause all subsequent steps to break which use find on a model, need to find out why' + # pending 'This step seems to cause all subsequent steps to break which use find on a model, need to find out why' @model = mock_model(model.capitalize.constantize).as_null_object model.capitalize.constantize.stub!(:find).and_return @model end Given /^the item has no "([^\"]*)"$/ do |association| + # pending 'This step seems to cause all subsequent steps to break which use find on a model, need to find out why' @model.stub!(association.to_sym).and_return [] @model.send(association).stub!(:count).and_return 0 end diff --git a/features/support/env.rb b/features/support/env.rb index d3eff559..88b98ea5 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -16,7 +16,7 @@ require 'webrat/core/matchers' require 'cucumber/rails/rspec' - +require 'spec/stubs/cucumber' require 'spec/mocks/framework' require 'spec/mocks/extensions' @@ -65,5 +65,5 @@ end After do - $rspec_stubs.reset_all + $rspec_mocks.reset_all end \ No newline at end of file