mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 21:10:54 +00:00
24eabf89e6
Changed login field text Changed database configuration connection pool size to be configured via dotenv Use a single BBcode parser library Added better translations coverage Code formatting Increases maximum article text limit Added database cleaner with the deletion strategy during testing
39 lines
1.1 KiB
Ruby
39 lines
1.1 KiB
Ruby
require 'spec_helper'
|
|
|
|
feature 'User creates new article' do
|
|
let!(:category) { create(:category, domain: Category::DOMAIN_NEWS) }
|
|
let(:article) { attributes_for(:article) }
|
|
|
|
describe 'with valid Title, Content, Category' do
|
|
context 'as a basic user' do
|
|
let!(:user) { create(:user) }
|
|
|
|
before do
|
|
sign_in_as(user)
|
|
visit new_article_path
|
|
end
|
|
|
|
it 'creates an article successfully' do
|
|
fill_in attribute_translation(:article, :title), with: article[:title]
|
|
fill_tinymce "#article_text", article[:text]
|
|
click_button I18n.t('helpers.submit.post.create')
|
|
|
|
expect(page).to have_content(I18n.t('articles_create'))
|
|
end
|
|
|
|
it 'creates an article with a text length greater than 65535 bytes' do
|
|
fill_in attribute_translation(:article, :title), with: article[:title]
|
|
fill_tinymce "#article_text", long_text
|
|
click_button I18n.t('helpers.submit.post.create')
|
|
|
|
expect(page).to have_content(I18n.t('articles_create'))
|
|
end
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def long_text
|
|
(0..10000).map{ (0...8).map { (65 + rand(26)).chr }.join }.join(" ") # 90008
|
|
end
|
|
end
|