Sha256: 68e9c02414f1efd073474425f87090aea33c59e9ea076481727da3ffbb55c7da

Contents?: true

Size: 936 Bytes

Versions: 3

Compression:

Stored size: 936 Bytes

Contents

require File.expand_path('config/environments/test', Rails.root)

Rails.application.class.configure do
  config.cache_classes = false
end

# rails/railties/lib/rails/test_help.rb aborts if the environment is not 'test'. (Rails 3.0.0.beta3)
# We can't run Cucumber/RSpec/Test_Unit tests in different environments then.
#
# For now, I patch StringInquirer so that Rails.env.test? returns true when Rails.env is 'test' or 'cucumber'
#
# https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4458-rails-should-allow-test-to-run-in-cucumber-environment
module ActiveSupport
  class StringInquirer < String
    def method_missing(method_name, *arguments)
      if method_name.to_s[-1,1] == "?"
        test_string = method_name.to_s[0..-2]
        if test_string == 'test'
          self == 'test' or self == 'cucumber'
        else
          self == test_string
        end
      else
        super
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activeadmin-0.2.2 spec/support/templates/cucumber.rb
activeadmin-0.2.1 spec/support/templates/cucumber.rb
activeadmin-0.2.0 spec/support/templates/cucumber.rb