enju_library 0.1.0.pre43 → 0.1.0.pre44
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/app/controllers/accepts_controller.rb +2 -2
- data/app/controllers/withdraws_controller.rb +126 -0
- data/app/models/accept.rb +2 -3
- data/app/models/basket.rb +3 -3
- data/app/models/bookstore.rb +6 -7
- data/app/models/budget_type.rb +3 -4
- data/app/models/color.rb +4 -4
- data/app/models/enju_library/ability.rb +4 -2
- data/app/models/library.rb +11 -12
- data/app/models/library_group.rb +6 -5
- data/app/models/request_status_type.rb +3 -4
- data/app/models/request_type.rb +3 -4
- data/app/models/search_engine.rb +4 -5
- data/app/models/shelf.rb +3 -4
- data/app/models/subscribe.rb +2 -3
- data/app/models/subscription.rb +2 -3
- data/app/models/withdraw.rb +27 -0
- data/app/views/accepts/new.html.erb +1 -1
- data/app/views/libraries/show.html.erb +21 -17
- data/app/views/library_groups/_form.html.erb +5 -0
- data/app/views/library_groups/show.html.erb +9 -4
- data/app/views/withdraws/_form.html.erb +11 -0
- data/app/views/withdraws/_list.html.erb +31 -0
- data/app/views/withdraws/edit.html.erb +13 -0
- data/app/views/withdraws/index.html.erb +50 -0
- data/app/views/withdraws/index.js.erb +1 -0
- data/app/views/withdraws/index.txt.csv +4 -0
- data/app/views/withdraws/new.html.erb +15 -0
- data/app/views/withdraws/show.html.erb +31 -0
- data/config/locales/translation_en.yml +11 -0
- data/config/locales/translation_ja.yml +11 -0
- data/config/routes.rb +3 -2
- data/db/migrate/20150924115059_create_withdraws.rb +13 -0
- data/lib/enju_library/version.rb +1 -1
- data/spec/controllers/accepts_controller_spec.rb +3 -3
- data/spec/controllers/withdraws_controller_spec.rb +132 -0
- data/spec/dummy/app/assets/javascripts/application.js +4 -6
- data/spec/dummy/db/schema.rb +12 -1
- data/spec/factories/accepts.rb +2 -2
- data/spec/factories/budget_types.rb +3 -3
- data/spec/factories/withdraw.rb +21 -0
- data/spec/fixtures/baskets.yml +2 -3
- data/spec/fixtures/bookstores.yml +6 -7
- data/spec/fixtures/budget_types.yml +3 -4
- data/spec/fixtures/colors.yml +4 -4
- data/spec/fixtures/libraries.yml +10 -10
- data/spec/fixtures/library_groups.yml +7 -5
- data/spec/fixtures/request_status_types.yml +3 -3
- data/spec/fixtures/request_types.yml +3 -3
- data/spec/fixtures/search_engines.yml +4 -5
- data/spec/fixtures/shelves.yml +3 -3
- data/spec/fixtures/subscribes.yml +2 -3
- data/spec/fixtures/subscriptions.yml +2 -3
- data/spec/fixtures/withdraws.yml +20 -0
- data/spec/models/accept_spec.rb +2 -3
- data/spec/models/basket_spec.rb +2 -3
- data/spec/models/bookstore_spec.rb +6 -7
- data/spec/models/budget_type_spec.rb +3 -4
- data/spec/models/library_group_spec.rb +6 -5
- data/spec/models/library_spec.rb +10 -11
- data/spec/models/request_status_type_spec.rb +3 -4
- data/spec/models/request_type_spec.rb +3 -4
- data/spec/models/search_engine_spec.rb +4 -5
- data/spec/models/shelf_spec.rb +3 -4
- data/spec/models/subscribe_spec.rb +2 -3
- data/spec/models/subscription_spec.rb +2 -3
- data/spec/models/withdraw_spec.rb +21 -0
- data/spec/rails_helper.rb +79 -0
- data/spec/routing/withdraws_routing_spec.rb +27 -0
- data/spec/spec_helper.rb +82 -51
- data/spec/views/libraries/show.html.erb_spec.rb +14 -0
- data/spec/views/withdraws/edit.html.erb_spec.rb +14 -0
- data/spec/views/withdraws/index.html.erb_spec.rb +26 -0
- data/spec/views/withdraws/new.html.erb_spec.rb +31 -0
- data/spec/views/withdraws/show.html.erb_spec.rb +11 -0
- metadata +43 -26
- data/spec/support/vcr.rb +0 -9
data/spec/fixtures/shelves.yml
CHANGED
@@ -33,14 +33,14 @@ shelf_00004:
|
|
33
33
|
# Table name: shelves
|
34
34
|
#
|
35
35
|
# id :integer not null, primary key
|
36
|
-
# name :string
|
36
|
+
# name :string not null
|
37
37
|
# display_name :text
|
38
38
|
# note :text
|
39
39
|
# library_id :integer default(1), not null
|
40
40
|
# items_count :integer default(0), not null
|
41
41
|
# position :integer
|
42
|
-
# created_at :datetime
|
43
|
-
# updated_at :datetime
|
42
|
+
# created_at :datetime
|
43
|
+
# updated_at :datetime
|
44
44
|
# deleted_at :datetime
|
45
45
|
# closed :boolean default(FALSE), not null
|
46
46
|
#
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
withdraws_00001:
|
3
|
+
updated_at: 2015-09-21 17:21:58.554146 +09:00
|
4
|
+
id: 1
|
5
|
+
librarian_id: 1
|
6
|
+
basket_id: 1
|
7
|
+
item_id: 1
|
8
|
+
created_at: 2015-09-21 17:21:58.554146 +09:00
|
9
|
+
|
10
|
+
# == Schema Information
|
11
|
+
#
|
12
|
+
# Table name: withdraws
|
13
|
+
#
|
14
|
+
# id :integer not null, primary key
|
15
|
+
# basket_id :integer
|
16
|
+
# item_id :integer
|
17
|
+
# librarian_id :integer
|
18
|
+
# created_at :datetime not null
|
19
|
+
# updated_at :datetime not null
|
20
|
+
#
|
data/spec/models/accept_spec.rb
CHANGED
data/spec/models/basket_spec.rb
CHANGED
@@ -12,15 +12,14 @@ end
|
|
12
12
|
#
|
13
13
|
# id :integer not null, primary key
|
14
14
|
# name :text not null
|
15
|
-
# zip_code :string
|
15
|
+
# zip_code :string
|
16
16
|
# address :text
|
17
17
|
# note :text
|
18
|
-
# telephone_number :string
|
19
|
-
# fax_number :string
|
20
|
-
# url :string
|
18
|
+
# telephone_number :string
|
19
|
+
# fax_number :string
|
20
|
+
# url :string
|
21
21
|
# position :integer
|
22
22
|
# deleted_at :datetime
|
23
|
-
# created_at :datetime
|
24
|
-
# updated_at :datetime
|
23
|
+
# created_at :datetime
|
24
|
+
# updated_at :datetime
|
25
25
|
#
|
26
|
-
|
@@ -12,11 +12,10 @@ end
|
|
12
12
|
# Table name: budget_types
|
13
13
|
#
|
14
14
|
# id :integer not null, primary key
|
15
|
-
# name :string
|
15
|
+
# name :string
|
16
16
|
# display_name :text
|
17
17
|
# note :text
|
18
18
|
# position :integer
|
19
|
-
# created_at :datetime
|
20
|
-
# updated_at :datetime
|
19
|
+
# created_at :datetime
|
20
|
+
# updated_at :datetime
|
21
21
|
#
|
22
|
-
|
@@ -20,16 +20,17 @@ end
|
|
20
20
|
# Table name: library_groups
|
21
21
|
#
|
22
22
|
# id :integer not null, primary key
|
23
|
-
# name :string
|
23
|
+
# name :string not null
|
24
24
|
# display_name :text
|
25
|
-
# short_name :string
|
25
|
+
# short_name :string not null
|
26
26
|
# my_networks :text
|
27
27
|
# login_banner :text
|
28
28
|
# note :text
|
29
29
|
# country_id :integer
|
30
30
|
# position :integer
|
31
|
-
# created_at :datetime
|
32
|
-
# updated_at :datetime
|
31
|
+
# created_at :datetime
|
32
|
+
# updated_at :datetime
|
33
33
|
# admin_networks :text
|
34
|
-
# url :string
|
34
|
+
# url :string default("http://localhost:3000/")
|
35
|
+
# settings :text
|
35
36
|
#
|
data/spec/models/library_spec.rb
CHANGED
@@ -19,29 +19,28 @@ end
|
|
19
19
|
# Table name: libraries
|
20
20
|
#
|
21
21
|
# id :integer not null, primary key
|
22
|
-
# name :string
|
22
|
+
# name :string not null
|
23
23
|
# display_name :text
|
24
|
-
# short_display_name :string
|
25
|
-
# zip_code :string
|
24
|
+
# short_display_name :string not null
|
25
|
+
# zip_code :string
|
26
26
|
# street :text
|
27
27
|
# locality :text
|
28
28
|
# region :text
|
29
|
-
# telephone_number_1 :string
|
30
|
-
# telephone_number_2 :string
|
31
|
-
# fax_number :string
|
29
|
+
# telephone_number_1 :string
|
30
|
+
# telephone_number_2 :string
|
31
|
+
# fax_number :string
|
32
32
|
# note :text
|
33
33
|
# call_number_rows :integer default(1), not null
|
34
|
-
# call_number_delimiter :string
|
34
|
+
# call_number_delimiter :string default("|"), not null
|
35
35
|
# library_group_id :integer default(1), not null
|
36
36
|
# users_count :integer default(0), not null
|
37
37
|
# position :integer
|
38
38
|
# country_id :integer
|
39
|
-
# created_at :datetime
|
40
|
-
# updated_at :datetime
|
39
|
+
# created_at :datetime
|
40
|
+
# updated_at :datetime
|
41
41
|
# deleted_at :datetime
|
42
42
|
# opening_hour :text
|
43
|
-
# isil :string
|
43
|
+
# isil :string
|
44
44
|
# latitude :float
|
45
45
|
# longitude :float
|
46
46
|
#
|
47
|
-
|
@@ -11,11 +11,10 @@ end
|
|
11
11
|
# Table name: request_status_types
|
12
12
|
#
|
13
13
|
# id :integer not null, primary key
|
14
|
-
# name :string
|
14
|
+
# name :string not null
|
15
15
|
# display_name :text
|
16
16
|
# note :text
|
17
17
|
# position :integer
|
18
|
-
# created_at :datetime
|
19
|
-
# updated_at :datetime
|
18
|
+
# created_at :datetime
|
19
|
+
# updated_at :datetime
|
20
20
|
#
|
21
|
-
|
@@ -11,11 +11,10 @@ end
|
|
11
11
|
# Table name: request_types
|
12
12
|
#
|
13
13
|
# id :integer not null, primary key
|
14
|
-
# name :string
|
14
|
+
# name :string not null
|
15
15
|
# display_name :text
|
16
16
|
# note :text
|
17
17
|
# position :integer
|
18
|
-
# created_at :datetime
|
19
|
-
# updated_at :datetime
|
18
|
+
# created_at :datetime
|
19
|
+
# updated_at :datetime
|
20
20
|
#
|
21
|
-
|
@@ -14,16 +14,15 @@ end
|
|
14
14
|
# Table name: search_engines
|
15
15
|
#
|
16
16
|
# id :integer not null, primary key
|
17
|
-
# name :string
|
17
|
+
# name :string not null
|
18
18
|
# display_name :text
|
19
|
-
# url :string
|
19
|
+
# url :string not null
|
20
20
|
# base_url :text not null
|
21
21
|
# http_method :text not null
|
22
22
|
# query_param :text not null
|
23
23
|
# additional_param :text
|
24
24
|
# note :text
|
25
25
|
# position :integer
|
26
|
-
# created_at :datetime
|
27
|
-
# updated_at :datetime
|
26
|
+
# created_at :datetime
|
27
|
+
# updated_at :datetime
|
28
28
|
#
|
29
|
-
|
data/spec/models/shelf_spec.rb
CHANGED
@@ -15,15 +15,14 @@ end
|
|
15
15
|
# Table name: shelves
|
16
16
|
#
|
17
17
|
# id :integer not null, primary key
|
18
|
-
# name :string
|
18
|
+
# name :string not null
|
19
19
|
# display_name :text
|
20
20
|
# note :text
|
21
21
|
# library_id :integer default(1), not null
|
22
22
|
# items_count :integer default(0), not null
|
23
23
|
# position :integer
|
24
|
-
# created_at :datetime
|
25
|
-
# updated_at :datetime
|
24
|
+
# created_at :datetime
|
25
|
+
# updated_at :datetime
|
26
26
|
# deleted_at :datetime
|
27
27
|
# closed :boolean default(FALSE), not null
|
28
28
|
#
|
29
|
-
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe Withdraw, type: :model do
|
4
|
+
it "should change circulation_status" do
|
5
|
+
withdraw = FactoryGirl.create(:withdraw)
|
6
|
+
withdraw.item.circulation_status.name.should eq 'Removed'
|
7
|
+
withdraw.item.use_restriction.name.should eq 'Not For Loan'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# == Schema Information
|
12
|
+
#
|
13
|
+
# Table name: withdraws
|
14
|
+
#
|
15
|
+
# id :integer not null, primary key
|
16
|
+
# basket_id :integer
|
17
|
+
# item_id :integer
|
18
|
+
# librarian_id :integer
|
19
|
+
# created_at :datetime not null
|
20
|
+
# updated_at :datetime not null
|
21
|
+
#
|
@@ -0,0 +1,79 @@
|
|
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('../../spec/dummy/config/environment', __FILE__)
|
9
|
+
# Prevent database truncation if the environment is production
|
10
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
11
|
+
require 'spec_helper'
|
12
|
+
require 'rspec/rails'
|
13
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
14
|
+
require 'factory_girl'
|
15
|
+
require 'sunspot-rails-tester'
|
16
|
+
require 'rspec/active_model/mocks'
|
17
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
18
|
+
|
19
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
20
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
21
|
+
# run as spec files by default. This means that files in spec/support that end
|
22
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
23
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
24
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
25
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
26
|
+
#
|
27
|
+
# The following line is provided for convenience purposes. It has the downside
|
28
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
29
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
30
|
+
# require only the support files necessary.
|
31
|
+
#
|
32
|
+
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
33
|
+
|
34
|
+
# Checks for pending migrations before tests are run.
|
35
|
+
# If you are not using ActiveRecord, you can remove this line.
|
36
|
+
ActiveRecord::Migration.maintain_test_schema! if Rails::VERSION::MAJOR >= 4
|
37
|
+
|
38
|
+
RSpec.configure do |config|
|
39
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
40
|
+
config.fixture_path = "#{::Rails.root}/../../spec/fixtures"
|
41
|
+
|
42
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
43
|
+
# examples within a transaction, remove the following line or assign false
|
44
|
+
# instead of true.
|
45
|
+
config.use_transactional_fixtures = true
|
46
|
+
|
47
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
48
|
+
# based on their file location, for example enabling you to call `get` and
|
49
|
+
# `post` in specs under `spec/controllers`.
|
50
|
+
#
|
51
|
+
# You can disable this behaviour by removing the line below, and instead
|
52
|
+
# explicitly tag your specs with their type, e.g.:
|
53
|
+
#
|
54
|
+
# RSpec.describe UsersController, :type => :controller do
|
55
|
+
# # ...
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# The different available types are documented in the features, such as in
|
59
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
60
|
+
config.infer_spec_type_from_file_location!
|
61
|
+
|
62
|
+
config.extend ControllerMacros, :type => :controller
|
63
|
+
|
64
|
+
$original_sunspot_session = Sunspot.session
|
65
|
+
|
66
|
+
config.before do
|
67
|
+
Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
|
68
|
+
end
|
69
|
+
|
70
|
+
config.before :each, :solr => true do
|
71
|
+
Sunspot::Rails::Tester.start_original_sunspot_session
|
72
|
+
Sunspot.session = $original_sunspot_session
|
73
|
+
Sunspot.remove_all!
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
FactoryGirl.definition_file_paths << "#{::Rails.root}/../../spec/factories"
|
78
|
+
FactoryGirl.find_definitions
|
79
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "rails_helper"
|
2
|
+
|
3
|
+
RSpec.describe WithdrawsController, type: :routing do
|
4
|
+
describe "routing" do
|
5
|
+
|
6
|
+
it "routes to #index" do
|
7
|
+
expect(:get => "/withdraws").to route_to("withdraws#index")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "routes to #new" do
|
11
|
+
expect(:get => "/withdraws/new").to route_to("withdraws#new")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "routes to #show" do
|
15
|
+
expect(:get => "/withdraws/1").to route_to("withdraws#show", :id => "1")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "routes to #create" do
|
19
|
+
expect(:post => "/withdraws").to route_to("withdraws#create")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "routes to #destroy" do
|
23
|
+
expect(:delete => "/withdraws/1").to route_to("withdraws#destroy", :id => "1")
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,61 +1,92 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
require
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
#
|
17
|
-
#
|
18
|
-
|
19
|
-
#Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
20
|
-
|
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
|
21
19
|
RSpec.configure do |config|
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
32
33
|
|
33
|
-
#
|
34
|
-
#
|
35
|
-
|
36
|
-
|
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 = true
|
41
|
+
end
|
37
42
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
42
52
|
|
43
|
-
|
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"
|
44
57
|
|
45
|
-
|
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!
|
46
64
|
|
47
|
-
|
48
|
-
|
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'
|
49
73
|
end
|
50
74
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
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
|
56
79
|
|
57
|
-
|
58
|
-
|
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
|
59
85
|
|
60
|
-
|
61
|
-
|
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,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "libraries/show" do
|
4
|
+
fixtures :all
|
5
|
+
before(:each) do
|
6
|
+
@events = Kaminari::paginate_array([]).page(1)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "renders a library detail" do
|
10
|
+
assign(:library, FactoryGirl.create(:library, :street => "\tStreet 1-2"))
|
11
|
+
render
|
12
|
+
expect(rendered).to include "library"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe "withdraws/edit", type: :view do
|
4
|
+
before(:each) do
|
5
|
+
@withdraw = assign(:withdraw, FactoryGirl.create(:withdraw))
|
6
|
+
end
|
7
|
+
|
8
|
+
it "renders the edit withdraw form" do
|
9
|
+
render
|
10
|
+
|
11
|
+
assert_select "form[action=?][method=?]", withdraw_path(@withdraw), "post" do
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe "withdraws/index", type: :view do
|
4
|
+
fixtures :all
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
assign(:withdraws, Kaminari::paginate_array([
|
8
|
+
stub_model(Withdraw,
|
9
|
+
:item_id => 1,
|
10
|
+
:created_at => Time.zone.now
|
11
|
+
),
|
12
|
+
stub_model(Withdraw,
|
13
|
+
:item_id => 1,
|
14
|
+
:created_at => Time.zone.now
|
15
|
+
)
|
16
|
+
]).page(1))
|
17
|
+
basket = FactoryGirl.create(:basket)
|
18
|
+
assign(:basket, basket)
|
19
|
+
assign(:withdraw, basket.withdraws.new)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "renders a list of withdraws" do
|
23
|
+
render
|
24
|
+
assert_select "tr>td"
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe "withdraws/new", type: :view do
|
4
|
+
fixtures :all
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
assign(:withdraw, stub_model(Withdraw,
|
8
|
+
:item_id => 1
|
9
|
+
).as_new_record)
|
10
|
+
assign(:basket, baskets(:basket_00001))
|
11
|
+
assign(:withdraws, Kaminari::paginate_array([
|
12
|
+
stub_model(Withdraw,
|
13
|
+
:item_id => 1,
|
14
|
+
:created_at => Time.zone.now
|
15
|
+
),
|
16
|
+
stub_model(Withdraw,
|
17
|
+
:item_id => 1,
|
18
|
+
:created_at => Time.zone.now
|
19
|
+
)
|
20
|
+
]).page(1))
|
21
|
+
view.stub(:current_user).and_return(User.where(username: 'enjuadmin').first)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "renders new withdraw form" do
|
25
|
+
render
|
26
|
+
|
27
|
+
assert_select "form", :action => withdraws_path, :method => "post" do
|
28
|
+
assert_select "input#withdraw_item_identifier", :name => "withdraw[item_identifier]"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|