Convert admin/custom_emojis
spec controller->system (#33327)
This commit is contained in:
parent
ca2a7d66b8
commit
668ce14ff2
2 changed files with 37 additions and 59 deletions
|
@ -5,8 +5,43 @@ require 'rails_helper'
|
|||
RSpec.describe 'Admin::CustomEmojis' do
|
||||
let(:current_user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) }
|
||||
|
||||
before do
|
||||
sign_in current_user
|
||||
before { sign_in current_user }
|
||||
|
||||
describe 'Listing existing emoji' do
|
||||
let!(:custom_emoji) { Fabricate :custom_emoji }
|
||||
|
||||
it 'Shows records' do
|
||||
visit admin_custom_emojis_path
|
||||
|
||||
expect(page)
|
||||
.to have_content(I18n.t('admin.custom_emojis.title'))
|
||||
.and have_content(custom_emoji.shortcode)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Creating a new emoji' do
|
||||
it 'saves a new emoji record with valid attributes' do
|
||||
visit new_admin_custom_emoji_path
|
||||
expect(page)
|
||||
.to have_content(I18n.t('admin.custom_emojis.title'))
|
||||
|
||||
expect { submit_form }
|
||||
.to_not change(CustomEmoji, :count)
|
||||
expect(page)
|
||||
.to have_content(/errors below/)
|
||||
|
||||
fill_in I18n.t('admin.custom_emojis.shortcode'),
|
||||
with: 'test'
|
||||
attach_file 'custom_emoji_image',
|
||||
Rails.root.join('spec', 'fixtures', 'files', 'emojo.png')
|
||||
|
||||
expect { submit_form }
|
||||
.to change(CustomEmoji, :count).by(1)
|
||||
end
|
||||
|
||||
def submit_form
|
||||
click_on I18n.t('admin.custom_emojis.upload')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Performing batch updates' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue