features/steps/rails_steps.rb in spork-0.8.5 vs features/steps/rails_steps.rb in spork-0.9.0.rc
- old
+ new
@@ -1,15 +1,29 @@
Given /^I am in a fresh rails project named "(.+)"$/ do |folder_name|
@current_dir = SporkWorld::SANDBOX_DIR
- version_argument = ENV['RAILS_VERSION'] ? "_#{ENV['RAILS_VERSION']}_" : nil
+ # version_argument = ENV['RAILS_VERSION'] ? "_#{ENV['RAILS_VERSION']}_" : nil
# run("#{SporkWorld::RUBY_BINARY} #{%x{which rails}.chomp} #{folder_name}")
- run([SporkWorld::RUBY_BINARY, '-I', Cucumber::LIBDIR, %x{which rails}.chomp, version_argument, folder_name].compact * " ")
+ run(["rails", "new", folder_name].compact * " ")
+
+ if last_exit_status != 0
+ puts "Couldn't generate project. Output:\nSTDERR:\n-------\n#{last_stderr}\n------\n\nSTDOUT:\n-------\n#{last_stdout}\n\n"
+ last_exit_status.should == 0
+ end
@current_dir = File.join(File.join(SporkWorld::SANDBOX_DIR, folder_name))
+ in_current_dir do
+ FileUtils.ln_sf(ENV["BUNDLE_GEMFILE"], "Gemfile")
+ FileUtils.ln_sf(ENV["BUNDLE_GEMFILE"] + ".lock", "Gemfile.lock")
+ FileUtils.ln_sf(File.dirname(ENV["BUNDLE_GEMFILE"]) + "/.bundle", ".bundle")
+ end
end
Given "the application has a model, observer, route, and application helper" do
+ Given 'the following code appears in "config/application.rb" after /^end/:',
+ """
+ ActiveRecord::Base.observers = [:user_observer]
+ """
Given 'a file named "app/models/user.rb" with:',
"""
class User < ActiveRecord::Base
$loaded_stuff << 'User'
end
@@ -48,6 +62,6 @@
end
alias_method_chain :establish_connection, :load_logging
end
end
"""
-end
\ No newline at end of file
+end