has_defaults 0.4.2 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/.ruby-version +1 -0
  2. data/.travis.yml +56 -0
  3. data/{MIT-LICENSE → LICENSE} +1 -1
  4. data/README.md +23 -4
  5. data/Rakefile +5 -29
  6. data/gemfiles/Gemfile.2.3.mysql2 +13 -0
  7. data/gemfiles/Gemfile.2.3.mysql2.lock +32 -0
  8. data/gemfiles/Gemfile.3.2.mysql2 +12 -0
  9. data/gemfiles/Gemfile.3.2.mysql2.lock +57 -0
  10. data/gemfiles/Gemfile.4.2.mysql2 +10 -0
  11. data/gemfiles/Gemfile.4.2.mysql2.lock +61 -0
  12. data/gemfiles/Gemfile.4.2.pg +10 -0
  13. data/gemfiles/Gemfile.4.2.pg.lock +61 -0
  14. data/gemfiles/Gemfile.5.0.mysql2 +10 -0
  15. data/gemfiles/Gemfile.5.0.mysql2.lock +58 -0
  16. data/gemfiles/Gemfile.5.0.pg +10 -0
  17. data/gemfiles/Gemfile.5.0.pg.lock +58 -0
  18. data/lib/has_defaults.rb +1 -3
  19. data/lib/has_defaults/active_record_ext.rb +9 -2
  20. data/lib/has_defaults/version.rb +1 -1
  21. data/spec/{shared/has_defaults → has_defaults}/active_record_ext_spec.rb +3 -3
  22. data/spec/spec_helper.rb +18 -0
  23. data/spec/support/database.rb +16 -0
  24. data/spec/support/database.sample.yml +10 -0
  25. data/spec/support/database.travis.yml +9 -0
  26. data/spec/support/database.yml +10 -0
  27. data/spec/{shared/app_root/app/models/donut.rb → support/models.rb} +11 -0
  28. metadata +28 -76
  29. data/spec/rails-2.3/Gemfile +0 -8
  30. data/spec/rails-2.3/Gemfile.lock +0 -51
  31. data/spec/rails-2.3/Rakefile +0 -11
  32. data/spec/rails-2.3/app_root/config/boot.rb +0 -129
  33. data/spec/rails-2.3/app_root/config/database.yml +0 -4
  34. data/spec/rails-2.3/app_root/config/environment.rb +0 -14
  35. data/spec/rails-2.3/app_root/config/environments/test.rb +0 -28
  36. data/spec/rails-2.3/app_root/config/preinitializer.rb +0 -20
  37. data/spec/rails-2.3/app_root/config/routes.rb +0 -4
  38. data/spec/rails-2.3/app_root/lib/console_with_fixtures.rb +0 -4
  39. data/spec/rails-2.3/app_root/log/.gitignore +0 -1
  40. data/spec/rails-2.3/app_root/script/console +0 -7
  41. data/spec/rails-2.3/rcov.opts +0 -2
  42. data/spec/rails-2.3/spec.opts +0 -4
  43. data/spec/rails-2.3/spec_helper.rb +0 -24
  44. data/spec/rails-3.0/.rspec +0 -2
  45. data/spec/rails-3.0/Gemfile +0 -9
  46. data/spec/rails-3.0/Gemfile.lock +0 -101
  47. data/spec/rails-3.0/Rakefile +0 -10
  48. data/spec/rails-3.0/app_root/.gitignore +0 -4
  49. data/spec/rails-3.0/app_root/config/application.rb +0 -32
  50. data/spec/rails-3.0/app_root/config/boot.rb +0 -13
  51. data/spec/rails-3.0/app_root/config/database.yml +0 -4
  52. data/spec/rails-3.0/app_root/config/environment.rb +0 -5
  53. data/spec/rails-3.0/app_root/config/environments/test.rb +0 -35
  54. data/spec/rails-3.0/app_root/config/initializers/backtrace_silencers.rb +0 -7
  55. data/spec/rails-3.0/app_root/config/initializers/inflections.rb +0 -10
  56. data/spec/rails-3.0/app_root/config/initializers/mime_types.rb +0 -5
  57. data/spec/rails-3.0/app_root/config/initializers/secret_token.rb +0 -7
  58. data/spec/rails-3.0/app_root/config/initializers/session_store.rb +0 -8
  59. data/spec/rails-3.0/app_root/config/locales/en.yml +0 -5
  60. data/spec/rails-3.0/app_root/config/routes.rb +0 -58
  61. data/spec/rails-3.0/app_root/lib/tasks/.gitkeep +0 -0
  62. data/spec/rails-3.0/app_root/log/.gitkeep +0 -0
  63. data/spec/rails-3.0/app_root/script/rails +0 -6
  64. data/spec/rails-3.0/log/in_memory.log +0 -33
  65. data/spec/rails-3.0/rcov.opts +0 -2
  66. data/spec/rails-3.0/spec_helper.rb +0 -25
  67. data/spec/rails-3.2/.rspec +0 -2
  68. data/spec/rails-3.2/Gemfile +0 -9
  69. data/spec/rails-3.2/Gemfile.lock +0 -120
  70. data/spec/rails-3.2/Rakefile +0 -10
  71. data/spec/rails-3.2/app_root/.gitignore +0 -4
  72. data/spec/rails-3.2/app_root/config/application.rb +0 -32
  73. data/spec/rails-3.2/app_root/config/boot.rb +0 -13
  74. data/spec/rails-3.2/app_root/config/database.yml +0 -4
  75. data/spec/rails-3.2/app_root/config/environment.rb +0 -5
  76. data/spec/rails-3.2/app_root/config/environments/test.rb +0 -35
  77. data/spec/rails-3.2/app_root/config/initializers/backtrace_silencers.rb +0 -7
  78. data/spec/rails-3.2/app_root/config/initializers/inflections.rb +0 -10
  79. data/spec/rails-3.2/app_root/config/initializers/mime_types.rb +0 -5
  80. data/spec/rails-3.2/app_root/config/initializers/secret_token.rb +0 -7
  81. data/spec/rails-3.2/app_root/config/initializers/session_store.rb +0 -8
  82. data/spec/rails-3.2/app_root/config/locales/en.yml +0 -5
  83. data/spec/rails-3.2/app_root/config/routes.rb +0 -58
  84. data/spec/rails-3.2/app_root/lib/tasks/.gitkeep +0 -0
  85. data/spec/rails-3.2/app_root/log/.gitkeep +0 -0
  86. data/spec/rails-3.2/app_root/script/rails +0 -6
  87. data/spec/rails-3.2/log/in_memory.log +0 -33
  88. data/spec/rails-3.2/rcov.opts +0 -2
  89. data/spec/rails-3.2/spec_helper.rb +0 -25
  90. data/spec/shared/app_root/app/controllers/application_controller.rb +0 -2
  91. data/spec/shared/app_root/app/models/model_without_defaults.rb +0 -2
  92. data/spec/shared/app_root/app/models/pastry.rb +0 -6
  93. data/spec/shared/app_root/db/migrate/001_create_pastries.rb +0 -19
  94. data/spec/shared/app_root/db/migrate/002_create_model_without_defaults.rb +0 -12
@@ -1,129 +0,0 @@
1
- # Allow customization of the rails framework path
2
- RAILS_FRAMEWORK_ROOT = (ENV['RAILS_FRAMEWORK_ROOT'] || "#{File.dirname(__FILE__)}/../../../../../../vendor/rails") unless defined?(RAILS_FRAMEWORK_ROOT)
3
-
4
- # Don't change this file!
5
- # Configure your app in config/environment.rb and config/environments/*.rb
6
-
7
- RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
8
-
9
- module Rails
10
- class << self
11
- def boot!
12
- unless booted?
13
- preinitialize
14
- pick_boot.run
15
- end
16
- end
17
-
18
- def booted?
19
- defined? Rails::Initializer
20
- end
21
-
22
- def pick_boot
23
- (vendor_rails? ? VendorBoot : GemBoot).new
24
- end
25
-
26
- def vendor_rails?
27
- File.exist?(RAILS_FRAMEWORK_ROOT)
28
- end
29
-
30
- def preinitialize
31
- load(preinitializer_path) if File.exist?(preinitializer_path)
32
- end
33
-
34
- def preinitializer_path
35
- "#{RAILS_ROOT}/config/preinitializer.rb"
36
- end
37
- end
38
-
39
- class Boot
40
- def run
41
- load_initializer
42
- Rails::Initializer.run(:set_load_path)
43
- end
44
- end
45
-
46
- class VendorBoot < Boot
47
- def load_initializer
48
- require "#{RAILS_FRAMEWORK_ROOT}/railties/lib/initializer"
49
- Rails::Initializer.run(:install_gem_spec_stubs)
50
- end
51
- end
52
-
53
- class GemBoot < Boot
54
- def load_initializer
55
- self.class.load_rubygems
56
- load_rails_gem
57
- require 'initializer'
58
- end
59
-
60
- def load_rails_gem
61
- if version = self.class.gem_version
62
- gem 'rails', version
63
- else
64
- gem 'rails'
65
- end
66
- rescue Gem::LoadError => load_error
67
- $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
68
- exit 1
69
- end
70
-
71
- class << self
72
- def rubygems_version
73
- Gem::RubyGemsVersion rescue nil
74
- end
75
-
76
- def gem_version
77
- if defined? RAILS_GEM_VERSION
78
- RAILS_GEM_VERSION
79
- elsif ENV.include?('RAILS_GEM_VERSION')
80
- ENV['RAILS_GEM_VERSION']
81
- else
82
- parse_gem_version(read_environment_rb)
83
- end
84
- end
85
-
86
- def load_rubygems
87
- require 'rubygems'
88
- min_version = '1.1.1'
89
- unless rubygems_version >= min_version
90
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
91
- exit 1
92
- end
93
-
94
- rescue LoadError
95
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
96
- exit 1
97
- end
98
-
99
- def parse_gem_version(text)
100
- $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
101
- end
102
-
103
- private
104
- def read_environment_rb
105
- environment_rb = "#{RAILS_ROOT}/config/environment.rb"
106
- environment_rb = "#{HELPER_RAILS_ROOT}/config/environment.rb" unless File.exists?(environment_rb)
107
- File.read(environment_rb)
108
- end
109
- end
110
- end
111
- end
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
-
128
- # All that for this:
129
- Rails.boot!
@@ -1,4 +0,0 @@
1
- test:
2
- adapter: sqlite3
3
- database: ":memory:"
4
- verbosity: quiet
@@ -1,14 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'boot')
2
-
3
- Rails::Initializer.run do |config|
4
- config.cache_classes = false
5
- config.whiny_nils = true
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
- end
@@ -1,28 +0,0 @@
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
@@ -1,20 +0,0 @@
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
@@ -1,4 +0,0 @@
1
- ActionController::Routing::Routes.draw do |map|
2
- map.connect ':controller/:action/:id'
3
- map.connect ':controller/:action/:id.:format'
4
- end
@@ -1,4 +0,0 @@
1
- # Loads fixtures into the database when running the test app via the console
2
- (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(Rails.root, '../fixtures/*.{yml,csv}'))).each do |fixture_file|
3
- Fixtures.create_fixtures(File.join(Rails.root, '../fixtures'), File.basename(fixture_file, '.*'))
4
- end
@@ -1 +0,0 @@
1
- *.log
@@ -1,7 +0,0 @@
1
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
2
- libs = " -r irb/completion"
3
- libs << " -r test/test_helper"
4
- libs << " -r console_app"
5
- libs << " -r console_with_helpers"
6
- libs << " -r console_with_fixtures"
7
- exec "#{irb} #{libs} --simple-prompt"
@@ -1,2 +0,0 @@
1
- --exclude "spec/*,gems/*"
2
- --rails
@@ -1,4 +0,0 @@
1
- --colour
2
- --format progress
3
- --loadby mtime
4
- --reverse
@@ -1,24 +0,0 @@
1
- $: << File.join(File.dirname(__FILE__), "/../lib" )
2
-
3
- # Set the default environment to sqlite3's in_memory database
4
- ENV['RAILS_ENV'] ||= 'test'
5
-
6
- # Load the Rails environment and testing framework
7
- require "#{File.dirname(__FILE__)}/app_root/config/environment"
8
- require 'spec/rails'
9
-
10
- # Load dependencies
11
- # require 'has_defaults'
12
-
13
- # Require support code
14
- # Dir["../shared/support/**/*.rb"].each {|f| require f}
15
-
16
- # Run the migrations
17
- print "\033[30m" # dark gray text
18
- ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
19
- print "\033[0m"
20
-
21
- Spec::Runner.configure do |config|
22
- config.use_transactional_fixtures = true
23
- config.use_instantiated_fixtures = false
24
- end
@@ -1,2 +0,0 @@
1
- --colour
2
- --format progress
@@ -1,9 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'sqlite3'
4
- gem 'rails', '=3.0.3'
5
- gem 'rspec'
6
- gem 'rspec-rails'
7
- gem 'ruby-debug'
8
- gem 'has_defaults', :path => '../..'
9
-
@@ -1,101 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- has_defaults (0.4.1)
5
- activerecord
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- abstract (1.0.0)
11
- actionmailer (3.0.3)
12
- actionpack (= 3.0.3)
13
- mail (~> 2.2.9)
14
- actionpack (3.0.3)
15
- activemodel (= 3.0.3)
16
- activesupport (= 3.0.3)
17
- builder (~> 2.1.2)
18
- erubis (~> 2.6.6)
19
- i18n (~> 0.4)
20
- rack (~> 1.2.1)
21
- rack-mount (~> 0.6.13)
22
- rack-test (~> 0.5.6)
23
- tzinfo (~> 0.3.23)
24
- activemodel (3.0.3)
25
- activesupport (= 3.0.3)
26
- builder (~> 2.1.2)
27
- i18n (~> 0.4)
28
- activerecord (3.0.3)
29
- activemodel (= 3.0.3)
30
- activesupport (= 3.0.3)
31
- arel (~> 2.0.2)
32
- tzinfo (~> 0.3.23)
33
- activeresource (3.0.3)
34
- activemodel (= 3.0.3)
35
- activesupport (= 3.0.3)
36
- activesupport (3.0.3)
37
- arel (2.0.4)
38
- builder (2.1.2)
39
- columnize (0.3.2)
40
- diff-lcs (1.1.2)
41
- erubis (2.6.6)
42
- abstract (>= 1.0.0)
43
- i18n (0.4.2)
44
- linecache (0.43)
45
- mail (2.2.10)
46
- activesupport (>= 2.3.6)
47
- i18n (~> 0.4.1)
48
- mime-types (~> 1.16)
49
- treetop (~> 1.4.8)
50
- mime-types (1.16)
51
- polyglot (0.3.1)
52
- rack (1.2.1)
53
- rack-mount (0.6.13)
54
- rack (>= 1.0.0)
55
- rack-test (0.5.6)
56
- rack (>= 1.0)
57
- rails (3.0.3)
58
- actionmailer (= 3.0.3)
59
- actionpack (= 3.0.3)
60
- activerecord (= 3.0.3)
61
- activeresource (= 3.0.3)
62
- activesupport (= 3.0.3)
63
- bundler (~> 1.0)
64
- railties (= 3.0.3)
65
- railties (3.0.3)
66
- actionpack (= 3.0.3)
67
- activesupport (= 3.0.3)
68
- rake (>= 0.8.7)
69
- thor (~> 0.14.4)
70
- rake (0.8.7)
71
- rspec (2.1.0)
72
- rspec-core (~> 2.1.0)
73
- rspec-expectations (~> 2.1.0)
74
- rspec-mocks (~> 2.1.0)
75
- rspec-core (2.1.0)
76
- rspec-expectations (2.1.0)
77
- diff-lcs (~> 1.1.2)
78
- rspec-mocks (2.1.0)
79
- rspec-rails (2.1.0)
80
- rspec (~> 2.1.0)
81
- ruby-debug (0.10.4)
82
- columnize (>= 0.1)
83
- ruby-debug-base (~> 0.10.4.0)
84
- ruby-debug-base (0.10.4)
85
- linecache (>= 0.3)
86
- sqlite3 (1.3.6)
87
- thor (0.14.6)
88
- treetop (1.4.9)
89
- polyglot (>= 0.3.1)
90
- tzinfo (0.3.23)
91
-
92
- PLATFORMS
93
- ruby
94
-
95
- DEPENDENCIES
96
- has_defaults!
97
- rails (= 3.0.3)
98
- rspec
99
- rspec-rails
100
- ruby-debug
101
- sqlite3
@@ -1,10 +0,0 @@
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
@@ -1,4 +0,0 @@
1
- .bundle
2
- db/*.sqlite3
3
- log/*.log
4
- tmp/**/*
@@ -1,32 +0,0 @@
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
@@ -1,13 +0,0 @@
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)
@@ -1,4 +0,0 @@
1
- test:
2
- adapter: sqlite3
3
- database: ":memory:"
4
- verbosity: quiet