Skip to content

Commit

Permalink
update spec files
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeta committed Oct 29, 2018
1 parent 36bf01e commit 73c64b0
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 78 deletions.
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@ gem 'jquery-rails'
# gem 'debugger'
gem 'rails-controller-testing'
gem 'enju_leaf', github: 'next-l/enju_leaf', branch: '1.3'
gem 'enju_biblio', github: 'next-l/enju_biblio', branch: '1.3'
gem 'enju_event', github: 'next-l/enju_event', branch: '1.3'
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
it 'assigns the requested carrier_type_has_checkout_type as @carrier_type_has_checkout_type' do
get :new
assigns(:carrier_type_has_checkout_type).should_not be_valid
response.should be_successful
response.should be_successfulful
end
end

Expand Down
22 changes: 11 additions & 11 deletions spec/controllers/checked_items_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
it 'assigns all checked_items as @checked_items' do
get :index
assigns(:checked_items).should_not be_empty
response.should be_successful
response.should be_successfulful
end

it 'should get index without basket_id' do
get :index, params: { item_id: 1 }
assigns(:checked_items).should_not be_empty
response.should be_successful
response.should be_successfulful
end
end

Expand All @@ -26,14 +26,14 @@
it 'should be forbidden' do
get :index
assigns(:checked_items).should_not be_empty
response.should be_successful
response.should be_successfulful
end

describe 'When basket is specified' do
it 'assigns checked_items as @checked_items' do
get :index, params: { basket_id: 1 }
assigns(:checked_items).should_not be_empty
response.should be_successful
response.should be_successfulful
end
end
end
Expand Down Expand Up @@ -75,7 +75,7 @@
it 'assigns the requested checked_item as @checked_item' do
get :show, params: { id: 1 }
assigns(:checked_item).should eq(checked_items(:checked_item_00001))
response.should be_successful
response.should be_successfulful
end
end

Expand All @@ -85,7 +85,7 @@
it 'assigns the requested checked_item as @checked_item' do
get :show, params: { id: 1 }
assigns(:checked_item).should eq(checked_items(:checked_item_00001))
response.should be_successful
response.should be_successfulful
end
end

Expand Down Expand Up @@ -131,7 +131,7 @@
it 'assigns the requested checked_item as @checked_item' do
get :new, params: { basket_id: 3 }
assigns(:checked_item).should_not be_valid
response.should be_successful
response.should be_successfulful
end
end

Expand Down Expand Up @@ -172,7 +172,7 @@
checked_item = checked_items(:checked_item_00001)
get :edit, params: { id: checked_item.id }
assigns(:checked_item).should eq(checked_item)
response.should be_successful
response.should be_successfulful
end
end

Expand Down Expand Up @@ -245,7 +245,7 @@

it 'should not create checked_item without item_id' do
post :create, params: { checked_item: { item_identifier: '00004' }, basket_id: 1 }
response.should be_successful
response.should be_successfulful
end
end

Expand Down Expand Up @@ -276,12 +276,12 @@
post :create, params: { checked_item: { item_identifier: '00011', due_date_string: 'invalid' }, basket_id: 3 }
assigns(:checked_item).should_not be_valid
assigns(:checked_item).due_date.should be_nil
response.should be_successful
response.should be_successfulful
end

it 'should not create checked_item if excessed checkout_limit' do
post :create, params: { checked_item: { item_identifier: '00011' }, basket_id: 1 }
response.should be_successful
response.should be_successfulful
assigns(:checked_item).errors['base'].include?(I18n.t('activerecord.errors.messages.checked_item.excessed_checkout_limit')).should be_truthy
end

Expand Down
10 changes: 5 additions & 5 deletions spec/controllers/checkins_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ def mock_user(stubs = {})
it 'assigns all checkins as @checkins' do
get :index
assigns(:checkins).should eq Checkin.page(1)
response.should be_successful
response.should be_successfulful
end

describe 'When basket_id is specified' do
it 'assigns all checkins as @checkins' do
get :index, params: { basket_id: 10 }
assigns(:checkins).should eq Basket.find(10).checkins.page(1)
response.should be_successful
response.should be_successfulful
end
end
end
Expand All @@ -34,14 +34,14 @@ def mock_user(stubs = {})
it 'assigns all checkins as @checkins' do
get :index
assigns(:checkins).should eq Checkin.page(1)
response.should be_successful
response.should be_successfulful
end

describe 'When basket_id is specified' do
it 'assigns all checkins as @checkins' do
get :index, params: { basket_id: 9 }
assigns(:checkins).should eq Basket.find(9).checkins.page(1)
response.should be_successful
response.should be_successfulful
end
end
end
Expand Down Expand Up @@ -228,7 +228,7 @@ def mock_user(stubs = {})
it 'should not create checkin without item_id' do
post :create, params: { checkin: { item_identifier: nil }, basket_id: 9 }
assigns(:checkin).should_not be_valid
response.should be_successful
response.should be_successfulful
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/checkout_types_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
it 'assigns the requested checkout_type as @checkout_type' do
get :new
assigns(:checkout_type).should_not be_valid
response.should be_successful
response.should be_successfulful
end
end

Expand Down Expand Up @@ -194,7 +194,7 @@

it 'should be successful' do
post :create, params: { checkout_type: @invalid_attrs }
response.should be_successful
response.should be_successfulful
end
end
end
Expand Down
44 changes: 22 additions & 22 deletions spec/controllers/checkouts_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

it "should get other user's index" do
get :index, params: { user_id: users(:admin).username }
response.should be_successful
response.should be_successfulful
assigns(:checkouts).should eq users(:admin).checkouts.not_returned.order('checkouts.id DESC').page(1)
end

Expand All @@ -42,48 +42,48 @@

it 'should get index' do
get :index
response.should be_successful
response.should be_successfulful
end

it 'should get index txt' do
get :index, format: 'txt'
assigns(:checkouts).count.should eq assigns(:checkouts).total_entries
response.should be_successful
response.should be_successfulful
end

it 'should get index rss' do
get :index, format: 'rss'
assigns(:checkouts).count.should eq assigns(:checkouts).total_entries
response.should be_successful
response.should be_successfulful
end

it 'should get overdue index' do
get :index, params: { days_overdue: 1 }
assigns(:checkouts).should eq Checkout.overdue(1.day.ago.beginning_of_day).order('checkouts.id DESC').page(1)
response.should be_successful
response.should be_successfulful
end

it 'should get overdue index with number of days_overdue' do
get :index, params: { days_overdue: 2 }
response.should be_successful
response.should be_successfulful
assigns(:checkouts).size.should > 0
end

it 'should get overdue index with invalid number of days_overdue' do
get :index, params: { days_overdue: 'invalid days' }
response.should be_successful
response.should be_successfulful
assigns(:checkouts).size.should > 0
end

it "should get other user's index" do
get :index, params: { user_id: users(:admin).username }
response.should be_successful
response.should be_successfulful
assigns(:checkouts).should eq users(:admin).checkouts.not_returned.order('checkouts.id DESC').page(1)
end

it 'should get index with item_id' do
get :index, params: { item_id: 1 }
response.should be_successful
response.should be_successfulful
assigns(:checkouts).should eq items(:item_00001).checkouts.order('checkouts.id DESC').page(1)
end
end
Expand All @@ -95,7 +95,7 @@
get :index
assigns(:checkouts).should eq(users(:user1).checkouts.order('checkouts.created_at DESC').page(1))
assigns(:checkouts).total_entries.should eq users(:user1).checkouts.count
response.should be_successful
response.should be_successfulful
end

it "should be forbidden if other's username is specified" do
Expand All @@ -107,7 +107,7 @@

it 'should get my index feed' do
get :index, format: 'rss'
response.should be_successful
response.should be_successfulful
assigns(:checkouts).should eq(users(:user1).checkouts.order('checkouts.created_at DESC').page(1))
end

Expand Down Expand Up @@ -147,15 +147,15 @@
user = Profile.where(checkout_icalendar_token: token).first.user
get :index, params: { icalendar_token: token }
assigns(:checkouts).should eq user.checkouts.not_returned.order('checkouts.id DESC')
response.should be_successful
response.should be_successfulful
end

it 'should get ics template' do
token = '577830b08ecf9c4c4333d599a57a6f44a7fe76c0'
user = Profile.where(checkout_icalendar_token: token).first.user
get :index, params: { icalendar_token: token, format: :ics }
assigns(:checkouts).should eq user.checkouts.not_returned.order('checkouts.id DESC')
response.should be_successful
response.should be_successfulful
end
end
end
Expand All @@ -166,7 +166,7 @@

it "should show other user's content" do
get :show, params: { id: 3 }
response.should be_successful
response.should be_successfulful
end
end

Expand All @@ -175,7 +175,7 @@

it "should show other user's content" do
get :show, params: { id: 3 }
response.should be_successful
response.should be_successfulful
end
end

Expand All @@ -184,7 +184,7 @@

it 'should show my account' do
get :show, params: { id: 3 }
response.should be_successful
response.should be_successfulful
assigns(:checkout).should eq checkouts(:checkout_00003)
end

Expand All @@ -209,7 +209,7 @@

it "should edit other user's checkout" do
get :edit, params: { id: 3 }
response.should be_successful
response.should be_successfulful
end
end

Expand All @@ -218,7 +218,7 @@

it "should edit other user's checkout" do
get :edit, params: { id: 3 }
response.should be_successful
response.should be_successfulful
end
end

Expand All @@ -228,7 +228,7 @@
it 'should edit my checkout' do
sign_in users(:user1)
get :edit, params: { id: 3 }
response.should be_successful
response.should be_successfulful
end

it "should not edit other user's checkout" do
Expand Down Expand Up @@ -283,7 +283,7 @@
it 'should not accept invalid date' do
put :update, params: { id: @checkout.id, checkout: @invalid_attrs.merge(due_date: '2017-03-151') }
assigns(:checkout).changed?.should be_truthy
response.should be_successful
response.should be_successfulful
end
end

Expand Down Expand Up @@ -330,7 +330,7 @@
it 'should update checkout item that is reserved' do
put :update, params: { id: 8, checkout: {} }
assigns(:checkout).errors[:base].include?(I18n.t('checkout.this_item_is_reserved')).should be_truthy
response.should be_successful
response.should be_successfulful
end

it "should update other user's checkout" do
Expand Down Expand Up @@ -381,7 +381,7 @@
it 'should not update checkout already renewed' do
put :update, params: { id: 9, checkout: {} }
assigns(:checkout).errors[:base].include?(I18n.t('checkout.excessed_renewal_limit')).should be_truthy
response.should be_successful
response.should be_successfulful
end

it 'should update my checkout' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def valid_attributes
it 'assigns the requested item_has_use_restriction as @item_has_use_restriction' do
get :new
assigns(:item_has_use_restriction).should_not be_valid
response.should be_successful
response.should be_successfulful
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/lending_policies_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def valid_attributes
it 'assigns the requested lending_policy as @lending_policy' do
get :show, params: { id: @lending_policy.id }
assigns(:lending_policy).should eq(@lending_policy)
response.should be_successful
response.should be_successfulful
end
end

Expand All @@ -70,7 +70,7 @@ def valid_attributes
it 'assigns the requested lending_policy as @lending_policy' do
get :show, params: { id: @lending_policy.id }
assigns(:lending_policy).should eq(@lending_policy)
response.should be_successful
response.should be_successfulful
end
end

Expand Down
Loading

0 comments on commit 73c64b0

Please sign in to comment.