Convert admin/terms_of_service/*
spec controller->system (#33975)
This commit is contained in:
parent
e245633ffa
commit
ce23342d72
11 changed files with 150 additions and 219 deletions
39
spec/system/admin/terms_of_service/drafts_spec.rb
Normal file
39
spec/system/admin/terms_of_service/drafts_spec.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Admin TermsOfService Drafts' do
|
||||
before { sign_in(admin_user) }
|
||||
|
||||
describe 'Managing TOS drafts' do
|
||||
let!(:terms) { Fabricate :terms_of_service, published_at: nil }
|
||||
|
||||
it 'saves and publishes TOS drafts' do
|
||||
visit admin_terms_of_service_draft_path
|
||||
expect(page)
|
||||
.to have_title(I18n.t('admin.terms_of_service.title'))
|
||||
|
||||
# Invalid submission
|
||||
expect { click_on I18n.t('admin.terms_of_service.save_draft') }
|
||||
.to_not(change { terms.reload.published_at })
|
||||
expect(page)
|
||||
.to have_title(I18n.t('admin.terms_of_service.title'))
|
||||
|
||||
# Valid submission with draft button
|
||||
fill_in 'terms_of_service_text', with: 'new'
|
||||
expect { click_on I18n.t('admin.terms_of_service.save_draft') }
|
||||
.to not_change { terms.reload.published_at }.from(nil)
|
||||
.and not_change(Admin::ActionLog, :count)
|
||||
expect(page)
|
||||
.to have_title(I18n.t('admin.terms_of_service.title'))
|
||||
|
||||
# Valid with publish button
|
||||
fill_in 'terms_of_service_text', with: 'newer'
|
||||
expect { click_on I18n.t('admin.terms_of_service.publish') }
|
||||
.to change { terms.reload.published_at }.from(nil)
|
||||
.and change(Admin::ActionLog, :count)
|
||||
expect(page)
|
||||
.to have_title(I18n.t('admin.terms_of_service.title'))
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue