mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 02:35:57 +02:00
parent
3741e2d2a3
commit
58ae53b1e6
17 changed files with 264 additions and 13 deletions
|
@ -1,24 +1,22 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Editing price in admin area', settings: false do
|
||||
given!(:price) { create(:price) }
|
||||
given!(:price) { create(:unexpired_price) }
|
||||
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
scenario 'updates price' do
|
||||
visit admin_prices_url
|
||||
visit admin_prices_path
|
||||
open_form
|
||||
submit_form
|
||||
|
||||
expect(page).to have_text(t('admin.billing.prices.update.updated'))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def open_form
|
||||
click_link_or_button 'admin-edit-price-btn'
|
||||
find('.edit-price-btn').click
|
||||
end
|
||||
|
||||
def submit_form
|
||||
|
|
25
spec/features/admin/billing/prices/expire_spec.rb
Normal file
25
spec/features/admin/billing/prices/expire_spec.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Expiring price in admin area', settings: false do
|
||||
given!(:price) { create(:unexpired_price) }
|
||||
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
scenario 'expires price' do
|
||||
visit admin_prices_path
|
||||
open_edit_form
|
||||
expire
|
||||
|
||||
expect(page).to have_text(t('admin.billing.prices.expire.expired'))
|
||||
end
|
||||
|
||||
def open_edit_form
|
||||
find('.edit-price-btn').click
|
||||
end
|
||||
|
||||
def expire
|
||||
click_link_or_button t('admin.billing.prices.edit.expire_btn')
|
||||
end
|
||||
end
|
33
spec/features/admin/billing/prices/list_spec.rb
Normal file
33
spec/features/admin/billing/prices/list_spec.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Viewing prices in admin area', settings: false do
|
||||
given!(:unexpired_price) { create(:unexpired_price) }
|
||||
given!(:expired_price) { create(:expired_price) }
|
||||
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
describe 'search' do
|
||||
context 'when validity is not selected' do
|
||||
scenario 'shows unexpired 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
|
||||
visit admin_prices_path
|
||||
select 'unexpired', from: 'search_validity'
|
||||
submit_search_form
|
||||
|
||||
expect(page).to have_css('.price', count: 1)
|
||||
end
|
||||
end
|
||||
|
||||
def submit_search_form
|
||||
find('.price-search-form-search-btn').click
|
||||
end
|
||||
end
|
||||
end
|
|
@ -16,8 +16,6 @@ RSpec.feature 'New price in admin area', settings: false do
|
|||
expect(page).to have_text(t('admin.billing.prices.create.created'))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def open_list
|
||||
click_link_or_button t('admin.menu.prices')
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue