From 1f430a0ca3c06c29bcf9e495de9baf46f2032edd Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Sun, 16 May 2010 22:26:56 +0100 Subject: [PATCH] changes to allow multiple orm features to run, pass for me, whoop whoop --- .../example_multiple_orm_steps.rb | 15 +++++++++++++++ examples/features/support/env.rb | 15 ++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 examples/features/step_definitions/example_multiple_orm_steps.rb diff --git a/examples/features/step_definitions/example_multiple_orm_steps.rb b/examples/features/step_definitions/example_multiple_orm_steps.rb new file mode 100644 index 0000000..b6607a8 --- /dev/null +++ b/examples/features/step_definitions/example_multiple_orm_steps.rb @@ -0,0 +1,15 @@ +When /^I create a widget in one orm$/ do + Widget.create! +end + +When /^I create a widget in another orm$/ do + AnotherWidget.create! +end + +Then /^I should see ([\d]+) widget in one orm $/ do |widget_count| + Widget.count.should == widget_count +end + +Then /^I should see ([\d]+) widget in another orm$/ do |widget_count| + AnotherWidget.count.should == widget_count +end \ No newline at end of file diff --git a/examples/features/support/env.rb b/examples/features/support/env.rb index 8862233..573e10d 100644 --- a/examples/features/support/env.rb +++ b/examples/features/support/env.rb @@ -3,16 +3,25 @@ Bundler.setup require 'spec/expectations' require 'ruby-debug' -orm = ENV['ORM'] -strategy = ENV['STRATEGY'] +orm = ENV['ORM'] +another_orm = ENV['ANOTHER_ORM'] +strategy = ENV['STRATEGY'] if orm && strategy begin - require "#{File.dirname(__FILE__)}/../../lib/#{orm}_models" + require "#{File.dirname(__FILE__)}/../../lib/#{orm}_models" rescue LoadError => e raise "You don't have the #{orm} ORM installed" end + + if another_orm + begin + require "#{File.dirname(__FILE__)}/../../lib/#{another_orm}_models" + rescue LoadError => e + raise "You don't have the #{another_orm} ORM installed" + end + end $:.unshift(File.dirname(__FILE__) + '/../../../lib') require 'database_cleaner'