has_defaults 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/Rakefile +25 -9
  2. data/has_defaults.gemspec +2 -2
  3. data/lib/has_defaults/active_record_ext.rb +8 -2
  4. data/lib/has_defaults/version.rb +1 -1
  5. data/spec/{rails2 → rails-2.3}/Gemfile +0 -0
  6. data/spec/{rails2 → rails-2.3}/Gemfile.lock +2 -2
  7. data/spec/{rails2 → rails-2.3}/Rakefile +1 -1
  8. data/spec/{rails2 → rails-2.3}/app_root/config/boot.rb +15 -0
  9. data/spec/rails-2.3/app_root/config/database.yml +4 -0
  10. data/spec/{rails2 → rails-2.3}/app_root/config/environment.rb +7 -7
  11. data/spec/rails-2.3/app_root/config/environments/test.rb +28 -0
  12. data/spec/rails-2.3/app_root/config/preinitializer.rb +20 -0
  13. data/spec/{rails2 → rails-2.3}/app_root/config/routes.rb +0 -0
  14. data/spec/{rails2 → rails-2.3}/app_root/lib/console_with_fixtures.rb +0 -0
  15. data/spec/{rails2 → rails-2.3}/app_root/log/.gitignore +0 -0
  16. data/spec/{rails2 → rails-2.3}/app_root/script/console +0 -0
  17. data/spec/{rails2 → rails-2.3}/rcov.opts +0 -0
  18. data/spec/{rails2 → rails-2.3}/spec.opts +0 -0
  19. data/spec/{rails2 → rails-2.3}/spec_helper.rb +8 -4
  20. data/spec/{rails3 → rails-3.0}/.rspec +0 -0
  21. data/spec/{rails3 → rails-3.0}/Gemfile +0 -0
  22. data/spec/{rails3 → rails-3.0}/Gemfile.lock +2 -2
  23. data/spec/{rails3 → rails-3.0}/Rakefile +1 -1
  24. data/spec/{rails3 → rails-3.0}/app_root/.gitignore +0 -0
  25. data/spec/{rails3 → rails-3.0}/app_root/config/application.rb +1 -1
  26. data/spec/{rails3 → rails-3.0}/app_root/config/boot.rb +0 -0
  27. data/spec/rails-3.0/app_root/config/database.yml +4 -0
  28. data/spec/{rails3 → rails-3.0}/app_root/config/environment.rb +0 -0
  29. data/spec/{rails3 → rails-3.0}/app_root/config/environments/test.rb +0 -0
  30. data/spec/{rails3 → rails-3.0}/app_root/config/initializers/backtrace_silencers.rb +0 -0
  31. data/spec/{rails3 → rails-3.0}/app_root/config/initializers/inflections.rb +0 -0
  32. data/spec/{rails3 → rails-3.0}/app_root/config/initializers/mime_types.rb +0 -0
  33. data/spec/{rails3 → rails-3.0}/app_root/config/initializers/secret_token.rb +0 -0
  34. data/spec/{rails3 → rails-3.0}/app_root/config/initializers/session_store.rb +0 -0
  35. data/spec/{rails3 → rails-3.0}/app_root/config/locales/en.yml +0 -0
  36. data/spec/{rails3 → rails-3.0}/app_root/config/routes.rb +0 -0
  37. data/spec/{rails3 → rails-3.0}/app_root/lib/tasks/.gitkeep +0 -0
  38. data/spec/{rails3 → rails-3.0}/app_root/log/.gitkeep +0 -0
  39. data/spec/{rails3 → rails-3.0}/app_root/script/rails +0 -0
  40. data/spec/{rails3 → rails-3.0}/log/in_memory.log +0 -0
  41. data/spec/{rails3 → rails-3.0}/rcov.opts +0 -0
  42. data/spec/{rails3 → rails-3.0}/spec_helper.rb +8 -4
  43. data/spec/rails-3.2/.rspec +2 -0
  44. data/spec/rails-3.2/Gemfile +9 -0
  45. data/spec/rails-3.2/Gemfile.lock +120 -0
  46. data/spec/rails-3.2/Rakefile +10 -0
  47. data/spec/rails-3.2/app_root/.gitignore +4 -0
  48. data/spec/rails-3.2/app_root/config/application.rb +32 -0
  49. data/spec/rails-3.2/app_root/config/boot.rb +13 -0
  50. data/spec/rails-3.2/app_root/config/database.yml +4 -0
  51. data/spec/rails-3.2/app_root/config/environment.rb +5 -0
  52. data/spec/rails-3.2/app_root/config/environments/test.rb +35 -0
  53. data/spec/rails-3.2/app_root/config/initializers/backtrace_silencers.rb +7 -0
  54. data/spec/rails-3.2/app_root/config/initializers/inflections.rb +10 -0
  55. data/spec/rails-3.2/app_root/config/initializers/mime_types.rb +5 -0
  56. data/spec/rails-3.2/app_root/config/initializers/secret_token.rb +7 -0
  57. data/spec/rails-3.2/app_root/config/initializers/session_store.rb +8 -0
  58. data/spec/rails-3.2/app_root/config/locales/en.yml +5 -0
  59. data/spec/rails-3.2/app_root/config/routes.rb +58 -0
  60. data/spec/{rails2/app_root/config/environments/in_memory.rb → rails-3.2/app_root/lib/tasks/.gitkeep} +0 -0
  61. data/spec/{rails2/app_root/config/environments/mysql.rb → rails-3.2/app_root/log/.gitkeep} +0 -0
  62. data/spec/rails-3.2/app_root/script/rails +6 -0
  63. data/spec/rails-3.2/log/in_memory.log +33 -0
  64. data/spec/rails-3.2/rcov.opts +2 -0
  65. data/spec/rails-3.2/spec_helper.rb +25 -0
  66. data/spec/{rails2 → shared}/app_root/app/controllers/application_controller.rb +0 -0
  67. data/spec/{rails2 → shared}/app_root/app/models/donut.rb +0 -0
  68. data/spec/{rails2 → shared}/app_root/app/models/model_without_defaults.rb +0 -0
  69. data/spec/{rails2 → shared}/app_root/app/models/pastry.rb +0 -0
  70. data/spec/{rails2 → shared}/app_root/db/migrate/001_create_pastries.rb +0 -0
  71. data/spec/{rails2 → shared}/app_root/db/migrate/002_create_model_without_defaults.rb +0 -0
  72. data/spec/{rails2/has_defaults_spec.rb → shared/has_defaults/active_record_ext_spec.rb} +20 -15
  73. metadata +76 -68
  74. data/spec/rails2/app_root/config/database.yml +0 -21
  75. data/spec/rails2/app_root/config/environments/postgresql.rb +0 -0
  76. data/spec/rails2/app_root/config/environments/sqlite.rb +0 -0
  77. data/spec/rails2/app_root/config/environments/sqlite3.rb +0 -0
  78. data/spec/rails3/app_root/app/controllers/application_controller.rb +0 -2
  79. data/spec/rails3/app_root/app/models/donut.rb +0 -21
  80. data/spec/rails3/app_root/app/models/model_without_defaults.rb +0 -2
  81. data/spec/rails3/app_root/app/models/pastry.rb +0 -6
  82. data/spec/rails3/app_root/config/database.yml +0 -21
  83. data/spec/rails3/app_root/config/environments/in_memory.rb +0 -0
  84. data/spec/rails3/app_root/config/environments/mysql.rb +0 -0
  85. data/spec/rails3/app_root/config/environments/postgresql.rb +0 -0
  86. data/spec/rails3/app_root/config/environments/sqlite.rb +0 -0
  87. data/spec/rails3/app_root/config/environments/sqlite3.rb +0 -0
  88. data/spec/rails3/app_root/db/migrate/001_create_pastries.rb +0 -18
  89. data/spec/rails3/app_root/db/migrate/002_create_model_without_defaults.rb +0 -12
  90. data/spec/rails3/has_defaults_spec.rb +0 -74
data/Rakefile CHANGED
@@ -3,15 +3,31 @@ require 'spec/rake/spectask'
3
3
  require 'bundler/gem_tasks'
4
4
 
5
5
  desc 'Default: Run all specs.'
6
- task :default => :all_specs
6
+ task :default => 'all:spec'
7
7
 
8
- desc "Run all specs"
9
- task :all_specs do
10
- Dir['spec/**/Rakefile'].each do |rakefile|
11
- directory_name = File.dirname(rakefile)
12
- sh <<-CMD
13
- cd #{directory_name}
14
- bundle exec rake
15
- CMD
8
+ namespace :all do
9
+
10
+ desc "Run specs on all spec apps"
11
+ task :spec do
12
+ for_each_directory_of('spec/**/Rakefile') do |directory|
13
+ env = "SPEC=../../#{ENV['SPEC']} " if ENV['SPEC']
14
+ system("cd #{directory} && #{env} bundle exec rake spec")
15
+ end
16
+ end
17
+
18
+ desc "Bundle all spec apps"
19
+ task :bundle do
20
+ for_each_directory_of('spec/**/Gemfile') do |directory|
21
+ system("cd #{directory} && bundle install")
22
+ end
23
+ end
24
+
25
+ end
26
+
27
+ def for_each_directory_of(path, &block)
28
+ Dir[path].sort.each do |rakefile|
29
+ directory = File.dirname(rakefile)
30
+ puts '', "\033[44m#{directory}\033[0m", ''
31
+ block.call(directory)
16
32
  end
17
33
  end
data/has_defaults.gemspec CHANGED
@@ -15,5 +15,5 @@ Gem::Specification.new do |s|
15
15
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
16
  s.require_paths = ["lib"]
17
17
 
18
- s.add_dependency('rspec')
19
- end
18
+ s.add_dependency('activerecord')
19
+ end
@@ -8,8 +8,14 @@ module HasDefaults
8
8
 
9
9
  include InstanceMethods
10
10
 
11
- unless respond_to?(:has_defaults_options)
12
- class_inheritable_hash :has_defaults_options
11
+ if respond_to?(:has_defaults_options)
12
+ self.has_defaults_options = has_defaults_options.dup
13
+ else
14
+ if respond_to?(:class_attribute)
15
+ class_attribute :has_defaults_options
16
+ else
17
+ class_inheritable_hash :has_defaults_options
18
+ end
13
19
  end
14
20
 
15
21
  self.has_defaults_options ||= {}
@@ -1,5 +1,5 @@
1
1
  module HasDefaults
2
2
 
3
- VERSION = '0.3.1'
3
+ VERSION = '0.4.0'
4
4
 
5
5
  end
File without changes
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- has_defaults (0.3.0)
5
- rspec
4
+ has_defaults (0.3.1)
5
+ activerecord
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
@@ -7,5 +7,5 @@ task :default => :spec
7
7
  desc "Run all specs for a specific rails version"
8
8
  Spec::Rake::SpecTask.new() do |t|
9
9
  t.spec_opts = ['--options', "\"spec.opts\""]
10
- t.spec_files = FileList['**/*_spec.rb']
10
+ t.spec_files = defined?(SPEC) ? SPEC : FileList['**/*_spec.rb', '../shared/**/*_spec.rb']
11
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,11 @@ 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)
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
14
  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
File without changes
File without changes
File without changes
@@ -1,18 +1,22 @@
1
1
  $: << File.join(File.dirname(__FILE__), "/../lib" )
2
2
 
3
3
  # Set the default environment to sqlite3's in_memory database
4
- ENV['RAILS_ENV'] ||= 'in_memory'
4
+ ENV['RAILS_ENV'] ||= 'test'
5
5
 
6
6
  # Load the Rails environment and testing framework
7
7
  require "#{File.dirname(__FILE__)}/app_root/config/environment"
8
- require "#{File.dirname(__FILE__)}/../../lib/has_defaults"
9
8
  require 'spec/rails'
10
9
 
11
- # Undo changes to RAILS_ENV
12
- silence_warnings {RAILS_ENV = ENV['RAILS_ENV']}
10
+ # Load dependencies
11
+ # require 'has_defaults'
12
+
13
+ # Require support code
14
+ # Dir["../shared/support/**/*.rb"].each {|f| require f}
13
15
 
14
16
  # Run the migrations
17
+ print "\033[30m" # dark gray text
15
18
  ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
19
+ print "\033[0m"
16
20
 
17
21
  Spec::Runner.configure do |config|
18
22
  config.use_transactional_fixtures = true
File without changes
File without changes
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- has_defaults (0.3.0)
5
- rspec
4
+ has_defaults (0.3.1)
5
+ activerecord
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
@@ -6,5 +6,5 @@ task :default => :spec
6
6
 
7
7
  desc "Run all specs for a specific rails version"
8
8
  RSpec::Core::RakeTask.new(:spec) do |t|
9
- t.pattern = '**/*_spec.rb'
9
+ t.pattern = defined?(SPEC) ? SPEC : ['**/*_spec.rb', '../shared/**/*_spec.rb']
10
10
  end
File without changes
@@ -27,6 +27,6 @@ module HasDefaultSpecApp
27
27
 
28
28
  config.root = File.expand_path('../..', __FILE__)
29
29
 
30
- railties.plugins << Rails::Plugin.new(File.expand_path('../../../../..', __FILE__))
30
+ # railties.plugins << Rails::Plugin.new(File.expand_path('../../../../..', __FILE__))
31
31
  end
32
32
  end
File without changes
@@ -0,0 +1,4 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: ":memory:"
4
+ verbosity: quiet
File without changes
File without changes
File without changes
File without changes
@@ -1,19 +1,23 @@
1
1
  $: << File.join(File.dirname(__FILE__), "/../lib" )
2
2
 
3
3
  # Set the default environment to sqlite3's in_memory database
4
- ENV['RAILS_ENV'] ||= 'in_memory'
4
+ ENV['RAILS_ENV'] ||= 'test'
5
5
  ENV['RAILS_ROOT'] = 'app_root'
6
6
 
7
7
  # Load the Rails environment and testing framework
8
8
  require "#{File.dirname(__FILE__)}/app_root/config/environment"
9
- require "#{File.dirname(__FILE__)}/../../lib/has_defaults"
10
9
  require 'rspec/rails'
11
10
 
12
- # Undo changes to RAILS_ENV
13
- silence_warnings {RAILS_ENV = ENV['RAILS_ENV']}
11
+ # Load dependencies
12
+ # require 'has_defaults'
13
+
14
+ # Require support code
15
+ # Dir["../shared/support/**/*.rb"].each {|f| require f}
14
16
 
15
17
  # Run the migrations
18
+ print "\033[30m" # dark gray text
16
19
  ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
20
+ print "\033[0m"
17
21
 
18
22
  RSpec.configure do |config|
19
23
  config.use_transactional_fixtures = true
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format progress
@@ -0,0 +1,9 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'sqlite3'
4
+ gem 'rails', '~>3.2'
5
+ gem 'rspec'
6
+ gem 'rspec-rails'
7
+ gem 'ruby-debug'
8
+ gem 'has_defaults', :path => '../..'
9
+
@@ -0,0 +1,120 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ has_defaults (0.3.1)
5
+ activerecord
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.6)
11
+ actionpack (= 3.2.6)
12
+ mail (~> 2.4.4)
13
+ actionpack (3.2.6)
14
+ activemodel (= 3.2.6)
15
+ activesupport (= 3.2.6)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.1)
19
+ rack (~> 1.4.0)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.1.3)
23
+ activemodel (3.2.6)
24
+ activesupport (= 3.2.6)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.6)
27
+ activemodel (= 3.2.6)
28
+ activesupport (= 3.2.6)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.6)
32
+ activemodel (= 3.2.6)
33
+ activesupport (= 3.2.6)
34
+ activesupport (3.2.6)
35
+ i18n (~> 0.6)
36
+ multi_json (~> 1.0)
37
+ arel (3.0.2)
38
+ builder (3.0.0)
39
+ columnize (0.3.6)
40
+ diff-lcs (1.1.3)
41
+ erubis (2.7.0)
42
+ hike (1.2.1)
43
+ i18n (0.6.0)
44
+ journey (1.0.4)
45
+ json (1.7.3)
46
+ linecache (0.46)
47
+ rbx-require-relative (> 0.0.4)
48
+ mail (2.4.4)
49
+ i18n (>= 0.4.0)
50
+ mime-types (~> 1.16)
51
+ treetop (~> 1.4.8)
52
+ mime-types (1.19)
53
+ multi_json (1.3.6)
54
+ polyglot (0.3.3)
55
+ rack (1.4.1)
56
+ rack-cache (1.2)
57
+ rack (>= 0.4)
58
+ rack-ssl (1.3.2)
59
+ rack
60
+ rack-test (0.6.1)
61
+ rack (>= 1.0)
62
+ rails (3.2.6)
63
+ actionmailer (= 3.2.6)
64
+ actionpack (= 3.2.6)
65
+ activerecord (= 3.2.6)
66
+ activeresource (= 3.2.6)
67
+ activesupport (= 3.2.6)
68
+ bundler (~> 1.0)
69
+ railties (= 3.2.6)
70
+ railties (3.2.6)
71
+ actionpack (= 3.2.6)
72
+ activesupport (= 3.2.6)
73
+ rack-ssl (~> 1.3.2)
74
+ rake (>= 0.8.7)
75
+ rdoc (~> 3.4)
76
+ thor (>= 0.14.6, < 2.0)
77
+ rake (0.9.2.2)
78
+ rbx-require-relative (0.0.9)
79
+ rdoc (3.12)
80
+ json (~> 1.4)
81
+ rspec (2.8.0)
82
+ rspec-core (~> 2.8.0)
83
+ rspec-expectations (~> 2.8.0)
84
+ rspec-mocks (~> 2.8.0)
85
+ rspec-core (2.8.0)
86
+ rspec-expectations (2.8.0)
87
+ diff-lcs (~> 1.1.2)
88
+ rspec-mocks (2.8.0)
89
+ rspec-rails (2.8.1)
90
+ actionpack (>= 3.0)
91
+ activesupport (>= 3.0)
92
+ railties (>= 3.0)
93
+ rspec (~> 2.8.0)
94
+ ruby-debug (0.10.4)
95
+ columnize (>= 0.1)
96
+ ruby-debug-base (~> 0.10.4.0)
97
+ ruby-debug-base (0.10.4)
98
+ linecache (>= 0.3)
99
+ sprockets (2.1.3)
100
+ hike (~> 1.2)
101
+ rack (~> 1.0)
102
+ tilt (~> 1.1, != 1.3.0)
103
+ sqlite3 (1.3.6)
104
+ thor (0.15.3)
105
+ tilt (1.3.3)
106
+ treetop (1.4.10)
107
+ polyglot
108
+ polyglot (>= 0.3.1)
109
+ tzinfo (0.3.33)
110
+
111
+ PLATFORMS
112
+ ruby
113
+
114
+ DEPENDENCIES
115
+ has_defaults!
116
+ rails (~> 3.2)
117
+ rspec
118
+ rspec-rails
119
+ ruby-debug
120
+ sqlite3
@@ -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 HasDefaultSpecApp
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
+ HasDefaultSpecApp::Application.initialize!
@@ -0,0 +1,35 @@
1
+ HasDefaultSpecApp::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
+ HasDefaultSpecApp::Application.config.secret_token = 'cb014a08a45243e7143f31e04774c342c1fba329fd594ae1a480d8283b1a851f425dc08044311fb4be6d000b6e6681de7c76d19148419a5ffa0a9f84556d3b33'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ HasDefaultSpecApp::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
+ # HasDefaultSpecApp::Application.config.session_store :active_record_store
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"