enju_inter_library_loan 0.1.1 → 0.2.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -3
  3. data/app/controllers/inter_library_loans_controller.rb +13 -3
  4. data/app/models/inter_library_loan_transition.rb +1 -0
  5. data/app/policies/inter_library_loan_policy.rb +21 -0
  6. data/app/views/inter_library_loans/index.html.erb +9 -5
  7. data/db/migrate/20160703190932_add_most_recent_to_inter_library_loan_transitions.rb +9 -0
  8. data/lib/enju_inter_library_loan/engine.rb +1 -1
  9. data/lib/enju_inter_library_loan/version.rb +1 -1
  10. data/spec/controllers/inter_library_loans_controller_spec.rb +5 -5
  11. data/spec/dummy/app/controllers/application_controller.rb +4 -3
  12. data/spec/dummy/app/models/user.rb +3 -3
  13. data/spec/dummy/config/application.rb +8 -25
  14. data/spec/dummy/config/environments/development.rb +25 -14
  15. data/spec/dummy/config/environments/production.rb +50 -31
  16. data/spec/dummy/config/environments/test.rb +23 -18
  17. data/spec/dummy/db/migrate/149_create_message_templates.rb +18 -0
  18. data/spec/dummy/db/migrate/154_create_messages.rb +23 -0
  19. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +18 -0
  20. data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +11 -0
  21. data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +6 -0
  22. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +1 -1
  23. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +18 -0
  24. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +18 -0
  25. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
  26. data/spec/dummy/db/migrate/20150124152756_add_foreign_key_to_shelves_referencing_libraries.rb +6 -0
  27. data/spec/dummy/db/migrate/20150506105356_add_error_message_to_user_import_result.rb +5 -0
  28. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +13 -0
  29. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
  30. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
  31. data/spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb +5 -0
  32. data/spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +9 -0
  33. data/spec/dummy/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +9 -0
  34. data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
  35. data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +5 -0
  36. data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +5 -0
  37. data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +5 -0
  38. data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +5 -0
  39. data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
  40. data/spec/dummy/db/schema.rb +118 -5
  41. data/spec/dummy/db/test.sqlite3 +0 -0
  42. data/spec/fixtures/inter_library_loan_transitions.yml +1 -0
  43. data/spec/fixtures/library_groups.yml +1 -6
  44. data/spec/fixtures/shelves.yml +46 -0
  45. data/spec/models/inter_library_loan_spec.rb +1 -1
  46. data/spec/rails_helper.rb +53 -0
  47. data/spec/spec_helper.rb +82 -43
  48. metadata +297 -220
  49. data/app/models/enju_inter_library_loan/ability.rb +0 -14
  50. data/spec/dummy/app/models/ability.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2bcac6011293de59a9d4a656971187377ed76ff
4
- data.tar.gz: e6650ad9133144185ad4b185a212a32156498df5
3
+ metadata.gz: 898e7475ac7f7f654e572612a849329e6acc4a61
4
+ data.tar.gz: e3143faec0387d62e08bc875bdc8daa9259c3b0b
5
5
  SHA512:
6
- metadata.gz: 7d9828182b90a77de5bd233b7d53f302730e6807be51edc72dcb1a2c7fca0561593482100f09c6c2795c2b395feaa25de55fec94a155c008650803bab744de6e
7
- data.tar.gz: d8e17a2f85c9cebe9ed9d42ff6bdee8c14ca15cbf6578e8ac71b99f5fd3e428575d9bb7a8122ac029238a5c932108e3390739c09381b7cf5968188edfdf5e7b0
6
+ metadata.gz: 4287306f7f701305a6d95bf5553dff358156ee2c9eeba20da315fde38c0bd061a99da73778485d4a8536556a490fc0ddee0bd32a12e8511add1b8d2d2738a7a8
7
+ data.tar.gz: c53a4a69eb02d18ae1f9a1ac5fcc4b362f0378887b776c3788bc2aede93840ad55eef74901b91f308c36454d19b6e025780f061ee2cee3be38c83dbe1cbb546d
data/README.rdoc CHANGED
@@ -1,7 +1,7 @@
1
1
  = EnjuInterLibraryLoan
2
- {<img src="https://secure.travis-ci.org/next-l/enju_inter_library_loan.svg?branch=1.1" alt="Build Status" />}[http://travis-ci.org/next-l/enju_inter_library_loan]
3
- {<img src="https://coveralls.io/repos/next-l/enju_inter_library_loan/badge.svg?branch=1.1&service=github" alt="Coverage Status" />}[https://coveralls.io/github/next-l/enju_inter_library_loan?branch=1.1]
4
- {<img src="https://hakiri.io/github/next-l/enju_inter_library_loan/1.1.svg" alt="security" />}[https://hakiri.io/github/next-l/enju_inter_library_loan/1.1]
2
+ {<img src="https://travis-ci.org/next-l/enju_inter_library_loan.svg?branch=1.2" alt="Build Status" />}[https://travis-ci.org/next-l/enju_inter_library_loan]
3
+ {<img src="https://coveralls.io/repos/next-l/enju_inter_library_loan/badge.svg?branch=1.2&service=github" alt="Coverage Status" />}[https://coveralls.io/github/next-l/enju_inter_library_loan?branch=1.2]
4
+ {<img src="https://hakiri.io/github/next-l/enju_inter_library_loan/1.2.svg" alt="security" />}[https://hakiri.io/github/next-l/enju_inter_library_loan/1.2]
5
5
 
6
6
  This project rocks and uses MIT-LICENSE.
7
7
 
@@ -1,7 +1,8 @@
1
1
  class InterLibraryLoansController < ApplicationController
2
- load_and_authorize_resource
3
- before_filter :get_item
4
- before_filter :store_page, :only => :index
2
+ before_action :store_page, only: :index
3
+ before_action :set_inter_library_loan, only: [:show, :edit, :update, :destroy]
4
+ before_action :check_policy, only: [:index, :new, :create]
5
+ before_action :get_item
5
6
 
6
7
  # GET /inter_library_loans
7
8
  # GET /inter_library_loans.json
@@ -120,6 +121,15 @@ class InterLibraryLoansController < ApplicationController
120
121
  end
121
122
 
122
123
  private
124
+ def set_inter_library_loan
125
+ @inter_library_loan = InterLibraryLoan.find(params[:id])
126
+ authorize @inter_library_loan
127
+ end
128
+
129
+ def check_policy
130
+ authorize InterLibraryLoan
131
+ end
132
+
123
133
  def inter_library_loan_params
124
134
  params.require(:inter_library_loan).permit(:item_id, :borrowing_library_id)
125
135
  end
@@ -17,4 +17,5 @@ end
17
17
  # inter_library_loan_id :integer
18
18
  # created_at :datetime
19
19
  # updated_at :datetime
20
+ # most_recent :boolean
20
21
  #
@@ -0,0 +1,21 @@
1
+ class InterLibraryLoanPolicy < ApplicationPolicy
2
+ def index?
3
+ user.try(:has_role?, 'Librarian')
4
+ end
5
+
6
+ def show?
7
+ user.try(:has_role?, 'Librarian')
8
+ end
9
+
10
+ def create?
11
+ user.try(:has_role?, 'Librarian')
12
+ end
13
+
14
+ def update?
15
+ user.try(:has_role?, 'Librarian')
16
+ end
17
+
18
+ def destroy?
19
+ user.try(:has_role?, 'Librarian')
20
+ end
21
+ end
@@ -26,13 +26,17 @@
26
26
  <%= l(inter_library_loan.shipped_at) if inter_library_loan.shipped_at -%><br />
27
27
  <%= l(inter_library_loan.received_at) if inter_library_loan.received_at -%>
28
28
  </td>
29
- <%- if can? :destroy, inter_library_loan -%>
30
- <td>
29
+ <td>
30
+ <%- if policy(inter_library_loan).show? -%>
31
31
  <%= link_to t('page.show'), inter_library_loan -%>
32
+ <%- end -%>
33
+ <%- if policy(inter_library_loan).update? -%>
32
34
  <%= link_to t('page.edit'), edit_inter_library_loan_path(inter_library_loan) -%>
35
+ <%- end -%>
36
+ <%- if policy(inter_library_loan).destroy? -%>
33
37
  <%= link_to t('page.destroy'), inter_library_loan, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
34
- </td>
35
- <%- end -%>
38
+ <%- end -%>
39
+ </td>
36
40
  </tr>
37
41
  <%- end -%>
38
42
  </table>
@@ -43,7 +47,7 @@
43
47
 
44
48
  <div id="submenu" class="ui-corner-all ui-widget-content">
45
49
  <ul>
46
- <%- if can? :create, InterLibraryLoan -%>
50
+ <%- if policy(InterLibraryLoan).create? -%>
47
51
  <li><%= link_to t('page.new', :model => t('activerecord.models.inter_library_loan')), new_inter_library_loan_path -%></li>
48
52
  <%- end -%>
49
53
  </ul>
@@ -0,0 +1,9 @@
1
+ class AddMostRecentToInterLibraryLoanTransitions < ActiveRecord::Migration
2
+ def up
3
+ add_column :inter_library_loan_transitions, :most_recent, :boolean, null: true
4
+ end
5
+
6
+ def down
7
+ remove_column :inter_library_loan_transitions, :most_recent
8
+ end
9
+ end
@@ -1,4 +1,4 @@
1
- require 'enju_leaf'
1
+ require 'enju_circulation'
2
2
 
3
3
  module EnjuInterLibraryLoan
4
4
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module EnjuInterLibraryLoan
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0.beta.2"
3
3
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require 'rails_helper'
2
2
  require 'sunspot/rails/spec_helper'
3
3
 
4
4
  describe InterLibraryLoansController do
@@ -35,14 +35,14 @@ describe InterLibraryLoansController do
35
35
 
36
36
  it "assigns empty as @inter_library_loans" do
37
37
  get :index
38
- assigns(:inter_library_loans).should be_empty
38
+ assigns(:inter_library_loans).should be_nil
39
39
  end
40
40
  end
41
41
 
42
42
  describe "When not logged in" do
43
43
  it "assigns empty as @inter_library_loans" do
44
44
  get :index
45
- assigns(:inter_library_loans).should be_empty
45
+ assigns(:inter_library_loans).should be_nil
46
46
  end
47
47
  end
48
48
  end
@@ -123,7 +123,7 @@ describe InterLibraryLoansController do
123
123
 
124
124
  it "should not assign the requested inter_library_loan as @inter_library_loan" do
125
125
  get :new
126
- assigns(:inter_library_loan).should_not be_valid
126
+ assigns(:inter_library_loan).should be_nil
127
127
  response.should be_forbidden
128
128
  end
129
129
  end
@@ -131,7 +131,7 @@ describe InterLibraryLoansController do
131
131
  describe "When not logged in" do
132
132
  it "should not assign the requested inter_library_loan as @inter_library_loan" do
133
133
  get :new
134
- assigns(:inter_library_loan).should_not be_valid
134
+ assigns(:inter_library_loan).should be_nil
135
135
  response.should redirect_to(new_user_session_url)
136
136
  end
137
137
  end
@@ -1,7 +1,8 @@
1
1
  class ApplicationController < ActionController::Base
2
2
  protect_from_forgery
3
+ include EnjuLibrary::Controller
4
+ include EnjuBiblio::Controller
5
+ after_action :verify_authorized
3
6
 
4
- enju_leaf
5
- enju_biblio
6
- enju_library
7
+ include Pundit
7
8
  end
@@ -6,7 +6,7 @@ class User < ActiveRecord::Base
6
6
 
7
7
  # Setup accessible (or protected) attributes for your model
8
8
 
9
- enju_leaf_user_model
10
- enju_circulation_user_model
11
- enju_message_user_model
9
+ include EnjuSeed::EnjuUser
10
+ include EnjuMessage::EnjuUser
11
+ include EnjuCirculation::EnjuUser
12
12
  end
@@ -2,8 +2,12 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require 'rails/all'
4
4
 
5
- Bundler.require
6
- require "enju_inter_library_loan"
5
+ Bundler.require(*Rails.groups)
6
+ require 'enju_inter_library_loan'
7
+ require 'enju_leaf'
8
+ require 'enju_circulation'
9
+ require 'globalize'
10
+ require 'globalize-accessors'
7
11
 
8
12
  module Dummy
9
13
  class Application < Rails::Application
@@ -11,16 +15,6 @@ module Dummy
11
15
  # Application configuration should go into files in config/initializers
12
16
  # -- all .rb files in that directory are automatically loaded.
13
17
 
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
18
  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
19
  # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
20
  # config.time_zone = 'Central Time (US & Canada)'
@@ -29,19 +23,8 @@ module Dummy
29
23
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
24
  # config.i18n.default_locale = :de
31
25
 
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'
26
+ # Do not swallow errors in after_commit/after_rollback callbacks.
27
+ config.active_record.raise_in_transactional_callbacks = true
43
28
  end
44
29
  end
45
30
 
46
- require 'enju_leaf'
47
- require 'enju_circulation'
@@ -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,39 +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
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+
43
+ config.action_mailer.default_url_options = {:host => 'localhost:3000'}
39
44
  end
@@ -0,0 +1,18 @@
1
+ class CreateMessageTemplates < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :message_templates do |t|
4
+ t.string :status, :null => false
5
+ t.text :title, :null => false
6
+ t.text :body, :null => false
7
+ t.integer :position
8
+ t.string :locale, :default => I18n.default_locale.to_s
9
+
10
+ t.timestamps
11
+ end
12
+ add_index :message_templates, :status, :unique => true
13
+ end
14
+
15
+ def self.down
16
+ drop_table :message_templates
17
+ end
18
+ end
@@ -0,0 +1,23 @@
1
+ class CreateMessages < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :messages, :force => true do |t|
4
+ t.datetime :read_at
5
+ t.integer :receiver_id, :sender_id
6
+ t.string :subject, :null => false
7
+ t.text :body
8
+ t.integer :message_request_id
9
+ t.integer :parent_id
10
+
11
+ t.timestamps
12
+ end
13
+
14
+ add_index :messages, :sender_id
15
+ add_index :messages, :receiver_id
16
+ add_index :messages, :message_request_id
17
+ add_index :messages, :parent_id
18
+ end
19
+
20
+ def self.down
21
+ drop_table :messages
22
+ end
23
+ end
@@ -0,0 +1,18 @@
1
+ class CreateMessageRequests < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :message_requests do |t|
4
+ t.integer :sender_id
5
+ t.integer :receiver_id
6
+ t.integer :message_template_id
7
+ t.datetime :sent_at
8
+ t.datetime :deleted_at
9
+ t.text :body
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+
15
+ def self.down
16
+ drop_table :message_requests
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ class AddLftAndRgtToMessage < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :messages, :lft, :integer
4
+ add_column :messages, :rgt, :integer
5
+ end
6
+
7
+ def self.down
8
+ remove_column :messages, :rgt
9
+ remove_column :messages, :lft
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class AddDepthToMessage < ActiveRecord::Migration
2
+ def change
3
+ add_column :messages, :depth, :integer
4
+
5
+ end
6
+ end
@@ -6,7 +6,7 @@ class CreateUserImportFiles < ActiveRecord::Migration
6
6
  t.datetime :executed_at
7
7
  t.string :user_import_file_name
8
8
  t.string :user_import_content_type
9
- t.string :user_import_file_size
9
+ t.integer :user_import_file_size
10
10
  t.datetime :user_import_updated_at
11
11
  t.string :user_import_fingerprint
12
12
  t.string :edit_mode
@@ -0,0 +1,18 @@
1
+ class CreateMessageTransitions < ActiveRecord::Migration
2
+ def change
3
+ create_table :message_transitions do |t|
4
+ t.string :to_state
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
10
+ t.integer :sort_key
11
+ t.integer :message_id
12
+ t.timestamps
13
+ end
14
+
15
+ add_index :message_transitions, :message_id
16
+ add_index :message_transitions, [:sort_key, :message_id], unique: true
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ class CreateMessageRequestTransitions < ActiveRecord::Migration
2
+ def change
3
+ create_table :message_request_transitions do |t|
4
+ t.string :to_state
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
10
+ t.integer :sort_key
11
+ t.integer :message_request_id
12
+ t.timestamps
13
+ end
14
+
15
+ add_index :message_request_transitions, :message_request_id
16
+ add_index :message_request_transitions, [:sort_key, :message_request_id], unique: true, name: "index_message_request_transitions_on_sort_key_and_request_id"
17
+ end
18
+ 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,6 @@
1
+ class AddForeignKeyToShelvesReferencingLibraries < ActiveRecord::Migration
2
+ def change
3
+ add_foreign_key :shelves, :libraries
4
+ add_foreign_key :items, :shelves
5
+ end
6
+ end