cucumber_factory 1.8.6 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/.ruby-version +1 -0
  2. data/Rakefile +56 -6
  3. data/lib/cucumber/factory.rb +3 -4
  4. data/lib/cucumber_factory/switcher.rb +25 -0
  5. data/lib/cucumber_factory/version.rb +1 -1
  6. data/lib/cucumber_factory.rb +2 -0
  7. data/spec/rails-2.3/Gemfile +9 -0
  8. data/spec/rails-2.3/Rakefile +11 -0
  9. data/spec/{app_root → rails-2.3/app_root}/config/boot.rb +15 -0
  10. data/spec/rails-2.3/app_root/config/database.yml +4 -0
  11. data/spec/{app_root → rails-2.3/app_root}/config/environment.rb +0 -7
  12. data/spec/rails-2.3/app_root/config/environments/test.rb +28 -0
  13. data/spec/rails-2.3/app_root/config/preinitializer.rb +20 -0
  14. data/spec/{app_root → rails-2.3/app_root}/config/routes.rb +0 -0
  15. data/spec/{app_root → rails-2.3/app_root}/log/.gitignore +0 -0
  16. data/spec/{support → rails-2.3}/rcov.opts +0 -0
  17. data/spec/rails-2.3/spec/spec_helper.rb +28 -0
  18. data/spec/{support → rails-2.3}/spec.opts +0 -0
  19. data/spec/rails-3.0/.rspec +2 -0
  20. data/spec/rails-3.0/Gemfile +8 -0
  21. data/spec/rails-3.0/Rakefile +10 -0
  22. data/spec/rails-3.0/app_root/.gitignore +4 -0
  23. data/spec/rails-3.0/app_root/config/application.rb +32 -0
  24. data/spec/rails-3.0/app_root/config/boot.rb +13 -0
  25. data/spec/rails-3.0/app_root/config/database.yml +4 -0
  26. data/spec/rails-3.0/app_root/config/environment.rb +5 -0
  27. data/spec/rails-3.0/app_root/config/environments/test.rb +35 -0
  28. data/spec/rails-3.0/app_root/config/initializers/backtrace_silencers.rb +7 -0
  29. data/spec/rails-3.0/app_root/config/initializers/inflections.rb +10 -0
  30. data/spec/rails-3.0/app_root/config/initializers/mime_types.rb +5 -0
  31. data/spec/rails-3.0/app_root/config/initializers/secret_token.rb +7 -0
  32. data/spec/rails-3.0/app_root/config/initializers/session_store.rb +8 -0
  33. data/spec/rails-3.0/app_root/config/routes.rb +3 -0
  34. data/spec/{app_root/config/environments/in_memory.rb → rails-3.0/app_root/log/.gitkeep} +0 -0
  35. data/spec/rails-3.0/rcov.opts +2 -0
  36. data/spec/rails-3.0/spec/spec_helper.rb +25 -0
  37. data/spec/rails-3.2/.rspec +2 -0
  38. data/spec/rails-3.2/Gemfile +8 -0
  39. data/spec/rails-3.2/Rakefile +10 -0
  40. data/spec/rails-3.2/app_root/.gitignore +4 -0
  41. data/spec/rails-3.2/app_root/config/application.rb +32 -0
  42. data/spec/rails-3.2/app_root/config/boot.rb +13 -0
  43. data/spec/rails-3.2/app_root/config/database.yml +4 -0
  44. data/spec/rails-3.2/app_root/config/environment.rb +5 -0
  45. data/spec/rails-3.2/app_root/config/environments/test.rb +35 -0
  46. data/spec/rails-3.2/app_root/config/initializers/backtrace_silencers.rb +7 -0
  47. data/spec/rails-3.2/app_root/config/initializers/inflections.rb +10 -0
  48. data/spec/rails-3.2/app_root/config/initializers/mime_types.rb +5 -0
  49. data/spec/rails-3.2/app_root/config/initializers/secret_token.rb +7 -0
  50. data/spec/rails-3.2/app_root/config/initializers/session_store.rb +8 -0
  51. data/spec/rails-3.2/app_root/config/routes.rb +3 -0
  52. data/spec/{app_root/config/environments/mysql.rb → rails-3.2/app_root/log/.gitkeep} +0 -0
  53. data/spec/rails-3.2/rcov.opts +2 -0
  54. data/spec/rails-3.2/spec/spec_helper.rb +25 -0
  55. data/spec/rails-4.0/.rspec +2 -0
  56. data/spec/rails-4.0/Gemfile +8 -0
  57. data/spec/rails-4.0/Rakefile +10 -0
  58. data/spec/rails-4.0/app_root/.gitignore +4 -0
  59. data/spec/rails-4.0/app_root/config/application.rb +31 -0
  60. data/spec/rails-4.0/app_root/config/boot.rb +13 -0
  61. data/spec/rails-4.0/app_root/config/database.yml +4 -0
  62. data/spec/rails-4.0/app_root/config/environment.rb +5 -0
  63. data/spec/rails-4.0/app_root/config/environments/test.rb +34 -0
  64. data/spec/rails-4.0/app_root/config/initializers/backtrace_silencers.rb +7 -0
  65. data/spec/rails-4.0/app_root/config/initializers/inflections.rb +10 -0
  66. data/spec/rails-4.0/app_root/config/initializers/mime_types.rb +5 -0
  67. data/spec/rails-4.0/app_root/config/initializers/secret_token.rb +7 -0
  68. data/spec/rails-4.0/app_root/config/initializers/session_store.rb +8 -0
  69. data/spec/rails-4.0/app_root/config/locales/en.yml +4 -0
  70. data/spec/rails-4.0/app_root/config/routes.rb +3 -0
  71. data/spec/{app_root/config/environments/postgresql.rb → rails-4.0/app_root/log/.gitkeep} +0 -0
  72. data/spec/rails-4.0/rcov.opts +2 -0
  73. data/spec/rails-4.0/spec/spec_helper.rb +25 -0
  74. data/spec/{app_root → shared/app_root}/app/controllers/application_controller.rb +0 -0
  75. data/spec/{app_root → shared/app_root}/app/models/job_offer.rb +0 -0
  76. data/spec/{app_root → shared/app_root}/app/models/machinist_model.rb +0 -0
  77. data/spec/{app_root → shared/app_root}/app/models/movie.rb +0 -0
  78. data/spec/{app_root → shared/app_root}/app/models/opera.rb +0 -0
  79. data/spec/shared/app_root/app/models/payment.rb +8 -0
  80. data/spec/{app_root → shared/app_root}/app/models/people/actor.rb +0 -0
  81. data/spec/{app_root → shared/app_root}/app/models/plain_ruby_class.rb +0 -0
  82. data/spec/{app_root → shared/app_root}/app/models/user.rb +0 -0
  83. data/spec/shared/app_root/config/locales/en.yml +4 -0
  84. data/spec/{app_root → shared/app_root}/db/migrate/001_create_movies.rb +0 -0
  85. data/spec/{app_root → shared/app_root}/db/migrate/002_create_users.rb +0 -0
  86. data/spec/{app_root → shared/app_root}/db/migrate/003_create_payments.rb +0 -0
  87. data/spec/{app_root → shared/app_root}/db/migrate/004_create_actors.rb +0 -0
  88. data/spec/shared/cucumber_factory/cucumber_helper.rb +15 -0
  89. data/spec/{factory_spec.rb → shared/cucumber_factory/factory_spec.rb} +0 -0
  90. data/spec/{runtime_ext_spec.rb → shared/cucumber_factory/runtime_ext_spec.rb} +2 -0
  91. data/spec/{steps_spec.rb → shared/cucumber_factory/steps_spec.rb} +34 -13
  92. metadata +185 -139
  93. data/Gemfile +0 -12
  94. data/spec/app_root/app/models/payment.rb +0 -6
  95. data/spec/app_root/config/database.yml +0 -21
  96. data/spec/app_root/config/environments/sqlite.rb +0 -0
  97. data/spec/app_root/config/environments/sqlite3.rb +0 -0
  98. data/spec/app_root/lib/console_with_fixtures.rb +0 -4
  99. data/spec/app_root/script/console +0 -7
  100. data/spec/spec_helper.rb +0 -36
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p448
data/Rakefile CHANGED
@@ -1,12 +1,62 @@
1
1
  require 'rake'
2
- require 'spec/rake/spectask'
3
2
  require 'bundler/gem_tasks'
4
3
 
5
4
  desc 'Default: Run all specs.'
6
- task :default => :spec
5
+ task :default => 'all:spec'
6
+
7
+ namespace :travis do
8
+
9
+ desc 'Run tests on Travis CI'
10
+ task :run => ['slimgems', 'all:bundle:install', 'all:spec']
11
+
12
+ desc 'Install slimgems'
13
+ task :slimgems do
14
+ system('gem install slimgems')
15
+ end
16
+
17
+ end
18
+
19
+ namespace :all do
20
+
21
+ desc "Run specs on all spec apps"
22
+ task :spec do
23
+ success = true
24
+ for_each_directory_of('spec/**/Rakefile') do |directory|
25
+ env = "SPEC=../../#{ENV['SPEC']} " if ENV['SPEC']
26
+ success &= system("cd #{directory} && #{env} bundle exec rake spec")
27
+ end
28
+ fail "Tests failed" unless success
29
+ end
30
+
31
+ namespace :bundle do
32
+
33
+ desc "Bundle all spec apps"
34
+ task :install do
35
+ for_each_directory_of('spec/**/Gemfile') do |directory|
36
+ Bundler.with_clean_env do
37
+ system("cd #{directory} && bundle install")
38
+ end
39
+ end
40
+ end
41
+
42
+ desc "Update all gems, or a list of gem given by the GEM environment variable"
43
+ task :update do
44
+ for_each_directory_of('spec/**/Gemfile') do |directory|
45
+ Bundler.with_clean_env do
46
+ system("cd #{directory} && bundle update #{ENV['GEM']}")
47
+ end
48
+ end
49
+ end
50
+
51
+ end
7
52
 
8
- desc "Run all specs"
9
- Spec::Rake::SpecTask.new() do |t|
10
- t.spec_opts = ['--options', "\"spec/support/spec.opts\""]
11
- t.spec_files = FileList['spec/**/*_spec.rb']
12
53
  end
54
+
55
+ def for_each_directory_of(path, &block)
56
+ Dir[path].sort.each do |rakefile|
57
+ directory = File.dirname(rakefile)
58
+ puts '', "\033[44m#{directory}\033[0m", ''
59
+ block.call(directory)
60
+ end
61
+ end
62
+
@@ -85,8 +85,7 @@ module Cucumber
85
85
  association = model_class.respond_to?(:reflect_on_association) ? model_class.reflect_on_association(attribute) : nil
86
86
  if association.present?
87
87
  if value_type == "above"
88
- # Don't use class.last, in sqlite that is not always the last inserted element
89
- value = association.klass.find(:last, :order => "id") or raise "There is no last #{attribute}"
88
+ value = CucumberFactory::Switcher.find_last(association.klass) or raise "There is no last #{attribute}"
90
89
  else
91
90
  value = get_named_record(world, value)
92
91
  end
@@ -108,7 +107,7 @@ module Cucumber
108
107
  def factory_girl_factory_name(name)
109
108
  name.to_s.underscore.gsub('/', '_').to_sym
110
109
  end
111
-
110
+
112
111
  def create_record(model_class, variant, attributes)
113
112
  fg_factory_name = factory_girl_factory_name(variant || model_class)
114
113
  if defined?(::FactoryGirl) && factory = ::FactoryGirl.factories[fg_factory_name]
@@ -121,7 +120,7 @@ module Cucumber
121
120
  end
122
121
  elsif model_class.respond_to?(:create!) # Plain ActiveRecord
123
122
  model = model_class.new
124
- model.send(:attributes=, attributes, false) # ignore attr_accessible
123
+ CucumberFactory::Switcher.assign_attributes(model, attributes)
125
124
  model.save!
126
125
  model
127
126
  else
@@ -0,0 +1,25 @@
1
+ module CucumberFactory
2
+ module Switcher
3
+ extend self
4
+
5
+ def find_last(klass)
6
+ # Don't use class.last, in sqlite that is not always the last inserted element
7
+ if Rails::VERSION::MAJOR < 4
8
+ klass.find(:last, :order => "id")
9
+ else
10
+ klass.order(:id).last
11
+ end
12
+ end
13
+
14
+ def assign_attributes(model, attributes)
15
+ if Rails::VERSION::MAJOR < 3 || (Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR < 2)
16
+ model.send(:attributes=, attributes, false) # ignore attr_accessible
17
+ elsif Rails::VERSION::MAJOR < 4
18
+ model.send(:assign_attributes, attributes, without_protection: true)
19
+ else
20
+ model.send(:assign_attributes, attributes)
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module CucumberFactory
2
- VERSION = '1.8.6'
2
+ VERSION = '1.9.1'
3
3
  end
@@ -2,3 +2,5 @@ require 'active_support' # we're using alias_method_chain from ActiveSupport
2
2
 
3
3
  require 'cucumber/factory'
4
4
  require 'cucumber/runtime_ext'
5
+
6
+ require 'cucumber_factory/switcher'
@@ -0,0 +1,9 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'sqlite3'
4
+ gem 'test-unit', '=1.2.3', :platforms => :ruby_19
5
+ gem 'hoe', '=2.8.0', :platforms => :ruby_19
6
+ gem 'rails', '~>2.3.10'
7
+ gem 'rspec', '<2'
8
+ gem 'rspec-rails', '<2'
9
+ gem 'cucumber_factory', :path => '../..'
@@ -0,0 +1,11 @@
1
+ require 'rake'
2
+ require 'spec/rake/spectask'
3
+
4
+ desc 'Default: Run all specs for a specific rails version.'
5
+ task :default => :spec
6
+
7
+ desc "Run all specs for a specific rails version"
8
+ Spec::Rake::SpecTask.new() do |t|
9
+ t.spec_opts = ['--options', "\"spec.opts\""]
10
+ t.spec_files = defined?(SPEC) ? SPEC : FileList['**/*_spec.rb', '../shared/**/*_spec.rb']
11
+ end
@@ -110,5 +110,20 @@ module Rails
110
110
  end
111
111
  end
112
112
 
113
+
114
+ class Rails::Boot
115
+ def run
116
+ load_initializer
117
+
118
+ Rails::Initializer.class_eval do
119
+ def load_gems
120
+ @bundler_loaded ||= Bundler.require :default, Rails.env
121
+ end
122
+ end
123
+
124
+ Rails::Initializer.run(:set_load_path)
125
+ end
126
+ end
127
+
113
128
  # All that for this:
114
129
  Rails.boot!
@@ -0,0 +1,4 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: ":memory:"
4
+ verbosity: quiet
@@ -4,11 +4,4 @@ Rails::Initializer.run do |config|
4
4
  config.cache_classes = false
5
5
  config.whiny_nils = true
6
6
  config.action_controller.session = { :key => "_myapp_session", :secret => "gwirofjweroijger8924rt2zfwehfuiwehb1378rifowenfoqwphf23" }
7
- config.plugin_locators.unshift(
8
- Class.new(Rails::Plugin::Locator) do
9
- def plugins
10
- [Rails::Plugin.new(File.expand_path('.'))]
11
- end
12
- end
13
- ) unless defined?(PluginTestHelper::PluginLocator)
14
7
  end
@@ -0,0 +1,28 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+ config.cache_classes = true
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+ config.action_view.cache_template_loading = true
16
+
17
+ # Disable request forgery protection in test environment
18
+ config.action_controller.allow_forgery_protection = false
19
+
20
+ # Tell Action Mailer not to deliver emails to the real world.
21
+ # The :test delivery method accumulates sent emails in the
22
+ # ActionMailer::Base.deliveries array.
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
26
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
27
+ # like if you have constraints or database-specific column types
28
+ # config.active_record.schema_format = :sql
@@ -0,0 +1,20 @@
1
+ begin
2
+ require "rubygems"
3
+ require "bundler"
4
+ rescue LoadError
5
+ raise "Could not load the bundler gem. Install it with `gem install bundler`."
6
+ end
7
+
8
+ if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
9
+ raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
10
+ "Run `gem install bundler` to upgrade."
11
+ end
12
+
13
+ begin
14
+ # Set up load paths for all bundled gems
15
+ ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
16
+ Bundler.setup
17
+ rescue Bundler::GemNotFound
18
+ raise RuntimeError, "Bundler couldn't find some gems." +
19
+ "Did you run `bundle install`?"
20
+ end
File without changes
@@ -0,0 +1,28 @@
1
+ $: << File.join(File.dirname(__FILE__), "/../../lib" )
2
+
3
+ ENV['RAILS_ENV'] = 'test'
4
+ ENV['RAILS_ROOT'] = 'app_root'
5
+
6
+ # Load the Rails environment and testing framework
7
+ require "#{File.dirname(__FILE__)}/../app_root/config/environment"
8
+ require 'spec/rails'
9
+ require "#{File.dirname(__FILE__)}/../../../lib/cucumber_factory"
10
+
11
+ # Load dependencies
12
+ # require 'has_defaults'
13
+
14
+ # Require support code
15
+ # Dir["../shared/support/**/*.rb"].each {|f| require f}
16
+
17
+ # Run the migrations
18
+ print "\033[30m" # dark gray text
19
+ ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
20
+ print "\033[0m"
21
+
22
+ Spec::Runner.configure do |config|
23
+ config.use_transactional_fixtures = true
24
+ config.use_instantiated_fixtures = false
25
+ end
26
+
27
+
28
+
File without changes
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format progress
@@ -0,0 +1,8 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'sqlite3'
4
+ gem 'rails', '~>3.0.3'
5
+ gem 'rspec'
6
+ gem 'rspec-rails'
7
+ gem 'cucumber_factory', :path => '../..'
8
+
@@ -0,0 +1,10 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc 'Default: Run all specs for a specific rails version.'
5
+ task :default => :spec
6
+
7
+ desc "Run all specs for a specific rails version"
8
+ RSpec::Core::RakeTask.new(:spec) do |t|
9
+ t.pattern = defined?(SPEC) ? SPEC : ['**/*_spec.rb', '../shared/**/*_spec.rb']
10
+ end
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/**/*
@@ -0,0 +1,32 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+
10
+ module SpecApp
11
+ class Application < Rails::Application
12
+ config.encoding = "utf-8"
13
+
14
+ config.cache_classes = true
15
+ config.whiny_nils = true
16
+
17
+ config.consider_all_requests_local = true
18
+ config.action_controller.perform_caching = false
19
+
20
+ config.action_dispatch.show_exceptions = false
21
+
22
+ config.action_controller.allow_forgery_protection = false
23
+
24
+ config.action_mailer.delivery_method = :test
25
+
26
+ config.active_support.deprecation = :stderr
27
+
28
+ config.root = File.expand_path('../..', __FILE__)
29
+
30
+ # railties.plugins << Rails::Plugin.new(File.expand_path('../../../../..', __FILE__))
31
+ end
32
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,4 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: ":memory:"
4
+ verbosity: quiet
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ SpecApp::Application.initialize!
@@ -0,0 +1,35 @@
1
+ SpecApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ SpecApp::Application.config.secret_token = 'cb014a08a45243e7143f31e04774c342c1fba329fd594ae1a480d8283b1a851f425dc08044311fb4be6d000b6e6681de7c76d19148419a5ffa0a9f84556d3b33'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ SpecApp::Application.config.session_store :cookie_store, :key => '_app_root_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # SpecApp::Application.config.session_store :active_record_store
@@ -0,0 +1,3 @@
1
+ SpecApp::Application.routes.draw do
2
+ match ':controller(/:action(/:id(.:format)))'
3
+ end
@@ -0,0 +1,2 @@
1
+ --exclude "spec/*,gems/*"
2
+ --rails
@@ -0,0 +1,25 @@
1
+ $: << File.join(File.dirname(__FILE__), "/../../lib" )
2
+
3
+ ENV['RAILS_ENV'] = 'test'
4
+ ENV['RAILS_ROOT'] = 'app_root'
5
+
6
+ # Load the Rails environment and testing framework
7
+ require "#{File.dirname(__FILE__)}/../app_root/config/environment"
8
+ require 'rspec/rails'
9
+ require "#{File.dirname(__FILE__)}/../../../lib/cucumber_factory"
10
+
11
+ # Load dependencies
12
+ # require 'has_defaults'
13
+
14
+ # Require support code
15
+ # Dir["../shared/support/**/*.rb"].each {|f| require f}
16
+
17
+ # Run the migrations
18
+ print "\033[30m" # dark gray text
19
+ ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
20
+ print "\033[0m"
21
+
22
+ RSpec.configure do |config|
23
+ config.use_transactional_fixtures = true
24
+ config.use_instantiated_fixtures = false
25
+ end
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format progress
@@ -0,0 +1,8 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'sqlite3'
4
+ gem 'rails', '~>3.2'
5
+ gem 'rspec'
6
+ gem 'rspec-rails'
7
+ gem 'cucumber_factory', :path => '../..'
8
+
@@ -0,0 +1,10 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc 'Default: Run all specs for a specific rails version.'
5
+ task :default => :spec
6
+
7
+ desc "Run all specs for a specific rails version"
8
+ RSpec::Core::RakeTask.new(:spec) do |t|
9
+ t.pattern = defined?(SPEC) ? SPEC : ['**/*_spec.rb', '../shared/**/*_spec.rb']
10
+ end
@@ -0,0 +1,4 @@
1
+ .bundle
2
+ db/*.sqlite3
3
+ log/*.log
4
+ tmp/**/*
@@ -0,0 +1,32 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+
10
+ module SpecApp
11
+ class Application < Rails::Application
12
+ config.encoding = "utf-8"
13
+
14
+ config.cache_classes = true
15
+ config.whiny_nils = true
16
+
17
+ config.consider_all_requests_local = true
18
+ config.action_controller.perform_caching = false
19
+
20
+ config.action_dispatch.show_exceptions = false
21
+
22
+ config.action_controller.allow_forgery_protection = false
23
+
24
+ config.action_mailer.delivery_method = :test
25
+
26
+ config.active_support.deprecation = :stderr
27
+
28
+ config.root = File.expand_path('../..', __FILE__)
29
+
30
+ # railties.plugins << Rails::Plugin.new(File.expand_path('../../../../..', __FILE__))
31
+ end
32
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,4 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: ":memory:"
4
+ verbosity: quiet
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ SpecApp::Application.initialize!
@@ -0,0 +1,35 @@
1
+ SpecApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
29
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
30
+ # like if you have constraints or database-specific column types
31
+ # config.active_record.schema_format = :sql
32
+
33
+ # Print deprecation notices to the stderr
34
+ config.active_support.deprecation = :stderr
35
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!