ensl.org/spec/features/articles/new_article_spec.rb
Luke Barratt 24eabf89e6 Changed newrelic configuration to load from environment variables
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
2014-03-30 20:50:52 +01:00

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