Consider nil in price expire time as effective

#522
This commit is contained in:
Artur Beljajev 2017-06-03 23:12:16 +03:00
parent 8916eee169
commit f76e1259fc
11 changed files with 106 additions and 65 deletions

View file

@ -1,7 +1,7 @@
require 'rails_helper'
RSpec.feature 'Editing price in admin area', settings: false do
given!(:price) { create(:unexpired_price) }
given!(:price) { create(:effective_price) }
background do
sign_in_to_admin_area

View file

@ -1,7 +1,7 @@
require 'rails_helper'
RSpec.feature 'Expiring price in admin area', settings: false do
given!(:price) { create(:unexpired_price) }
given!(:price) { create(:effective_price) }
background do
sign_in_to_admin_area

View file

@ -1,7 +1,7 @@
require 'rails_helper'
RSpec.feature 'Viewing prices in admin area', settings: false do
given!(:unexpired_price) { create(:unexpired_price) }
given!(:effective_price) { create(:effective_price) }
given!(:expired_price) { create(:expired_price) }
background do
@ -9,17 +9,17 @@ RSpec.feature 'Viewing prices in admin area', settings: false do
end
describe 'search' do
context 'when validity is not selected' do
scenario 'shows unexpired prices' do
context 'when status is not selected' do
scenario 'shows effective prices' do
visit admin_prices_path
expect(page).to have_css('.price', count: 1)
end
end
context 'when validity is given' do
scenario 'filters by given validity' do
context 'when status is given' do
scenario 'filters by given status' do
visit admin_prices_path
select 'unexpired', from: 'search_validity'
select 'effective', from: 'search_status'
submit_search_form
expect(page).to have_css('.price', count: 1)