enju_message 0.1.16 → 0.2.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -3
  3. data/app/controllers/message_requests_controller.rb +13 -3
  4. data/app/controllers/message_templates_controller.rb +12 -1
  5. data/app/controllers/messages_controller.rb +17 -6
  6. data/app/models/concerns/enju_message/enju_user.rb +21 -0
  7. data/app/models/message.rb +1 -1
  8. data/app/models/message_template.rb +0 -1
  9. data/app/policies/message_policy.rb +37 -0
  10. data/app/policies/message_request_policy.rb +21 -0
  11. data/app/policies/message_template_policy.rb +21 -0
  12. data/app/views/message_requests/show.html.erb +1 -1
  13. data/app/views/message_templates/index.html.erb +4 -4
  14. data/app/views/message_templates/show.html.erb +2 -2
  15. data/app/views/messages/index.html.erb +2 -2
  16. data/app/views/messages/show.html.erb +2 -2
  17. data/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
  18. data/lib/enju_message/engine.rb +0 -1
  19. data/lib/enju_message/version.rb +1 -1
  20. data/lib/enju_message.rb +0 -3
  21. data/lib/generators/enju_message/setup/setup_generator.rb +3 -2
  22. data/lib/tasks/enju_message_tasks.rake +1 -1
  23. data/spec/controllers/message_requests_controller_spec.rb +2 -2
  24. data/spec/controllers/message_templates_controller_spec.rb +14 -14
  25. data/spec/controllers/messages_controller_spec.rb +57 -33
  26. data/spec/dummy/app/controllers/application_controller.rb +6 -2
  27. data/spec/dummy/app/models/user.rb +2 -2
  28. data/spec/dummy/config/application.rb +6 -24
  29. data/spec/dummy/config/environments/development.rb +25 -14
  30. data/spec/dummy/config/environments/production.rb +50 -31
  31. data/spec/dummy/config/environments/test.rb +21 -18
  32. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
  33. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +13 -0
  34. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
  35. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
  36. data/spec/dummy/db/schema.rb +37 -2
  37. data/spec/support/devise.rb +2 -2
  38. metadata +83 -34
  39. data/app/models/enju_message/ability.rb +0 -33
  40. data/lib/enju_message/user.rb +0 -28
  41. data/spec/dummy/config/application.yml +0 -38
  42. data/spec/dummy/config/initializers/resque_mailer.rb +0 -1
@@ -150,7 +150,7 @@ describe MessagesController do
150
150
 
151
151
  it "should not assign the requested message as @message" do
152
152
  get :new
153
- assigns(:message).should_not be_valid
153
+ assigns(:message).should be_nil
154
154
  response.should be_forbidden
155
155
  end
156
156
 
@@ -173,7 +173,7 @@ describe MessagesController do
173
173
  describe "When not logged in" do
174
174
  it "should not assign the requested message as @message" do
175
175
  get :new
176
- assigns(:message).should_not be_valid
176
+ assigns(:message).should be_nil
177
177
  response.should redirect_to(new_user_session_url)
178
178
  end
179
179
  end
@@ -188,8 +188,8 @@ describe MessagesController do
188
188
  lambda{
189
189
  get :edit, :id => message.id
190
190
  }.should raise_error(ActiveRecord::RecordNotFound)
191
- assigns(:message).should eq(message)
192
- #response.should be_missing
191
+ assigns(:message).should be_nil
192
+ response.should be_success
193
193
  end
194
194
  end
195
195
 
@@ -198,9 +198,11 @@ describe MessagesController do
198
198
 
199
199
  it "assigns the requested message as @message" do
200
200
  message = messages(:user1_to_user2_1)
201
- get :edit, :id => message.id
202
- assigns(:message).should eq(message)
203
- response.should be_forbidden
201
+ lambda{
202
+ get :edit, :id => message.id
203
+ }.should raise_error(ActiveRecord::RecordNotFound)
204
+ assigns(:message).should be_nil
205
+ response.should be_success
204
206
  end
205
207
  end
206
208
 
@@ -209,9 +211,11 @@ describe MessagesController do
209
211
 
210
212
  it "assigns the requested message as @message" do
211
213
  message = messages(:user1_to_user2_1)
212
- get :edit, :id => message.id
213
- assigns(:message).should eq(message)
214
- response.should be_forbidden
214
+ lambda{
215
+ get :edit, :id => message.id
216
+ }.should raise_error(ActiveRecord::RecordNotFound)
217
+ assigns(:message).should be_nil
218
+ response.should be_success
215
219
  end
216
220
  end
217
221
 
@@ -219,7 +223,7 @@ describe MessagesController do
219
223
  it "assigns the requested message as @message" do
220
224
  message = FactoryGirl.create(:message)
221
225
  get :edit, :id => message.id
222
- assigns(:message).should eq(message)
226
+ assigns(:message).should be_nil
223
227
  response.should redirect_to new_user_session_url
224
228
  end
225
229
  end
@@ -307,7 +311,7 @@ describe MessagesController do
307
311
  describe "with valid params" do
308
312
  it "assigns a newly created message as @message" do
309
313
  post :create, :message => @attrs
310
- assigns(:message).should be_valid
314
+ assigns(:message).should be_nil
311
315
  end
312
316
 
313
317
  it "should redirect to new_user_session_url" do
@@ -319,7 +323,7 @@ describe MessagesController do
319
323
  describe "with invalid params" do
320
324
  it "assigns a newly created but unsaved message as @message" do
321
325
  post :create, :message => @invalid_attrs
322
- assigns(:message).should_not be_valid
326
+ assigns(:message).should be_nil
323
327
  end
324
328
 
325
329
  it "should redirect to new_user_session_url" do
@@ -351,7 +355,7 @@ describe MessagesController do
351
355
  lambda{
352
356
  put :update, :id => @message.id, :message => @attrs
353
357
  }.should raise_error(ActiveRecord::RecordNotFound)
354
- assigns(:message).should eq(@message)
358
+ assigns(:message).should be_nil
355
359
  #response.should be_missing
356
360
  end
357
361
  end
@@ -367,7 +371,7 @@ describe MessagesController do
367
371
  lambda{
368
372
  put :update, :id => @message.id, :message => @invalid_attrs
369
373
  }.should raise_error(ActiveRecord::RecordNotFound)
370
- #response.should be_missing
374
+ response.should be_success
371
375
  end
372
376
  end
373
377
  end
@@ -377,24 +381,32 @@ describe MessagesController do
377
381
 
378
382
  describe "with valid params" do
379
383
  it "updates the requested message" do
380
- put :update, :id => @message.id, :message => @attrs
384
+ lambda{
385
+ put :update, :id => @message.id, :message => @attrs
386
+ }.should raise_error(ActiveRecord::RecordNotFound)
381
387
  end
382
388
 
383
389
  it "assigns the requested message as @message" do
384
- put :update, :id => @message.id, :message => @attrs
385
- assigns(:message).should eq(@message)
386
- response.should be_forbidden
390
+ lambda{
391
+ put :update, :id => @message.id, :message => @attrs
392
+ }.should raise_error(ActiveRecord::RecordNotFound)
393
+ assigns(:message).should be_nil
394
+ response.should be_success
387
395
  end
388
396
  end
389
397
 
390
398
  describe "with invalid params" do
391
399
  it "assigns the requested message as @message" do
392
- put :update, :id => @message.id, :message => @invalid_attrs
400
+ lambda{
401
+ put :update, :id => @message.id, :message => @invalid_attrs
402
+ }.should raise_error(ActiveRecord::RecordNotFound)
393
403
  end
394
404
 
395
405
  it "re-renders the 'edit' template" do
396
- put :update, :id => @message.id, :message => @invalid_attrs
397
- response.should be_forbidden
406
+ lambda{
407
+ put :update, :id => @message.id, :message => @invalid_attrs
408
+ }.should raise_error(ActiveRecord::RecordNotFound)
409
+ response.should be_success
398
410
  end
399
411
  end
400
412
  end
@@ -404,24 +416,32 @@ describe MessagesController do
404
416
 
405
417
  describe "with valid params" do
406
418
  it "updates the requested message" do
407
- put :update, :id => @message.id, :message => @attrs
419
+ lambda{
420
+ put :update, :id => @message.id, :message => @attrs
421
+ }.should raise_error(ActiveRecord::RecordNotFound)
408
422
  end
409
423
 
410
424
  it "assigns the requested message as @message" do
411
- put :update, :id => @message.id, :message => @attrs
412
- assigns(:message).should eq(@message)
413
- response.should be_forbidden
425
+ lambda{
426
+ put :update, :id => @message.id, :message => @attrs
427
+ }.should raise_error(ActiveRecord::RecordNotFound)
428
+ assigns(:message).should be_nil
429
+ response.should be_success
414
430
  end
415
431
  end
416
432
 
417
433
  describe "with invalid params" do
418
434
  it "assigns the requested message as @message" do
419
- put :update, :id => @message.id, :message => @invalid_attrs
435
+ lambda{
436
+ put :update, :id => @message.id, :message => @invalid_attrs
437
+ }.should raise_error(ActiveRecord::RecordNotFound)
420
438
  end
421
439
 
422
440
  it "re-renders the 'edit' template" do
423
- put :update, :id => @message.id, :message => @invalid_attrs
424
- response.should be_forbidden
441
+ lambda{
442
+ put :update, :id => @message.id, :message => @invalid_attrs
443
+ }.should raise_error(ActiveRecord::RecordNotFound)
444
+ response.should be_success
425
445
  end
426
446
  end
427
447
 
@@ -431,8 +451,10 @@ describe MessagesController do
431
451
  end
432
452
 
433
453
  it "should not update other user's message" do
434
- put :update, :id => 1, :message => { }
435
- response.should be_forbidden
454
+ lambda{
455
+ put :update, :id => 1, :message => { }
456
+ }.should raise_error(ActiveRecord::RecordNotFound)
457
+ response.should be_success
436
458
  end
437
459
  end
438
460
 
@@ -464,8 +486,10 @@ describe MessagesController do
464
486
  end
465
487
 
466
488
  it "should not destroy other user's message" do
467
- delete :destroy, :id => 1
468
- response.should be_forbidden
489
+ lambda {
490
+ delete :destroy, :id => 1
491
+ }.should raise_error(ActiveRecord::RecordNotFound)
492
+ response.should be_success
469
493
  end
470
494
  end
471
495
 
@@ -1,6 +1,10 @@
1
1
  class ApplicationController < ActionController::Base
2
2
  protect_from_forgery
3
3
 
4
- enju_leaf
5
- enju_library
4
+ include EnjuLeaf::Controller
5
+ include EnjuLibrary::Controller
6
+ before_action :set_paper_trail_whodunnit
7
+ after_action :verify_authorized
8
+
9
+ include Pundit
6
10
  end
@@ -6,6 +6,6 @@ class User < ActiveRecord::Base
6
6
  :lockable, :lock_strategy => :none, :unlock_strategy => :none
7
7
 
8
8
  # Setup accessible (or protected) attributes for your model
9
- enju_leaf_user_model
10
- enju_message_user_model
9
+ include EnjuLeaf::EnjuUser
10
+ include EnjuMessage::EnjuUser
11
11
  end
@@ -2,8 +2,10 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require 'rails/all'
4
4
 
5
- Bundler.require
6
- require "enju_message"
5
+ Bundler.require(*Rails.groups)
6
+ require 'enju_message'
7
+ require 'enju_leaf'
8
+ require 'resque_mailer'
7
9
 
8
10
  module Dummy
9
11
  class Application < Rails::Application
@@ -11,16 +13,6 @@ module Dummy
11
13
  # Application configuration should go into files in config/initializers
12
14
  # -- all .rb files in that directory are automatically loaded.
13
15
 
14
- # Custom directories with classes and modules you want to be autoloadable.
15
- # config.autoload_paths += %W(#{config.root}/extras)
16
-
17
- # Only load the plugins named here, in the order given (default is alphabetical).
18
- # :all can be used as a placeholder for all plugins not explicitly named.
19
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20
-
21
- # Activate observers that should always be running.
22
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23
-
24
16
  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
17
  # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
18
  # config.time_zone = 'Central Time (US & Canada)'
@@ -29,18 +21,8 @@ module Dummy
29
21
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
22
  # config.i18n.default_locale = :de
31
23
 
32
- # Configure the default encoding used in templates for Ruby 1.9.
33
- config.encoding = "utf-8"
34
-
35
- # Configure sensitive parameters which will be filtered from the log file.
36
- config.filter_parameters += [:password]
37
-
38
- # Enable the asset pipeline
39
- config.assets.enabled = true
40
-
41
- # Version of your assets, change this if you want to expire all your assets
42
- config.assets.version = '1.0'
24
+ # Do not swallow errors in after_commit/after_rollback callbacks.
25
+ config.active_record.raise_in_transactional_callbacks = true
43
26
  end
44
27
  end
45
28
 
46
- require 'enju_leaf'
@@ -1,30 +1,41 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
5
+ # every request. This slows down response time but is perfect for development
6
6
  # since you don't have to restart the web server when you make code changes.
7
7
  config.cache_classes = false
8
8
 
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
11
 
12
- # Show full error reports and disable caching
12
+ # Show full error reports and disable caching.
13
13
  config.consider_all_requests_local = true
14
14
  config.action_controller.perform_caching = false
15
15
 
16
- # Don't care if the mailer can't send
16
+ # Don't care if the mailer can't send.
17
17
  config.action_mailer.raise_delivery_errors = false
18
18
 
19
- # Print deprecation notices to the Rails logger
19
+ # Print deprecation notices to the Rails logger.
20
20
  config.active_support.deprecation = :log
21
21
 
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
22
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
24
 
25
- # Do not compress assets
26
- config.assets.compress = false
27
-
28
- # Expands the lines which load the assets
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
29
28
  config.assets.debug = true
29
+
30
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
+ # yet still be able to expire them through the digest params.
32
+ config.assets.digest = true
33
+
34
+ # Adds additional error checking when serving assets at runtime.
35
+ # Checks for improperly declared sprockets dependencies.
36
+ # Raises helpful error messages.
37
+ config.assets.raise_runtime_errors = true
38
+
39
+ # Raises error for missing translations
40
+ # config.action_view.raise_on_missing_translations = true
30
41
  end
@@ -1,60 +1,79 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
- # Code is not reloaded between requests
4
+ # Code is not reloaded between requests.
5
5
  config.cache_classes = true
6
6
 
7
- # Full error reports are disabled and caching is turned on
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both threaded web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
8
14
  config.consider_all_requests_local = false
9
15
  config.action_controller.perform_caching = true
10
16
 
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
21
+ # config.action_dispatch.rack_cache = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
13
26
 
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
16
30
 
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
18
32
  config.assets.compile = false
19
33
 
20
- # Generate digests for assets URLs
34
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
+ # yet still be able to expire them through the digest params.
21
36
  config.assets.digest = true
22
37
 
23
- # Defaults to Rails.root.join("public/assets")
24
- # config.assets.manifest = YOUR_PATH
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
25
39
 
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
40
+ # Specifies the header that your server uses for sending files.
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
29
43
 
30
44
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
45
  # config.force_ssl = true
32
46
 
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
35
50
 
36
- # Use a different logger for distributed setups
37
- # config.logger = SyslogLogger.new
51
+ # Prepend all log lines with the following tags.
52
+ # config.log_tags = [ :subdomain, :uuid ]
38
53
 
39
- # Use a different cache store in production
40
- # config.cache_store = :mem_cache_store
54
+ # Use a different logger for distributed setups.
55
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
56
 
42
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
43
- # config.action_controller.asset_host = "http://assets.example.com"
57
+ # Use a different cache store in production.
58
+ # config.cache_store = :mem_cache_store
44
59
 
45
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
46
- # config.assets.precompile += %w( search.js )
60
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
+ # config.action_controller.asset_host = 'http://assets.example.com'
47
62
 
48
- # Disable delivery errors, bad email addresses will be ignored
63
+ # Ignore bad email addresses and do not raise email delivery errors.
64
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
49
65
  # config.action_mailer.raise_delivery_errors = false
50
66
 
51
- # Enable threaded mode
52
- # config.threadsafe!
53
-
54
67
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
55
- # the I18n.default_locale when a translation can not be found)
68
+ # the I18n.default_locale when a translation cannot be found).
56
69
  config.i18n.fallbacks = true
57
70
 
58
- # Send deprecation notices to registered listeners
71
+ # Send deprecation notices to registered listeners.
59
72
  config.active_support.deprecation = :notify
73
+
74
+ # Use default logging formatter so that PID and timestamp are not suppressed.
75
+ config.log_formatter = ::Logger::Formatter.new
76
+
77
+ # Do not dump schema after migrations.
78
+ config.active_record.dump_schema_after_migration = false
60
79
  end
@@ -1,41 +1,44 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
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
5
+ # test suite. You never need to work with it otherwise. Remember that
6
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!
7
+ # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
- # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
13
14
 
14
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
16
18
 
17
- # Show full error reports and disable caching
19
+ # Show full error reports and disable caching.
18
20
  config.consider_all_requests_local = true
19
21
  config.action_controller.perform_caching = false
20
22
 
21
- # Raise exceptions instead of rendering exception templates
23
+ # Raise exceptions instead of rendering exception templates.
22
24
  config.action_dispatch.show_exceptions = false
23
25
 
24
- # Disable request forgery protection in test environment
25
- config.action_controller.allow_forgery_protection = false
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
26
28
 
27
29
  # Tell Action Mailer not to deliver emails to the real world.
28
30
  # The :test delivery method accumulates sent emails in the
29
31
  # ActionMailer::Base.deliveries array.
30
32
  config.action_mailer.delivery_method = :test
31
33
 
32
- # Use SQL instead of Active Record's schema dumper when creating the test database.
33
- # This is necessary if your schema can't be completely dumped by the schema dumper,
34
- # like if you have constraints or database-specific column types
35
- # config.active_record.schema_format = :sql
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
36
 
37
- # Print deprecation notices to the stderr
37
+ # Print deprecation notices to the stderr.
38
38
  config.active_support.deprecation = :stderr
39
39
 
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+
40
43
  config.action_mailer.default_url_options = {:host => 'localhost:3000'}
41
44
  end
@@ -0,0 +1,14 @@
1
+ class CreateColors < ActiveRecord::Migration
2
+ def change
3
+ create_table :colors do |t|
4
+ t.integer :library_group_id
5
+ t.string :property
6
+ t.string :code
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+
12
+ add_index :colors, :library_group_id
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ class CreateWithdraws < ActiveRecord::Migration
2
+ def change
3
+ create_table :withdraws do |t|
4
+ t.integer :basket_id
5
+ t.integer :item_id
6
+ t.integer :librarian_id
7
+
8
+ t.timestamps null: false
9
+ end
10
+ add_index :withdraws, :basket_id
11
+ add_index :withdraws, :item_id
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ class AddTranslationTableToLibraryGroup < ActiveRecord::Migration
2
+ def up
3
+ LibraryGroup.create_translation_table!({
4
+ login_banner: :text
5
+ }, {
6
+ migrate_data: true
7
+ })
8
+ end
9
+
10
+ def down
11
+ LibraryGroup.drop_translation_table! migrate_data: true
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ class AddFooterBannerToLibraryGroup < ActiveRecord::Migration
2
+ def up
3
+ LibraryGroup.add_translation_fields! footer_banner: :text
4
+ end
5
+
6
+ def down
7
+ remove_column :library_group_translations, :footer_banner
8
+ end
9
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20150221063719) do
14
+ ActiveRecord::Schema.define(version: 20160703185015) do
15
15
 
16
16
  create_table "accepts", force: :cascade do |t|
17
17
  t.integer "basket_id"
@@ -208,6 +208,17 @@ ActiveRecord::Schema.define(version: 20150221063719) do
208
208
  t.datetime "updated_at"
209
209
  end
210
210
 
211
+ create_table "colors", force: :cascade do |t|
212
+ t.integer "library_group_id"
213
+ t.string "property"
214
+ t.string "code"
215
+ t.integer "position"
216
+ t.datetime "created_at"
217
+ t.datetime "updated_at"
218
+ end
219
+
220
+ add_index "colors", ["library_group_id"], name: "index_colors_on_library_group_id"
221
+
211
222
  create_table "content_types", force: :cascade do |t|
212
223
  t.string "name", null: false
213
224
  t.text "display_name"
@@ -423,6 +434,18 @@ ActiveRecord::Schema.define(version: 20150221063719) do
423
434
  add_index "libraries", ["library_group_id"], name: "index_libraries_on_library_group_id"
424
435
  add_index "libraries", ["name"], name: "index_libraries_on_name", unique: true
425
436
 
437
+ create_table "library_group_translations", force: :cascade do |t|
438
+ t.integer "library_group_id", null: false
439
+ t.string "locale", null: false
440
+ t.datetime "created_at", null: false
441
+ t.datetime "updated_at", null: false
442
+ t.text "login_banner"
443
+ t.text "footer_banner"
444
+ end
445
+
446
+ add_index "library_group_translations", ["library_group_id"], name: "index_library_group_translations_on_library_group_id"
447
+ add_index "library_group_translations", ["locale"], name: "index_library_group_translations_on_locale"
448
+
426
449
  create_table "library_groups", force: :cascade do |t|
427
450
  t.string "name", null: false
428
451
  t.text "display_name"
@@ -584,11 +607,12 @@ ActiveRecord::Schema.define(version: 20150221063719) do
584
607
 
585
608
  create_table "message_transitions", force: :cascade do |t|
586
609
  t.string "to_state"
587
- t.text "metadata", default: "{}"
610
+ t.text "metadata", default: "{}"
588
611
  t.integer "sort_key"
589
612
  t.integer "message_id"
590
613
  t.datetime "created_at"
591
614
  t.datetime "updated_at"
615
+ t.boolean "most_recent"
592
616
  end
593
617
 
594
618
  add_index "message_transitions", ["message_id"], name: "index_message_transitions_on_message_id"
@@ -1023,4 +1047,15 @@ ActiveRecord::Schema.define(version: 20150221063719) do
1023
1047
 
1024
1048
  add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
1025
1049
 
1050
+ create_table "withdraws", force: :cascade do |t|
1051
+ t.integer "basket_id"
1052
+ t.integer "item_id"
1053
+ t.integer "librarian_id"
1054
+ t.datetime "created_at", null: false
1055
+ t.datetime "updated_at", null: false
1056
+ end
1057
+
1058
+ add_index "withdraws", ["basket_id"], name: "index_withdraws_on_basket_id"
1059
+ add_index "withdraws", ["item_id"], name: "index_withdraws_on_item_id"
1060
+
1026
1061
  end
@@ -1,4 +1,4 @@
1
1
  RSpec.configure do |config|
2
- config.include Devise::TestHelpers, :type => :controller
3
- config.include Devise::TestHelpers, :type => :view
2
+ config.include Devise::Test::ControllerHelpers, type: :controller
3
+ config.include Devise::Test::ControllerHelpers, type: :view
4
4
  end