enju_circulation 0.2.0.beta.2 → 0.2.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/checkout_type.rb +1 -1
- data/app/models/circulation_status.rb +1 -1
- data/app/models/demand.rb +12 -0
- data/app/models/manifestation_checkout_stat_transition.rb +3 -2
- data/app/models/manifestation_reserve_stat_transition.rb +3 -2
- data/app/models/reserve_transition.rb +8 -7
- data/app/models/use_restriction.rb +1 -1
- data/app/models/user_checkout_stat_transition.rb +3 -2
- data/app/models/user_reserve_stat_transition.rb +3 -2
- data/lib/enju_circulation/version.rb +1 -1
- data/lib/generators/enju_circulation/setup/setup_generator.rb +1 -1
- data/lib/tasks/enju_circulation_tasks.rake +5 -5
- data/spec/controllers/carrier_type_has_checkout_types_controller_spec.rb +1 -1
- data/spec/controllers/checked_items_controller_spec.rb +1 -1
- data/spec/controllers/checkins_controller_spec.rb +1 -1
- data/spec/controllers/checkout_types_controller_spec.rb +1 -1
- data/spec/controllers/checkouts_controller_spec.rb +1 -1
- data/spec/controllers/circulation_statuses_controller_spec.rb +1 -1
- data/spec/controllers/item_has_use_restrictions_controller_spec.rb +1 -1
- data/spec/controllers/lending_policies_controller_spec.rb +1 -1
- data/spec/controllers/manifestation_checkout_stats_controller_spec.rb +1 -1
- data/spec/controllers/manifestation_reserve_stats_controller_spec.rb +1 -1
- data/spec/controllers/profiles_controller_spec.rb +16 -0
- data/spec/controllers/reserves_controller_spec.rb +1 -1
- data/spec/controllers/use_restrictions_controller_spec.rb +1 -1
- data/spec/controllers/user_checkout_stats_controller_spec.rb +1 -1
- data/spec/controllers/user_group_has_checkout_types_controller_spec.rb +1 -1
- data/spec/controllers/user_reserve_stats_controller_spec.rb +1 -1
- data/spec/dummy/app/models/user.rb +8 -1
- data/spec/dummy/config/application.rb +3 -1
- data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +1 -1
- data/spec/dummy/db/migrate/20150506105356_add_error_message_to_user_import_result.rb +5 -0
- data/spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160813191733_add_family_name_first_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160813192542_add_pub_year_facet_range_interval_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160813203039_add_user_id_to_library_group.rb +5 -0
- data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +9 -0
- data/spec/dummy/db/schema.rb +15 -5
- data/spec/fixtures/checkout_types.yml +1 -1
- data/spec/fixtures/circulation_statuses.yml +1 -1
- data/spec/fixtures/demands.yml +12 -0
- data/spec/fixtures/library_groups.yml +1 -6
- data/spec/fixtures/reserve_transitions.yml +8 -7
- data/spec/fixtures/use_restrictions.yml +1 -1
- data/spec/models/basket_spec.rb +1 -2
- data/spec/models/carrier_type_has_checkout_type_spec.rb +1 -2
- data/spec/models/checked_item_spec.rb +1 -2
- data/spec/models/checkin_spec.rb +1 -2
- data/spec/models/checkout_spec.rb +1 -2
- data/spec/models/checkout_stat_has_manifestation_spec.rb +1 -2
- data/spec/models/checkout_stat_has_user_spec.rb +1 -2
- data/spec/models/checkout_type_spec.rb +2 -3
- data/spec/models/circulation_status_spec.rb +2 -3
- data/spec/models/item_has_use_resetriction_spec.rb +1 -2
- data/spec/models/lending_policy_spec.rb +1 -2
- data/spec/models/manifestation_checkout_stat_spec.rb +1 -2
- data/spec/models/manifestation_reserve_stat_spec.rb +1 -2
- data/spec/models/reserve_spec.rb +1 -2
- data/spec/models/reserve_stat_has_manifestation_spec.rb +1 -2
- data/spec/models/reserve_stat_has_user_spec.rb +1 -2
- data/spec/models/use_resetriction_spec.rb +1 -2
- data/spec/models/user_checkout_stat_spec.rb +1 -2
- data/spec/models/user_group_has_checkout_type_spec.rb +1 -2
- data/spec/models/user_reserve_stat_spec.rb +1 -2
- data/spec/models/user_spec.rb +67 -0
- data/spec/rails_helper.rb +54 -0
- data/spec/routing/checked_items_routing_spec.rb +1 -1
- data/spec/spec_helper.rb +82 -44
- data/spec/views/checkout_types/edit.html.erb_spec.rb +1 -1
- data/spec/views/checkout_types/index.html.erb_spec.rb +1 -1
- data/spec/views/checkout_types/new.html.erb_spec.rb +1 -1
- data/spec/views/checkout_types/show.html.erb_spec.rb +1 -1
- data/spec/views/checkouts/edit.html.erb_spec.rb +1 -1
- data/spec/views/checkouts/index.html.erb_spec.rb +1 -1
- data/spec/views/checkouts/show.html.erb_spec.rb +1 -1
- data/spec/views/my_accounts/show.html.erb_spec.rb +43 -0
- data/spec/views/profiles/show.html.erb_spec.rb +1 -1
- data/spec/views/reserves/index.html.erb_spec.rb +1 -1
- data/spec/views/use_restrictions/edit.html.erb_spec.rb +1 -1
- data/spec/views/use_restrictions/index.html.erb_spec.rb +1 -1
- data/spec/views/use_restrictions/new.html.erb_spec.rb +1 -1
- data/spec/views/use_restrictions/show.html.erb_spec.rb +1 -1
- metadata +76 -10
- data/spec/dummy/config/initializers/enju_leaf.rb +0 -5
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
1
|
+
require 'rails_helper'
|
3
2
|
|
4
3
|
describe CheckoutType do
|
5
4
|
#pending "add some examples to (or delete) #{__FILE__}"
|
@@ -11,7 +10,7 @@ end
|
|
11
10
|
# Table name: checkout_types
|
12
11
|
#
|
13
12
|
# id :integer not null, primary key
|
14
|
-
# name :string
|
13
|
+
# name :string not null
|
15
14
|
# display_name :text
|
16
15
|
# note :text
|
17
16
|
# position :integer
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
1
|
+
require 'rails_helper'
|
3
2
|
|
4
3
|
describe CirculationStatus do
|
5
4
|
#pending "add some examples to (or delete) #{__FILE__}"
|
@@ -11,7 +10,7 @@ end
|
|
11
10
|
# Table name: circulation_statuses
|
12
11
|
#
|
13
12
|
# id :integer not null, primary key
|
14
|
-
# name :string
|
13
|
+
# name :string not null
|
15
14
|
# display_name :text
|
16
15
|
# note :text
|
17
16
|
# position :integer
|
data/spec/models/reserve_spec.rb
CHANGED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe User do
|
4
|
+
#pending "add some examples to (or delete) #{__FILE__}"
|
5
|
+
fixtures :all
|
6
|
+
|
7
|
+
it "should get checked_item_count" do
|
8
|
+
count = users(:user1).checked_item_count
|
9
|
+
count.should eq({book: 2, serial: 1, cd: 1})
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should get reserves_count" do
|
13
|
+
users(:user1).reserves.waiting.count.should eq 1
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should send_message" do
|
17
|
+
assert users(:librarian1).send_message('reservation_expired_for_patron', :manifestations => users(:librarian1).reserves.not_sent_expiration_notice_to_patron.collect(&:manifestation))
|
18
|
+
users(:librarian1).reload
|
19
|
+
users(:librarian1).reserves.not_sent_expiration_notice_to_patron.should be_empty
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# == Schema Information
|
24
|
+
#
|
25
|
+
# Table name: users
|
26
|
+
#
|
27
|
+
# id :integer not null, primary key
|
28
|
+
# email :string(255) default(""), not null
|
29
|
+
# encrypted_password :string(255) default(""), not null
|
30
|
+
# reset_password_token :string(255)
|
31
|
+
# reset_password_sent_at :datetime
|
32
|
+
# remember_created_at :datetime
|
33
|
+
# sign_in_count :integer default(0)
|
34
|
+
# current_sign_in_at :datetime
|
35
|
+
# last_sign_in_at :datetime
|
36
|
+
# current_sign_in_ip :string(255)
|
37
|
+
# last_sign_in_ip :string(255)
|
38
|
+
# password_salt :string(255)
|
39
|
+
# confirmation_token :string(255)
|
40
|
+
# confirmed_at :datetime
|
41
|
+
# confirmation_sent_at :datetime
|
42
|
+
# unconfirmed_email :string(255)
|
43
|
+
# failed_attempts :integer default(0)
|
44
|
+
# unlock_token :string(255)
|
45
|
+
# locked_at :datetime
|
46
|
+
# authentication_token :string(255)
|
47
|
+
# created_at :datetime not null
|
48
|
+
# updated_at :datetime not null
|
49
|
+
# deleted_at :datetime
|
50
|
+
# username :string(255) not null
|
51
|
+
# library_id :integer default(1), not null
|
52
|
+
# user_group_id :integer default(1), not null
|
53
|
+
# expired_at :datetime
|
54
|
+
# required_role_id :integer default(1), not null
|
55
|
+
# note :text
|
56
|
+
# keyword_list :text
|
57
|
+
# user_number :string(255)
|
58
|
+
# state :string(255)
|
59
|
+
# locale :string(255)
|
60
|
+
# enju_access_key :string(255)
|
61
|
+
# save_checkout_history :boolean default(FALSE), not null
|
62
|
+
# checkout_icalendar_token :string(255)
|
63
|
+
# share_bookmarks :boolean
|
64
|
+
# save_search_history :boolean default(FALSE), not null
|
65
|
+
# answer_feed_token :string(255)
|
66
|
+
#
|
67
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
SimpleCov.start 'rails'
|
4
|
+
Coveralls.wear!
|
5
|
+
|
6
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
7
|
+
ENV["RAILS_ENV"] ||= 'test'
|
8
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
9
|
+
require 'rspec/rails'
|
10
|
+
require 'factory_girl'
|
11
|
+
require 'sunspot-rails-tester'
|
12
|
+
require 'rspec/active_model/mocks'
|
13
|
+
|
14
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
15
|
+
# in spec/support/ and its subdirectories.
|
16
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
# == Mock Framework
|
20
|
+
#
|
21
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
22
|
+
#
|
23
|
+
# config.mock_with :mocha
|
24
|
+
# config.mock_with :flexmock
|
25
|
+
# config.mock_with :rr
|
26
|
+
config.mock_with :rspec
|
27
|
+
|
28
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
29
|
+
config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
|
30
|
+
|
31
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
32
|
+
# examples within a transaction, remove the following line or assign false
|
33
|
+
# instead of true.
|
34
|
+
config.use_transactional_fixtures = true
|
35
|
+
|
36
|
+
config.extend ControllerMacros, :type => :controller
|
37
|
+
|
38
|
+
$original_sunspot_session = Sunspot.session
|
39
|
+
|
40
|
+
config.before do
|
41
|
+
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
|
42
|
+
end
|
43
|
+
|
44
|
+
config.before :each, :solr => true do
|
45
|
+
Sunspot::Rails::Tester.start_original_sunspot_session
|
46
|
+
Sunspot.session = $original_sunspot_session
|
47
|
+
Sunspot.remove_all!
|
48
|
+
end
|
49
|
+
|
50
|
+
config.infer_spec_type_from_file_location!
|
51
|
+
end
|
52
|
+
|
53
|
+
FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
|
54
|
+
FactoryGirl.find_definitions
|
data/spec/spec_helper.rb
CHANGED
@@ -1,54 +1,92 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
require
|
13
|
-
|
14
|
-
#
|
15
|
-
#
|
16
|
-
|
17
|
-
|
1
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
18
19
|
RSpec.configure do |config|
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
# rspec-expectations config goes here. You can use an alternate
|
21
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
22
|
+
# assertions if you prefer.
|
23
|
+
config.expect_with :rspec do |expectations|
|
24
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
25
|
+
# and `failure_message` of custom matchers include text for helper methods
|
26
|
+
# defined using `chain`, e.g.:
|
27
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
28
|
+
# # => "be bigger than 2 and smaller than 4"
|
29
|
+
# ...rather than:
|
30
|
+
# # => "be bigger than 2"
|
31
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
32
|
+
end
|
27
33
|
|
28
|
-
#
|
29
|
-
|
34
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
35
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
36
|
+
config.mock_with :rspec do |mocks|
|
37
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
38
|
+
# a real object. This is generally recommended, and will default to
|
39
|
+
# `true` in RSpec 4.
|
40
|
+
mocks.verify_partial_doubles = false
|
41
|
+
end
|
30
42
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
43
|
+
# The settings below are suggested to provide a good initial experience
|
44
|
+
# with RSpec, but feel free to customize to your heart's content.
|
45
|
+
=begin
|
46
|
+
# These two settings work together to allow you to limit a spec run
|
47
|
+
# to individual examples or groups you care about by tagging them with
|
48
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
49
|
+
# get run.
|
50
|
+
config.filter_run :focus
|
51
|
+
config.run_all_when_everything_filtered = true
|
35
52
|
|
36
|
-
|
53
|
+
# Allows RSpec to persist some state between runs in order to support
|
54
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
55
|
+
# you configure your source control system to ignore this file.
|
56
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
37
57
|
|
38
|
-
|
58
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
59
|
+
# recommended. For more details, see:
|
60
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
61
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
62
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
63
|
+
config.disable_monkey_patching!
|
39
64
|
|
40
|
-
|
41
|
-
|
65
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
66
|
+
# file, and it's useful to allow more verbose output when running an
|
67
|
+
# individual spec file.
|
68
|
+
if config.files_to_run.one?
|
69
|
+
# Use the documentation formatter for detailed output,
|
70
|
+
# unless a formatter has already been configured
|
71
|
+
# (e.g. via a command-line flag).
|
72
|
+
config.default_formatter = 'doc'
|
42
73
|
end
|
43
74
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
75
|
+
# Print the 10 slowest examples and example groups at the
|
76
|
+
# end of the spec run, to help surface which specs are running
|
77
|
+
# particularly slow.
|
78
|
+
config.profile_examples = 10
|
49
79
|
|
50
|
-
|
51
|
-
|
80
|
+
# Run specs in random order to surface order dependencies. If you find an
|
81
|
+
# order dependency and want to debug it, you can fix the order by providing
|
82
|
+
# the seed, which is printed after each run.
|
83
|
+
# --seed 1234
|
84
|
+
config.order = :random
|
52
85
|
|
53
|
-
|
54
|
-
|
86
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
87
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
88
|
+
# test failures related to randomization by passing the same `--seed` value
|
89
|
+
# as the one that triggered the failure.
|
90
|
+
Kernel.srand config.seed
|
91
|
+
=end
|
92
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe "my_accounts/show" do
|
4
|
+
fixtures :all
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@profile = assign(:profile, profiles(:profile_admin))
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "when logged in as Librarian" do
|
11
|
+
before(:each) do
|
12
|
+
@profile = assign(:profile, profiles(:profile_librarian2))
|
13
|
+
user = users(:librarian1)
|
14
|
+
view.stub(:current_user).and_return(user)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "renders attributes in <p>" do
|
18
|
+
allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
|
19
|
+
render
|
20
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
21
|
+
rendered.should match(/Checkout/)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "cannot be deletable by other librarian" do
|
25
|
+
allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
|
26
|
+
render
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "when logged in as User" do
|
31
|
+
before(:each) do
|
32
|
+
@profile = assign(:profile, profiles(:profile_user2))
|
33
|
+
user = users(:librarian1)
|
34
|
+
view.stub(:current_user).and_return(user)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "renders attributes in <p>" do
|
38
|
+
allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
|
39
|
+
render
|
40
|
+
rendered.should match(/Checkout/)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|