enju_library 0.1.2 → 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.
- checksums.yaml +4 -4
- data/README.rdoc +3 -3
- data/Rakefile +15 -8
- data/app/controllers/accepts_controller.rb +13 -3
- data/app/controllers/baskets_controller.rb +11 -1
- data/app/controllers/bookstores_controller.rb +12 -1
- data/app/controllers/budget_types_controller.rb +13 -2
- data/app/controllers/concerns/enju_library/controller.rb +43 -0
- data/app/controllers/libraries_controller.rb +13 -4
- data/app/controllers/library_groups_controller.rb +16 -6
- data/app/controllers/request_status_types_controller.rb +13 -2
- data/app/controllers/request_types_controller.rb +13 -2
- data/app/controllers/search_engines_controller.rb +13 -2
- data/app/controllers/shelves_controller.rb +14 -4
- data/app/controllers/subscribes_controller.rb +12 -2
- data/app/controllers/subscriptions_controller.rb +12 -3
- data/app/controllers/withdraws_controller.rb +14 -3
- data/app/helpers/shelves_helper.rb +2 -2
- data/app/models/accept.rb +2 -4
- data/app/models/basket.rb +0 -2
- data/app/models/budget_type.rb +0 -1
- data/app/models/concerns/enju_library/enju_item.rb +32 -0
- data/app/models/library_group.rb +9 -16
- data/app/models/request_status_type.rb +0 -1
- data/app/models/request_type.rb +0 -1
- data/app/models/search_engine.rb +0 -1
- data/app/models/withdraw.rb +8 -4
- data/app/policies/accept_policy.rb +21 -0
- data/app/policies/basket_policy.rb +21 -0
- data/app/policies/bookstore_policy.rb +23 -0
- data/app/policies/budget_type_policy.rb +21 -0
- data/app/policies/library_group_policy.rb +23 -0
- data/app/policies/library_policy.rb +25 -0
- data/app/policies/request_status_type_policy.rb +21 -0
- data/app/policies/request_type_policy.rb +21 -0
- data/app/policies/search_engine_policy.rb +21 -0
- data/app/policies/shelf_policy.rb +23 -0
- data/app/policies/subscribe_policy.rb +21 -0
- data/app/policies/subscription_policy.rb +21 -0
- data/app/policies/withdraw_policy.rb +21 -0
- data/app/views/accepts/index.html.erb +1 -1
- data/app/views/accepts/show.html.erb +1 -1
- data/app/views/baskets/edit.html.erb +1 -1
- data/app/views/baskets/new.html.erb +3 -1
- data/app/views/bookstores/index.html.erb +4 -4
- data/app/views/bookstores/show.html.erb +2 -2
- data/app/views/budget_types/index.html.erb +4 -4
- data/app/views/budget_types/show.html.erb +2 -2
- data/app/views/libraries/{_map.mobile.erb → _map.html+phone.erb} +0 -0
- data/app/views/libraries/index.html.erb +4 -4
- data/app/views/libraries/{show.mobile.erb → show.html+phone.erb} +0 -0
- data/app/views/libraries/show.html.erb +5 -5
- data/app/views/library_groups/_color_fields.html.erb +5 -0
- data/app/views/library_groups/_form.html.erb +17 -7
- data/app/views/library_groups/edit.html.erb +1 -1
- data/app/views/library_groups/index.html.erb +1 -1
- data/app/views/library_groups/show.html.erb +6 -2
- data/app/views/picture_files/_index_shelf.html.erb +4 -4
- data/app/views/request_status_types/index.html.erb +6 -4
- data/app/views/request_status_types/show.html.erb +1 -1
- data/app/views/request_types/index.html.erb +6 -4
- data/app/views/request_types/show.html.erb +1 -1
- data/app/views/search_engines/index.html.erb +4 -4
- data/app/views/search_engines/show.html.erb +2 -2
- data/app/views/shelves/_library_facet.html.erb +1 -1
- data/app/views/shelves/index.html.erb +4 -4
- data/app/views/shelves/{show.mobile.erb → show.html+phone.erb} +0 -0
- data/app/views/shelves/show.html.erb +3 -3
- data/app/views/subscriptions/index.html.erb +3 -1
- data/app/views/subscriptions/show.html.erb +1 -1
- data/app/views/withdraws/index.html.erb +1 -1
- data/app/views/withdraws/show.html.erb +1 -1
- data/config/locales/translation_en.yml +2 -1
- data/config/locales/translation_ja.yml +2 -1
- data/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
- data/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
- data/lib/enju_library/engine.rb +3 -0
- data/lib/enju_library/version.rb +1 -1
- data/lib/enju_library.rb +0 -41
- data/lib/generators/enju_library/setup/setup_generator.rb +2 -0
- data/lib/generators/enju_library/setup/templates/db/fixtures/library_group/translations.yml +10 -0
- data/lib/tasks/enju_library_tasks.rake +6 -2
- data/spec/controllers/accepts_controller_spec.rb +6 -6
- data/spec/controllers/baskets_controller_spec.rb +7 -7
- data/spec/controllers/bookstores_controller_spec.rb +11 -11
- data/spec/controllers/budget_types_controller_spec.rb +1 -1
- data/spec/controllers/libraries_controller_spec.rb +9 -9
- data/spec/controllers/library_groups_controller_spec.rb +3 -3
- data/spec/controllers/request_status_types_controller_spec.rb +16 -16
- data/spec/controllers/request_types_controller_spec.rb +16 -16
- data/spec/controllers/search_engines_controller_spec.rb +13 -13
- data/spec/controllers/shelves_controller_spec.rb +10 -9
- data/spec/controllers/subscribes_controller_spec.rb +8 -8
- data/spec/controllers/subscriptions_controller_spec.rb +8 -8
- data/spec/controllers/withdraws_controller_spec.rb +11 -3
- data/spec/dummy/app/controllers/application_controller.rb +6 -3
- data/spec/dummy/app/models/user.rb +2 -2
- data/spec/dummy/config/application.rb +8 -38
- data/spec/dummy/config/environments/development.rb +22 -18
- data/spec/dummy/config/environments/production.rb +46 -34
- data/spec/dummy/config/environments/test.rb +21 -14
- data/spec/dummy/config/initializers/enju_leaf.rb +6 -0
- data/spec/dummy/db/schema.rb +13 -1
- data/spec/models/withdraw_spec.rb +2 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/views/accepts/index.html.erb_spec.rb +1 -0
- data/spec/views/budget_types/index.html.erb_spec.rb +1 -0
- data/spec/views/budget_types/show.html.erb_spec.rb +1 -0
- data/spec/views/libraries/show.html.erb_spec.rb +2 -1
- data/spec/views/library_groups/edit.html.erb_spec.rb +1 -0
- data/spec/views/library_groups/show.html.erb_spec.rb +2 -0
- data/spec/views/withdraws/index.html.erb_spec.rb +2 -0
- metadata +52 -105
- data/app/models/enju_library/ability.rb +0 -72
- data/lib/enju_library/item.rb +0 -39
- data/spec/dummy/app/models/ability.rb +0 -68
@@ -36,14 +36,14 @@ describe SubscriptionsController do
|
|
36
36
|
|
37
37
|
it "assigns all subscriptions as @subscriptions" do
|
38
38
|
get :index
|
39
|
-
assigns(:subscriptions).should
|
39
|
+
assigns(:subscriptions).should be_nil
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
describe "When not logged in" do
|
44
44
|
it "assigns all subscriptions as @subscriptions" do
|
45
45
|
get :index
|
46
|
-
assigns(:subscriptions).should
|
46
|
+
assigns(:subscriptions).should be_nil
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -112,7 +112,7 @@ describe SubscriptionsController do
|
|
112
112
|
|
113
113
|
it "should not assign the requested subscription as @subscription" do
|
114
114
|
get :new
|
115
|
-
assigns(:subscription).
|
115
|
+
assigns(:subscription).should be_nil
|
116
116
|
response.should be_forbidden
|
117
117
|
end
|
118
118
|
end
|
@@ -120,7 +120,7 @@ describe SubscriptionsController do
|
|
120
120
|
describe "When not logged in" do
|
121
121
|
it "should not assign the requested subscription as @subscription" do
|
122
122
|
get :new
|
123
|
-
assigns(:subscription).
|
123
|
+
assigns(:subscription).should be_nil
|
124
124
|
response.should redirect_to(new_user_session_url)
|
125
125
|
end
|
126
126
|
end
|
@@ -234,7 +234,7 @@ describe SubscriptionsController do
|
|
234
234
|
describe "with valid params" do
|
235
235
|
it "assigns a newly created subscription as @subscription" do
|
236
236
|
post :create, :subscription => @attrs
|
237
|
-
assigns(:subscription).should
|
237
|
+
assigns(:subscription).should be_nil
|
238
238
|
end
|
239
239
|
|
240
240
|
it "should be forbidden" do
|
@@ -246,7 +246,7 @@ describe SubscriptionsController do
|
|
246
246
|
describe "with invalid params" do
|
247
247
|
it "assigns a newly created but unsaved subscription as @subscription" do
|
248
248
|
post :create, :subscription => @invalid_attrs
|
249
|
-
assigns(:subscription).
|
249
|
+
assigns(:subscription).should be_nil
|
250
250
|
end
|
251
251
|
|
252
252
|
it "should be forbidden" do
|
@@ -260,7 +260,7 @@ describe SubscriptionsController do
|
|
260
260
|
describe "with valid params" do
|
261
261
|
it "assigns a newly created subscription as @subscription" do
|
262
262
|
post :create, :subscription => @attrs
|
263
|
-
assigns(:subscription).should
|
263
|
+
assigns(:subscription).should be_nil
|
264
264
|
end
|
265
265
|
|
266
266
|
it "should be forbidden" do
|
@@ -272,7 +272,7 @@ describe SubscriptionsController do
|
|
272
272
|
describe "with invalid params" do
|
273
273
|
it "assigns a newly created but unsaved subscription as @subscription" do
|
274
274
|
post :create, :subscription => @invalid_attrs
|
275
|
-
assigns(:subscription).
|
275
|
+
assigns(:subscription).should be_nil
|
276
276
|
end
|
277
277
|
|
278
278
|
it "should be forbidden" do
|
@@ -46,7 +46,7 @@ RSpec.describe WithdrawsController, type: :controller do
|
|
46
46
|
login_fixture_admin
|
47
47
|
it "assigns all withdraws as @withdraws" do
|
48
48
|
withdraw = Withdraw.create! valid_attributes
|
49
|
-
get :index, :
|
49
|
+
get :index, basket_id: 1
|
50
50
|
expect(assigns(:withdraws)).to eq baskets(:basket_00001).withdraws.order('withdraws.created_at DESC').page(1)
|
51
51
|
end
|
52
52
|
end
|
@@ -95,16 +95,24 @@ RSpec.describe WithdrawsController, type: :controller do
|
|
95
95
|
post :create, valid_create_attributes
|
96
96
|
expect(response).to redirect_to(withdraws_path(basket_id: valid_create_attributes[:basket_id]))
|
97
97
|
end
|
98
|
+
|
99
|
+
it "should not withdraw a checked-out item" do
|
100
|
+
post :create, {basket_id: valid_create_attributes[:basket_id],
|
101
|
+
withdraw: { item_identifier: '00001' }
|
102
|
+
}
|
103
|
+
expect(assigns(:withdraw)).to be_a(Withdraw)
|
104
|
+
expect(response).to be_success
|
105
|
+
end
|
98
106
|
end
|
99
107
|
|
100
108
|
context "with invalid params" do
|
101
109
|
it "assigns a newly created but unsaved withdraw as @withdraw" do
|
102
|
-
post :create, {:
|
110
|
+
post :create, {basket_id: valid_create_attributes[:basket_id], withdraw: {item_id: nil}}
|
103
111
|
expect(assigns(:withdraw)).to be_a_new(Withdraw)
|
104
112
|
end
|
105
113
|
|
106
114
|
it "re-renders the 'new' template" do
|
107
|
-
post :create, {:
|
115
|
+
post :create, {basket_id: valid_create_attributes[:basket_id], withdraw: {item_id: nil}}
|
108
116
|
expect(response).to render_template("index")
|
109
117
|
end
|
110
118
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
protect_from_forgery
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
include EnjuLeaf::Controller
|
4
|
+
include EnjuBiblio::Controller
|
5
|
+
include EnjuLibrary::Controller
|
6
|
+
after_action :verify_authorized
|
7
|
+
|
8
|
+
include Pundit
|
6
9
|
end
|
@@ -3,6 +3,6 @@ class User < ActiveRecord::Base
|
|
3
3
|
:recoverable, :rememberable, :trackable, #, :validatable
|
4
4
|
:lockable, :lock_strategy => :none, :unlock_strategy => :none
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
include EnjuLeaf::EnjuUser
|
7
|
+
include EnjuCirculation::EnjuUser
|
8
8
|
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
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require 'enju_leaf'
|
7
|
+
require 'enju_circulation'
|
8
|
+
require 'enju_event'
|
9
|
+
require 'enju_inter_library_loan'
|
10
|
+
require 'enju_library'
|
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,32 +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
|
-
#
|
33
|
-
config.
|
34
|
-
|
35
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
36
|
-
config.filter_parameters += [:password]
|
37
|
-
|
38
|
-
# Use SQL instead of Active Record's schema dumper when creating the database.
|
39
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
40
|
-
# like if you have constraints or database-specific column types
|
41
|
-
# config.active_record.schema_format = :sql
|
42
|
-
|
43
|
-
# Enforce whitelist mode for mass assignment.
|
44
|
-
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
45
|
-
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
46
|
-
# parameters by using an attr_accessible or attr_protected declaration.
|
47
|
-
#config.active_record.whitelist_attributes = true
|
48
|
-
|
49
|
-
# Enable the asset pipeline
|
50
|
-
config.assets.enabled = true
|
51
|
-
|
52
|
-
# Version of your assets, change this if you want to expire all your assets
|
53
|
-
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
|
54
28
|
end
|
55
29
|
end
|
56
30
|
|
57
|
-
require 'enju_leaf'
|
58
|
-
require 'enju_circulation'
|
59
|
-
require "enju_event"
|
60
|
-
require "enju_inter_library_loan"
|
@@ -1,37 +1,41 @@
|
|
1
|
-
|
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
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
|
-
#
|
10
|
-
config.
|
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
|
-
#
|
23
|
-
config.
|
22
|
+
# Raise an error on page load if there are pending migrations.
|
23
|
+
config.active_record.migration_error = :page_load
|
24
24
|
|
25
|
-
#
|
26
|
-
|
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.
|
28
|
+
config.assets.debug = true
|
27
29
|
|
28
|
-
#
|
29
|
-
#
|
30
|
-
config.
|
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
|
31
33
|
|
32
|
-
#
|
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
|
34
38
|
|
35
|
-
#
|
36
|
-
config.
|
39
|
+
# Raises error for missing translations
|
40
|
+
# config.action_view.raise_on_missing_translations = true
|
37
41
|
end
|
@@ -1,67 +1,79 @@
|
|
1
|
-
|
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
|
-
#
|
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
|
-
#
|
12
|
-
|
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.
|
27
|
+
# Compress JavaScripts and CSS.
|
28
|
+
config.assets.js_compressor = :uglifier
|
29
|
+
# config.assets.css_compressor = :sass
|
16
30
|
|
17
|
-
#
|
31
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
18
32
|
config.assets.compile = false
|
19
33
|
|
20
|
-
#
|
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
|
-
#
|
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 =
|
28
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for
|
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
|
-
#
|
34
|
-
#
|
47
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
48
|
+
# when problems arise.
|
49
|
+
config.log_level = :debug
|
35
50
|
|
36
|
-
# Prepend all log lines with the following tags
|
51
|
+
# Prepend all log lines with the following tags.
|
37
52
|
# config.log_tags = [ :subdomain, :uuid ]
|
38
53
|
|
39
|
-
# Use a different logger for distributed setups
|
54
|
+
# Use a different logger for distributed setups.
|
40
55
|
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
41
56
|
|
42
|
-
# Use a different cache store in production
|
57
|
+
# Use a different cache store in production.
|
43
58
|
# config.cache_store = :mem_cache_store
|
44
59
|
|
45
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
46
|
-
# config.action_controller.asset_host =
|
47
|
-
|
48
|
-
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
49
|
-
# 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'
|
50
62
|
|
51
|
-
#
|
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.
|
52
65
|
# config.action_mailer.raise_delivery_errors = false
|
53
66
|
|
54
|
-
# Enable threaded mode
|
55
|
-
# config.threadsafe!
|
56
|
-
|
57
67
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
58
|
-
# the I18n.default_locale when a translation
|
68
|
+
# the I18n.default_locale when a translation cannot be found).
|
59
69
|
config.i18n.fallbacks = true
|
60
70
|
|
61
|
-
# Send deprecation notices to registered listeners
|
71
|
+
# Send deprecation notices to registered listeners.
|
62
72
|
config.active_support.deprecation = :notify
|
63
73
|
|
64
|
-
#
|
65
|
-
|
66
|
-
|
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
|
67
79
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
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
5
|
# test suite. You never need to work with it otherwise. Remember that
|
@@ -7,31 +7,38 @@ Dummy::Application.configure do
|
|
7
7
|
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
|
-
#
|
11
|
-
|
12
|
-
|
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
|
-
#
|
15
|
-
config.
|
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
|
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
|
-
#
|
33
|
-
|
34
|
+
# Randomize the order test cases are executed.
|
35
|
+
config.active_support.test_order = :random
|
34
36
|
|
35
|
-
# Print deprecation notices to the stderr
|
37
|
+
# Print deprecation notices to the stderr.
|
36
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'}
|
37
44
|
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
Accept.include(EnjuCirculation::EnjuAccept)
|
2
|
+
Basket.include(EnjuCirculation::EnjuBasket)
|
3
|
+
Manifestation.include(EnjuCirculation::EnjuManifestation)
|
4
|
+
Item.include(EnjuCirculation::EnjuItem)
|
5
|
+
Item.include(EnjuLibrary::EnjuItem)
|
6
|
+
Withdraw.include(EnjuCirculation::EnjuWithdraw)
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -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:
|
14
|
+
ActiveRecord::Schema.define(version: 20151213072705) do
|
15
15
|
|
16
16
|
create_table "accepts", force: :cascade do |t|
|
17
17
|
t.integer "basket_id"
|
@@ -659,6 +659,18 @@ ActiveRecord::Schema.define(version: 20150924115059) do
|
|
659
659
|
add_index "libraries", ["library_group_id"], name: "index_libraries_on_library_group_id"
|
660
660
|
add_index "libraries", ["name"], name: "index_libraries_on_name", unique: true
|
661
661
|
|
662
|
+
create_table "library_group_translations", force: :cascade do |t|
|
663
|
+
t.integer "library_group_id", null: false
|
664
|
+
t.string "locale", null: false
|
665
|
+
t.datetime "created_at", null: false
|
666
|
+
t.datetime "updated_at", null: false
|
667
|
+
t.text "login_banner"
|
668
|
+
t.text "footer_banner"
|
669
|
+
end
|
670
|
+
|
671
|
+
add_index "library_group_translations", ["library_group_id"], name: "index_library_group_translations_on_library_group_id"
|
672
|
+
add_index "library_group_translations", ["locale"], name: "index_library_group_translations_on_locale"
|
673
|
+
|
662
674
|
create_table "library_groups", force: :cascade do |t|
|
663
675
|
t.string "name", null: false
|
664
676
|
t.text "display_name"
|
data/spec/spec_helper.rb
CHANGED
@@ -37,7 +37,7 @@ RSpec.configure do |config|
|
|
37
37
|
# Prevents you from mocking or stubbing a method that does not exist on
|
38
38
|
# a real object. This is generally recommended, and will default to
|
39
39
|
# `true` in RSpec 4.
|
40
|
-
mocks.verify_partial_doubles =
|
40
|
+
mocks.verify_partial_doubles = false
|
41
41
|
end
|
42
42
|
|
43
43
|
# The settings below are suggested to provide a good initial experience
|
@@ -20,6 +20,7 @@ describe "accepts/index" do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "renders a list of accepts" do
|
23
|
+
allow(view).to receive(:policy).and_return double(create?: true, destroy?: true)
|
23
24
|
render
|
24
25
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
25
26
|
assert_select "tr>td"
|
@@ -19,6 +19,7 @@ describe "budget_types/index" do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "renders a list of budget_types" do
|
22
|
+
allow(view).to receive(:policy).and_return double(create?: true, update?: true, destroy?: true)
|
22
23
|
render
|
23
24
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
24
25
|
assert_select "tr>td", :text => "Public funds".to_s, :count => 1
|
@@ -11,6 +11,7 @@ describe "budget_types/show" do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "renders attributes in <p>" do
|
14
|
+
allow(view).to receive(:policy).and_return double(update?: true)
|
14
15
|
render
|
15
16
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
16
17
|
rendered.should match(/Name/)
|
@@ -4,10 +4,11 @@ describe "libraries/show" do
|
|
4
4
|
fixtures :all
|
5
5
|
before(:each) do
|
6
6
|
@events = Kaminari::paginate_array([]).page(1)
|
7
|
+
assign(:library, FactoryGirl.create(:library, :street => "\tStreet 1-2"))
|
7
8
|
end
|
8
9
|
|
9
10
|
it "renders a library detail" do
|
10
|
-
|
11
|
+
allow(view).to receive(:policy).and_return double(create?: true, update?: true)
|
11
12
|
render
|
12
13
|
expect(rendered).to include "library"
|
13
14
|
end
|
@@ -3,9 +3,11 @@ require 'spec_helper'
|
|
3
3
|
describe "library_groups/show" do
|
4
4
|
before(:each) do
|
5
5
|
@library_group = LibraryGroup.site_config
|
6
|
+
view.stub(:current_user).and_return(User.friendly.find('enjuadmin'))
|
6
7
|
end
|
7
8
|
|
8
9
|
it "renders attributes in <p>" do
|
10
|
+
allow(view).to receive(:policy).and_return double(update?: true)
|
9
11
|
render
|
10
12
|
end
|
11
13
|
end
|
@@ -17,9 +17,11 @@ RSpec.describe "withdraws/index", type: :view do
|
|
17
17
|
basket = FactoryGirl.create(:basket)
|
18
18
|
assign(:basket, basket)
|
19
19
|
assign(:withdraw, basket.withdraws.new)
|
20
|
+
view.stub(:current_user).and_return(User.friendly.find('enjuadmin'))
|
20
21
|
end
|
21
22
|
|
22
23
|
it "renders a list of withdraws" do
|
24
|
+
allow(view).to receive(:policy).and_return double(destroy?: true)
|
23
25
|
render
|
24
26
|
assert_select "tr>td"
|
25
27
|
end
|