2014-09-02 18:07:02 +05:30
|
|
|
class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps
|
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
|
|
|
|
2016-01-19 16:12:03 +05:30
|
|
|
step 'application already has a broadcast message' do
|
|
|
|
FactoryGirl.create(:broadcast_message, :expired, message: "Migration to new server")
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2016-01-19 16:12:03 +05:30
|
|
|
step 'I should see all broadcast messages' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content "Migration to new server"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should be redirected to admin messages page' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(current_path).to eq admin_broadcast_messages_path
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see newly created broadcast message' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'submit form with new customized broadcast message' do
|
2016-04-02 18:10:28 +05:30
|
|
|
fill_in 'broadcast_message_message', with: 'Application update from **4:00 CST to 5:00 CST**'
|
2014-09-02 18:07:02 +05:30
|
|
|
fill_in 'broadcast_message_color', with: '#f2dede'
|
|
|
|
fill_in 'broadcast_message_font', with: '#b94a48'
|
2016-01-19 16:12:03 +05:30
|
|
|
select Date.today.next_year.year, from: "broadcast_message_ends_at_1i"
|
2014-09-02 18:07:02 +05:30
|
|
|
click_button "Add broadcast message"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see a customized broadcast message' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
|
2016-04-02 18:10:28 +05:30
|
|
|
expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST'
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_selector %(div[style="background-color: #f2dede; color: #b94a48"])
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2016-01-19 16:12:03 +05:30
|
|
|
|
|
|
|
step 'I edit an existing broadcast message' do
|
|
|
|
click_link 'Edit'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I change the broadcast message text' do
|
|
|
|
fill_in 'broadcast_message_message', with: 'Application update RIGHT NOW'
|
|
|
|
click_button 'Update broadcast message'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see the updated broadcast message' do
|
|
|
|
expect(page).to have_content "Application update RIGHT NOW"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I remove an existing broadcast message' do
|
|
|
|
click_link 'Remove'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see the removed broadcast message' do
|
|
|
|
expect(page).not_to have_content 'Migration to new server'
|
|
|
|
end
|
2016-04-02 18:10:28 +05:30
|
|
|
|
|
|
|
step 'I enter a broadcast message with Markdown' do
|
|
|
|
fill_in 'broadcast_message_message', with: "Live **Markdown** previews. :tada:"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see a live preview of the rendered broadcast message' do
|
|
|
|
page.within('.broadcast-message-preview') do
|
|
|
|
expect(page).to have_selector('strong', text: 'Markdown')
|
|
|
|
expect(page).to have_selector('img.emoji')
|
|
|
|
end
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|