assignable_values 0.11.2 → 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/.travis.yml +0 -2
  2. data/README.md +1 -1
  3. data/lib/assignable_values/active_record/restriction/base.rb +4 -2
  4. data/lib/assignable_values/active_record/restriction/belongs_to_association.rb +3 -3
  5. data/lib/assignable_values/version.rb +1 -1
  6. data/spec/rails-2.3/Gemfile.lock +4 -1
  7. data/spec/rails-3.2/Gemfile.lock +4 -1
  8. data/spec/rails-4.1/Gemfile.lock +4 -1
  9. data/spec/shared/assignable_values/active_record_spec.rb +19 -2
  10. metadata +6 -51
  11. data/spec/rails-3.0/.bundle/config +0 -2
  12. data/spec/rails-3.0/.rspec +0 -2
  13. data/spec/rails-3.0/Gemfile +0 -10
  14. data/spec/rails-3.0/Gemfile.lock +0 -119
  15. data/spec/rails-3.0/Rakefile +0 -10
  16. data/spec/rails-3.0/app_root/.gitignore +0 -4
  17. data/spec/rails-3.0/app_root/config/application.rb +0 -32
  18. data/spec/rails-3.0/app_root/config/boot.rb +0 -13
  19. data/spec/rails-3.0/app_root/config/database.yml +0 -4
  20. data/spec/rails-3.0/app_root/config/environment.rb +0 -5
  21. data/spec/rails-3.0/app_root/config/environments/test.rb +0 -35
  22. data/spec/rails-3.0/app_root/config/initializers/backtrace_silencers.rb +0 -7
  23. data/spec/rails-3.0/app_root/config/initializers/inflections.rb +0 -10
  24. data/spec/rails-3.0/app_root/config/initializers/mime_types.rb +0 -5
  25. data/spec/rails-3.0/app_root/config/initializers/secret_token.rb +0 -7
  26. data/spec/rails-3.0/app_root/config/initializers/session_store.rb +0 -8
  27. data/spec/rails-3.0/app_root/config/routes.rb +0 -58
  28. data/spec/rails-3.0/app_root/lib/tasks/.gitkeep +0 -0
  29. data/spec/rails-3.0/app_root/log/.gitkeep +0 -0
  30. data/spec/rails-3.0/app_root/script/rails +0 -6
  31. data/spec/rails-3.0/rcov.opts +0 -2
  32. data/spec/rails-3.0/spec/spec_helper.rb +0 -25
data/.travis.yml CHANGED
@@ -1,9 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - "1.8.7"
4
- - "1.9.3"
5
4
  - "2.1.0"
6
- - ree
7
5
  services:
8
6
  - mysql
9
7
  script: rake travis:run
data/README.md CHANGED
@@ -5,7 +5,7 @@ assignable_values - Enums on vitamins [![Build Status](https://secure.travis-ci.
5
5
 
6
6
  We carefully enhanced the core enum functionality with small tweaks that are useful for web forms, internationalized applications and common authorization patterns.
7
7
 
8
- `assignable_values` is tested with Rails 2.3, 3.0, 3.2 and 4.1 on Ruby 1.8.7, 1.9.3 and 2.1.0.
8
+ `assignable_values` is tested with Rails 2.3, 3.2 and 4.1 on Ruby 1.8.7 and 2.1.0.
9
9
 
10
10
 
11
11
  Restricting scalar attributes
@@ -42,7 +42,9 @@ module AssignableValues
42
42
  end
43
43
 
44
44
  def assignable_value?(record, value)
45
- assignable_values(record).include?(value)
45
+ (has_previously_saved_value?(record) && value == previously_saved_value(record)) ||
46
+ (value.blank? && allow_blank?(record)) ||
47
+ assignable_values(record).include?(value)
46
48
  end
47
49
 
48
50
  def assignable_values(record, options = {})
@@ -52,7 +54,7 @@ module AssignableValues
52
54
 
53
55
  if options.fetch(:include_old_value, true) && has_previously_saved_value?(record)
54
56
  old_value = previously_saved_value(record)
55
- unless current_values.include?(old_value)
57
+ unless old_value.blank? || current_values.include?(old_value)
56
58
  assignable_values << old_value
57
59
  end
58
60
  end
@@ -27,11 +27,11 @@ module AssignableValues
27
27
  end
28
28
 
29
29
  def has_previously_saved_value?(record)
30
- !record.new_record? && record.respond_to?(value_was_method)
30
+ !record.new_record? && record.respond_to?(association_id_was_method)
31
31
  end
32
32
 
33
33
  def previously_saved_value(record)
34
- if old_id = record.send(value_was_method).presence
34
+ if old_id = record.send(association_id_was_method).presence
35
35
  if old_id == association_id(record)
36
36
  current_value(record) # no need to query the database if nothing changed
37
37
  else
@@ -48,7 +48,7 @@ module AssignableValues
48
48
 
49
49
  private
50
50
 
51
- def value_was_method
51
+ def association_id_was_method
52
52
  "#{association_id_method}_was"
53
53
  end
54
54
 
@@ -1,3 +1,3 @@
1
1
  module AssignableValues
2
- VERSION = '0.11.2'
2
+ VERSION = '0.11.3'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- assignable_values (0.11.1)
4
+ assignable_values (0.11.2)
5
5
  activerecord
6
6
 
7
7
  GEM
@@ -63,3 +63,6 @@ DEPENDENCIES
63
63
  ruby-debug
64
64
  sqlite3
65
65
  test-unit (= 1.2.3)
66
+
67
+ BUNDLED WITH
68
+ 1.12.5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- assignable_values (0.11.1)
4
+ assignable_values (0.11.2)
5
5
  activerecord
6
6
 
7
7
  GEM
@@ -127,3 +127,6 @@ DEPENDENCIES
127
127
  rspec_candy
128
128
  ruby-debug
129
129
  sqlite3
130
+
131
+ BUNDLED WITH
132
+ 1.12.5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- assignable_values (0.11.1)
4
+ assignable_values (0.11.2)
5
5
  activerecord
6
6
 
7
7
  GEM
@@ -141,3 +141,6 @@ DEPENDENCIES
141
141
  rspec_candy
142
142
  ruby-debug
143
143
  sqlite3
144
+
145
+ BUNDLED WITH
146
+ 1.12.5
@@ -552,7 +552,7 @@ describe AssignableValues::ActiveRecord do
552
552
  record.assignable_genres.should == %w[pop rock]
553
553
  end
554
554
 
555
- it 'should prepend a previously saved blank value to the top of the list, even if is no longer allowed' do
555
+ it "should not prepend a previously saved blank value to the top of the list (because our forms already have collection_select with include_blank: '<prompt>')" do
556
556
  klass = Song.disposable_copy do
557
557
  assignable_values_for :genre do
558
558
  %w[pop rock]
@@ -560,7 +560,7 @@ describe AssignableValues::ActiveRecord do
560
560
  end
561
561
  record = klass.create!(:genre => 'pop')
562
562
  klass.update_all(:genre => '') # update without validation for the sake of this test
563
- record.reload.assignable_genres.should == ['', 'pop', 'rock']
563
+ record.reload.assignable_genres.should == ['pop', 'rock']
564
564
  end
565
565
 
566
566
  it 'should not prepend nil to the top of the list if the record was never saved' do
@@ -599,6 +599,23 @@ describe AssignableValues::ActiveRecord do
599
599
  record.assignable_artists(:include_old_value => false).should =~ [allowed_association]
600
600
  end
601
601
 
602
+ context 'if the :allow_blank option is set to true' do
603
+
604
+ before :each do
605
+ @klass = Song.disposable_copy do
606
+ assignable_values_for :genre, :allow_blank => true do
607
+ %w[pop rock]
608
+ end
609
+ end
610
+ end
611
+
612
+ it "should not prepend nil to the list for an unsaved record (because we'd rather use include_blank: '<prompt>' in collection_select)" do
613
+ record = @klass.new
614
+ record.assignable_genres.should == ['pop', 'rock']
615
+ end
616
+
617
+ end
618
+
602
619
  context 'humanization' do
603
620
 
604
621
  it 'should define a method that return pairs of values and their humanization' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assignable_values
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 11
9
- - 2
10
- version: 0.11.2
9
+ - 3
10
+ version: 0.11.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henning Koch
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2015-09-24 00:00:00 +02:00
19
- default_executable:
18
+ date: 2016-11-11 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: activerecord
@@ -133,28 +132,6 @@ files:
133
132
  - spec/rails-2.3/rcov.opts
134
133
  - spec/rails-2.3/spec.opts
135
134
  - spec/rails-2.3/spec/spec_helper.rb
136
- - spec/rails-3.0/.bundle/config
137
- - spec/rails-3.0/.rspec
138
- - spec/rails-3.0/Gemfile
139
- - spec/rails-3.0/Gemfile.lock
140
- - spec/rails-3.0/Rakefile
141
- - spec/rails-3.0/app_root/.gitignore
142
- - spec/rails-3.0/app_root/config/application.rb
143
- - spec/rails-3.0/app_root/config/boot.rb
144
- - spec/rails-3.0/app_root/config/database.yml
145
- - spec/rails-3.0/app_root/config/environment.rb
146
- - spec/rails-3.0/app_root/config/environments/test.rb
147
- - spec/rails-3.0/app_root/config/initializers/backtrace_silencers.rb
148
- - spec/rails-3.0/app_root/config/initializers/inflections.rb
149
- - spec/rails-3.0/app_root/config/initializers/mime_types.rb
150
- - spec/rails-3.0/app_root/config/initializers/secret_token.rb
151
- - spec/rails-3.0/app_root/config/initializers/session_store.rb
152
- - spec/rails-3.0/app_root/config/routes.rb
153
- - spec/rails-3.0/app_root/lib/tasks/.gitkeep
154
- - spec/rails-3.0/app_root/log/.gitkeep
155
- - spec/rails-3.0/app_root/script/rails
156
- - spec/rails-3.0/rcov.opts
157
- - spec/rails-3.0/spec/spec_helper.rb
158
135
  - spec/rails-3.2/.bundle/config
159
136
  - spec/rails-3.2/.rspec
160
137
  - spec/rails-3.2/Gemfile
@@ -218,7 +195,6 @@ files:
218
195
  - spec/shared/app_root/db/migrate/003_create_recordings.rb
219
196
  - spec/shared/assignable_values/active_record_spec.rb
220
197
  - spec/shared/assignable_values/humanized_value_spec.rb
221
- has_rdoc: true
222
198
  homepage: https://github.com/makandra/assignable_values
223
199
  licenses:
224
200
  - MIT
@@ -248,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
224
  requirements: []
249
225
 
250
226
  rubyforge_project:
251
- rubygems_version: 1.3.9.5
227
+ rubygems_version: 1.8.29
252
228
  signing_key:
253
229
  specification_version: 3
254
230
  summary: Restrict the values assignable to ActiveRecord attributes or associations. Or enums on steroids.
@@ -269,28 +245,6 @@ test_files:
269
245
  - spec/rails-2.3/rcov.opts
270
246
  - spec/rails-2.3/spec.opts
271
247
  - spec/rails-2.3/spec/spec_helper.rb
272
- - spec/rails-3.0/.bundle/config
273
- - spec/rails-3.0/.rspec
274
- - spec/rails-3.0/Gemfile
275
- - spec/rails-3.0/Gemfile.lock
276
- - spec/rails-3.0/Rakefile
277
- - spec/rails-3.0/app_root/.gitignore
278
- - spec/rails-3.0/app_root/config/application.rb
279
- - spec/rails-3.0/app_root/config/boot.rb
280
- - spec/rails-3.0/app_root/config/database.yml
281
- - spec/rails-3.0/app_root/config/environment.rb
282
- - spec/rails-3.0/app_root/config/environments/test.rb
283
- - spec/rails-3.0/app_root/config/initializers/backtrace_silencers.rb
284
- - spec/rails-3.0/app_root/config/initializers/inflections.rb
285
- - spec/rails-3.0/app_root/config/initializers/mime_types.rb
286
- - spec/rails-3.0/app_root/config/initializers/secret_token.rb
287
- - spec/rails-3.0/app_root/config/initializers/session_store.rb
288
- - spec/rails-3.0/app_root/config/routes.rb
289
- - spec/rails-3.0/app_root/lib/tasks/.gitkeep
290
- - spec/rails-3.0/app_root/log/.gitkeep
291
- - spec/rails-3.0/app_root/script/rails
292
- - spec/rails-3.0/rcov.opts
293
- - spec/rails-3.0/spec/spec_helper.rb
294
248
  - spec/rails-3.2/.bundle/config
295
249
  - spec/rails-3.2/.rspec
296
250
  - spec/rails-3.2/Gemfile
@@ -354,3 +308,4 @@ test_files:
354
308
  - spec/shared/app_root/db/migrate/003_create_recordings.rb
355
309
  - spec/shared/assignable_values/active_record_spec.rb
356
310
  - spec/shared/assignable_values/humanized_value_spec.rb
311
+ has_rdoc:
@@ -1,2 +0,0 @@
1
- ---
2
- BUNDLE_WITHOUT: development
@@ -1,2 +0,0 @@
1
- --colour
2
- --format progress
@@ -1,10 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'sqlite3'
4
- gem 'rails', '~>3.0.3'
5
- gem 'rspec'
6
- gem 'rspec-rails'
7
- gem 'ruby-debug', :platforms => :ruby_18
8
- gem 'rspec_candy'
9
- gem 'assignable_values', :path => '../..'
10
-
@@ -1,119 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- assignable_values (0.11.1)
5
- activerecord
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- abstract (1.0.0)
11
- actionmailer (3.0.20)
12
- actionpack (= 3.0.20)
13
- mail (~> 2.2.19)
14
- actionpack (3.0.20)
15
- activemodel (= 3.0.20)
16
- activesupport (= 3.0.20)
17
- builder (~> 2.1.2)
18
- erubis (~> 2.6.6)
19
- i18n (~> 0.5.0)
20
- rack (~> 1.2.5)
21
- rack-mount (~> 0.6.14)
22
- rack-test (~> 0.5.7)
23
- tzinfo (~> 0.3.23)
24
- activemodel (3.0.20)
25
- activesupport (= 3.0.20)
26
- builder (~> 2.1.2)
27
- i18n (~> 0.5.0)
28
- activerecord (3.0.20)
29
- activemodel (= 3.0.20)
30
- activesupport (= 3.0.20)
31
- arel (~> 2.0.10)
32
- tzinfo (~> 0.3.23)
33
- activeresource (3.0.20)
34
- activemodel (= 3.0.20)
35
- activesupport (= 3.0.20)
36
- activesupport (3.0.20)
37
- arel (2.0.10)
38
- builder (2.1.2)
39
- columnize (0.3.6)
40
- diff-lcs (1.2.1)
41
- erubis (2.6.6)
42
- abstract (>= 1.0.0)
43
- i18n (0.5.0)
44
- json (1.7.7)
45
- linecache (0.46)
46
- rbx-require-relative (> 0.0.4)
47
- mail (2.2.19)
48
- activesupport (>= 2.3.6)
49
- i18n (>= 0.4.0)
50
- mime-types (~> 1.16)
51
- treetop (~> 1.4.8)
52
- mime-types (1.21)
53
- polyglot (0.3.3)
54
- rack (1.2.8)
55
- rack-mount (0.6.14)
56
- rack (>= 1.0.0)
57
- rack-test (0.5.7)
58
- rack (>= 1.0)
59
- rails (3.0.20)
60
- actionmailer (= 3.0.20)
61
- actionpack (= 3.0.20)
62
- activerecord (= 3.0.20)
63
- activeresource (= 3.0.20)
64
- activesupport (= 3.0.20)
65
- bundler (~> 1.0)
66
- railties (= 3.0.20)
67
- railties (3.0.20)
68
- actionpack (= 3.0.20)
69
- activesupport (= 3.0.20)
70
- rake (>= 0.8.7)
71
- rdoc (~> 3.4)
72
- thor (~> 0.14.4)
73
- rake (10.0.3)
74
- rbx-require-relative (0.0.9)
75
- rdoc (3.12.2)
76
- json (~> 1.4)
77
- rspec (2.13.0)
78
- rspec-core (~> 2.13.0)
79
- rspec-expectations (~> 2.13.0)
80
- rspec-mocks (~> 2.13.0)
81
- rspec-core (2.13.0)
82
- rspec-expectations (2.13.0)
83
- diff-lcs (>= 1.1.3, < 2.0)
84
- rspec-mocks (2.13.0)
85
- rspec-rails (2.13.0)
86
- actionpack (>= 3.0)
87
- activesupport (>= 3.0)
88
- railties (>= 3.0)
89
- rspec-core (~> 2.13.0)
90
- rspec-expectations (~> 2.13.0)
91
- rspec-mocks (~> 2.13.0)
92
- rspec_candy (0.2.8)
93
- rspec
94
- sneaky-save
95
- ruby-debug (0.10.4)
96
- columnize (>= 0.1)
97
- ruby-debug-base (~> 0.10.4.0)
98
- ruby-debug-base (0.10.4)
99
- linecache (>= 0.3)
100
- sneaky-save (0.0.2)
101
- activerecord (>= 2.3.2)
102
- sqlite3 (1.3.7)
103
- thor (0.14.6)
104
- treetop (1.4.12)
105
- polyglot
106
- polyglot (>= 0.3.1)
107
- tzinfo (0.3.35)
108
-
109
- PLATFORMS
110
- ruby
111
-
112
- DEPENDENCIES
113
- assignable_values!
114
- rails (~> 3.0.3)
115
- rspec
116
- rspec-rails
117
- rspec_candy
118
- ruby-debug
119
- 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 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
@@ -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
@@ -1,5 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application
5
- SpecApp::Application.initialize!
@@ -1,35 +0,0 @@
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
@@ -1,7 +0,0 @@
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!
@@ -1,10 +0,0 @@
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
@@ -1,5 +0,0 @@
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
@@ -1,7 +0,0 @@
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'
@@ -1,8 +0,0 @@
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
@@ -1,58 +0,0 @@
1
- SpecApp::Application.routes.draw do
2
- # The priority is based upon order of creation:
3
- # first created -> highest priority.
4
-
5
- # Sample of regular route:
6
- # match 'products/:id' => 'catalog#view'
7
- # Keep in mind you can assign values other than :controller and :action
8
-
9
- # Sample of named route:
10
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
- # This route can be invoked with purchase_url(:id => product.id)
12
-
13
- # Sample resource route (maps HTTP verbs to controller actions automatically):
14
- # resources :products
15
-
16
- # Sample resource route with options:
17
- # resources :products do
18
- # member do
19
- # get 'short'
20
- # post 'toggle'
21
- # end
22
- #
23
- # collection do
24
- # get 'sold'
25
- # end
26
- # end
27
-
28
- # Sample resource route with sub-resources:
29
- # resources :products do
30
- # resources :comments, :sales
31
- # resource :seller
32
- # end
33
-
34
- # Sample resource route with more complex sub-resources
35
- # resources :products do
36
- # resources :comments
37
- # resources :sales do
38
- # get 'recent', :on => :collection
39
- # end
40
- # end
41
-
42
- # Sample resource route within a namespace:
43
- # namespace :admin do
44
- # # Directs /admin/products/* to Admin::ProductsController
45
- # # (app/controllers/admin/products_controller.rb)
46
- # resources :products
47
- # end
48
-
49
- # You can have the root of your site routed with "root"
50
- # just remember to delete public/index.html.
51
- # root :to => "welcome#index"
52
-
53
- # See how all your routes lay out with "rake routes"
54
-
55
- # This is a legacy wild controller route that's not recommended for RESTful applications.
56
- # Note: This route will make all actions in every controller accessible via GET requests.
57
- match ':controller(/:action(/:id(.:format)))'
58
- end
File without changes
File without changes
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby1.8
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
@@ -1,2 +0,0 @@
1
- --exclude "spec/*,gems/*"
2
- --rails
@@ -1,25 +0,0 @@
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 'rspec_candy/all'
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