Commit 3397361fd7aeec711167c40b3fbab1e05a53b73d
1 parent
13a66040
Exists in
master
and in
4 other branches
Spinach test for broadcast messages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
40 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
| 1 | +Feature: Admin Broadcast Messages | ||
| 2 | + Background: | ||
| 3 | + Given I sign in as an admin | ||
| 4 | + And application already has admin messages | ||
| 5 | + And I visit admin messages page | ||
| 6 | + | ||
| 7 | + Scenario: See broadcast messages list | ||
| 8 | + Then I should be all broadcast messages | ||
| 9 | + | ||
| 10 | + Scenario: Create a broadcast message | ||
| 11 | + When submit form with new broadcast message | ||
| 12 | + Then I should be redirected to admin messages page | ||
| 13 | + And I should see newly created broadcast message |
| @@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
| 1 | +class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps | ||
| 2 | + include SharedAuthentication | ||
| 3 | + include SharedPaths | ||
| 4 | + include SharedAdmin | ||
| 5 | + | ||
| 6 | + step 'application already has admin messages' do | ||
| 7 | + FactoryGirl.create(:broadcast_message, message: "Migration to new server") | ||
| 8 | + end | ||
| 9 | + | ||
| 10 | + step 'I should be all broadcast messages' do | ||
| 11 | + page.should have_content "Migration to new server" | ||
| 12 | + end | ||
| 13 | + | ||
| 14 | + step 'submit form with new broadcast message' do | ||
| 15 | + fill_in 'broadcast_message_message', with: 'Application update from 4:00 CST to 5:00 CST' | ||
| 16 | + select '2018', from: "broadcast_message_ends_at_1i" | ||
| 17 | + click_button "Add broadcast message" | ||
| 18 | + end | ||
| 19 | + | ||
| 20 | + step 'I should be redirected to admin messages page' do | ||
| 21 | + current_path.should == admin_broadcast_messages_path | ||
| 22 | + end | ||
| 23 | + | ||
| 24 | + step 'I should see newly created broadcast message' do | ||
| 25 | + page.should have_content 'Application update from 4:00 CST to 5:00 CST' | ||
| 26 | + end | ||
| 27 | +end |