Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Commit

Permalink
Fix faulty tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yongjie Lin committed Apr 1, 2017
1 parent 1bc2785 commit 6966e9b
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions spec/features/reservations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -837,25 +837,22 @@
end
end

context 'when hide unavailable button is clicked' do
before do
context 'when hide unavailable button is clicked', js: true do
before(:each) do
empty_cart
Capybara.ignore_hidden_elements = false
@eq_model1 = FactoryGirl.create(:equipment_model, category: @category)
FactoryGirl.create(:equipment_item, equipment_model: @eq_model1)

# update availability of eq_model1 to 0 without making a reservation
@temp = @eq_model1[:overdue_count]
@eq_model1[:overdue_count] = 1
@eq_model1.save!
@eq_model1.reload
page.reset!
visit root_path
end

after do
@eq_model1[:overdue_count] = @temp
@eq_model1.save!
@eq_model1.reload
after(:each) do
Capybara.ignore_hidden_elements = true
@eq_model1.destroy
page.reset!
end

Expand All @@ -872,8 +869,9 @@

it 'reshows all items when clicked again' do
click_button 'toggle_unavailable'
expect(page).to have_css('.availability-num', text: 1, visible: true)
expect(page).to have_css('.availability-num', text: 0, visible: true)
click_button 'toggle_unavailable'
expect(page).to have_css('.availability-num', text: 1, visible: :true)
expect(page).to have_css('.availability-num', text: 0, visible: :true)
end
end
end

0 comments on commit 6966e9b

Please sign in to comment.