-
Notifications
You must be signed in to change notification settings - Fork 57
[1643] Hide Unavailable Equipment Items #1668
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -836,4 +836,42 @@ | |
expect(page).to have_content('Description') | ||
end | ||
end | ||
|
||
context 'when hide unavailable button is clicked' 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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we have an |
||
@eq_model1[:overdue_count] = 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you should actually create an overdue reservation for this because it's a feature spec |
||
@eq_model1.save! | ||
@eq_model1.reload | ||
page.reset! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this necessary? you haven't visited a page yet |
||
visit root_path | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this belongs in the individual |
||
end | ||
|
||
after(:each) do | ||
Capybara.ignore_hidden_elements = true | ||
@eq_model1.destroy | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this isn't necessary |
||
page.reset! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this also shouldn't be necessary |
||
end | ||
|
||
it 'shows all items by default' do | ||
expect(page).to have_css('.availability-num', text: 1, visible: true) | ||
expect(page).to have_css('.availability-num', text: 0, visible: true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these checks are nice! |
||
end | ||
|
||
it 'hides only unavailable items when clicked' 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: false) | ||
end | ||
|
||
it 'reshows all items when clicked again' do | ||
click_button 'toggle_unavailable' | ||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary?