Commit 540ae3c3 authored by Robert Speicher's avatar Robert Speicher

Update Broadcast Message features

- Removes redundant "Create a broadcast message" scenario that was
  entirely covered by the "Create a customized broadcast message"
  scenario.
- Adds "Edit an existing broadcast message" scenario
- Adds "Remove an existing broadcast message" scenario
parent df496fca
...@@ -2,20 +2,26 @@ ...@@ -2,20 +2,26 @@
Feature: Admin Broadcast Messages Feature: Admin Broadcast Messages
Background: Background:
Given I sign in as an admin Given I sign in as an admin
And application already has admin messages And application already has a broadcast message
And I visit admin messages page And I visit admin messages page
Scenario: See broadcast messages list Scenario: See broadcast messages list
Then I should see all broadcast messages Then I should see all broadcast messages
Scenario: Create a broadcast message
When submit form with new broadcast message
Then I should be redirected to admin messages page
And I should see newly created broadcast message
Scenario: Create a customized broadcast message Scenario: Create a customized broadcast message
When submit form with new customized broadcast message When submit form with new customized broadcast message
Then I should be redirected to admin messages page Then I should be redirected to admin messages page
And I should see newly created broadcast message And I should see newly created broadcast message
Then I visit dashboard page Then I visit dashboard page
And I should see a customized broadcast message And I should see a customized broadcast message
Scenario: Edit an existing broadcast message
When I edit an existing broadcast message
And I change the broadcast message text
Then I should be redirected to admin messages page
And I should see the updated broadcast message
Scenario: Remove an existing broadcast message
When I remove an existing broadcast message
Then I should be redirected to admin messages page
And I should not see the removed broadcast message
class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
include SharedPaths include SharedPaths
include SharedAdmin
step 'application already has admin messages' do step 'application already has a broadcast message' do
FactoryGirl.create(:broadcast_message, :expired, message: "Migration to new server") FactoryGirl.create(:broadcast_message, :expired, message: "Migration to new server")
end end
...@@ -11,12 +10,6 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps ...@@ -11,12 +10,6 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps
expect(page).to have_content "Migration to new server" expect(page).to have_content "Migration to new server"
end end
step 'submit form with new broadcast message' do
fill_in 'broadcast_message_message', with: 'Application update from 4:00 CST to 5:00 CST'
select '2018', from: "broadcast_message_ends_at_1i"
click_button "Add broadcast message"
end
step 'I should be redirected to admin messages page' do step 'I should be redirected to admin messages page' do
expect(current_path).to eq admin_broadcast_messages_path expect(current_path).to eq admin_broadcast_messages_path
end end
...@@ -37,4 +30,25 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps ...@@ -37,4 +30,25 @@ class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST' expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
expect(page).to have_selector %(div[style="background-color: #f2dede; color: #b94a48"]) expect(page).to have_selector %(div[style="background-color: #f2dede; color: #b94a48"])
end end
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
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment