Sha256: 4ee746199fd3b2ea0c3f50b0b2e8d932b16c606a4f5554fb5abb33533af1215c

Contents?: true

Size: 1.81 KB

Versions: 10

Compression:

Stored size: 1.81 KB

Contents

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
  # run("#{SporkWorld::RUBY_BINARY} #{%x{which rails}.chomp} #{folder_name}")
  run([SporkWorld::RUBY_BINARY, %x{which rails}.chomp, version_argument, folder_name].compact * " ")
  @current_dir = File.join(File.join(SporkWorld::SANDBOX_DIR, folder_name))
end


Given "the application has a model, observer, route, and application helper" do
  Given 'a file named "app/models/user.rb" with:',
    """
    class User < ActiveRecord::Base
      $loaded_stuff << 'User'
    end
    """
  Given 'a file named "app/models/user_observer.rb" with:',
    """
    class UserObserver < ActiveRecord::Observer
      $loaded_stuff << 'UserObserver'
    end
    """
  Given 'a file named "app/helpers/application_helper.rb" with:',
    """
    module ApplicationHelper
      $loaded_stuff << 'ApplicationHelper'
    end
    """
  Given 'the following code appears in "config/environment.rb" after /Rails::Initializer.run/:',
    """
      config.active_record.observers = :user_observer
    """
  Given 'the following code appears in "config/routes.rb" after /^end/:',
    """
      $loaded_stuff << 'config/routes.rb'
    """
  Given 'a file named "config/initializers/initialize_loaded_stuff.rb" with:',
    """
    $loaded_stuff ||= []
    """
  Given 'a file named "config/initializers/log_establish_connection_calls.rb" with:',
    """
    class ActiveRecord::Base
      class << self
        def establish_connection_with_load_logging(*args)
          establish_connection_without_load_logging(*args)
          $loaded_stuff << 'ActiveRecord::Base.establish_connection'
        end
        alias_method_chain :establish_connection, :load_logging
      end
    end
    """
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
smtlaissezfaire-spork-0.5.7 features/steps/rails_steps.rb
timcharper-spork-0.5.5 features/steps/rails_steps.rb
timcharper-spork-0.5.6 features/steps/rails_steps.rb
timcharper-spork-0.5.7 features/steps/rails_steps.rb
timcharper-spork-0.5.8 features/steps/rails_steps.rb
spork-0.5.8 features/steps/rails_steps.rb
spork-0.5.7 features/steps/rails_steps.rb
spork-0.5.5 features/steps/rails_steps.rb
spork-0.5.4 features/steps/rails_steps.rb
spork-0.5.6 features/steps/rails_steps.rb