-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create feature tests for social media accounts
There were none already so i've had to create them I've borrowed pretty heavily from when we did the worldwide org work!
- Loading branch information
1 parent
75dfb28
commit 47bdf90
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Feature: Topical events | ||
Scenario Outline: Adding a social media account to an editionable topical event | ||
Given a social media service "Facebook" exists | ||
Given a topical event called "Test editionable topical event" with summary "A topical event" and description "A topical event" | ||
And I edit the editionable topical event "Test editionable topical event" adding the social media service of "Facebook" with title "Our Facebook page" at URL "https://www.social.gov.uk" | ||
Then I should see the "Our Facebook page" social media site has been assigned to the editionable topical event "Test editionable topical event" | ||
|
||
Scenario Outline: Editing a social media account to an editionable topical event | ||
Given a social media service "Facebook" exists | ||
Given a topical event called "Test editionable topical event" with summary "A topical event" and description "A topical event" | ||
And I edit the editionable topical event "Test editionable topical event" adding the social media service of "Facebook" with title "Our Facebook page" at URL "https://www.social.gov.uk" | ||
And I edit the editionable topical event "Test editionable topical event" changing the social media account with title "Our Facebook page" to "Our new Facebook page" | ||
Then I should see the "Our new Facebook page" social media site has been assigned to the editionable topical event "Test editionable topical event" | ||
|
||
Scenario Outline: Deleting a social media account assigned to an editionable topical event | ||
Given a social media service "Facebook" exists | ||
Given a topical event called "Test editionable topical event" with summary "A topical event" and description "A topical event" | ||
And I edit the editionable topical event "Test editionable topical event" adding the social media service of "Facebook" with title "Our Facebook page" at URL "https://www.social.gov.uk" | ||
And I edit the editionable topical event "Test editionable topical event" deleting the social media account with title "Our Facebook page" | ||
Then I should see the editionable topical event "Test editionable topical event" has no social media accounts |
34 changes: 34 additions & 0 deletions
34
features/step_definitions/editionable_topical_events_steps.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
And(/^I edit the topical event "([^"]*)" adding the social media service of "([^"]*)" with title "([^"]*)" at URL "([^"]*)"$/) do |title, social_media_service_name, social_media_title, social_media_url| | ||
begin_editing_document(title) | ||
click_link "Social media accounts" | ||
click_link "Add new social media account" | ||
select social_media_service_name, from: "Service (required)" | ||
fill_in "URL (required)", with: social_media_url | ||
fill_in "Title", with: social_media_title | ||
click_button "Save" | ||
end | ||
|
||
And(/^I edit the topical event "([^"]*)" changing the social media account with title "([^"]*)" to "([^"]*)"$/) do |title, _old_social_media_title, new_social_media_title| | ||
begin_editing_document(title) | ||
click_link "Social media accounts" | ||
click_link "Edit" | ||
fill_in "Title", with: new_social_media_title | ||
click_button "Save" | ||
end | ||
|
||
And(/^I edit the topical event "([^"]*)" deleting the social media account with title "([^"]*)"$/) do |title, _social_media_title| | ||
begin_editing_document(title) | ||
click_link "Social media accounts" | ||
click_link "Delete" | ||
click_button "Delete" | ||
end | ||
|
||
Then(/^I should see the "([^"]*)" social media site has been assigned to the topical event "([^"]*)"$/) do |social_media_title, title| | ||
@topical_event = EditionableTopicalEvent.find_by(title:) | ||
expect(@topical_event.social_media_accounts.first.title).to eq(social_media_title) | ||
end | ||
|
||
Then(/^I should see the topical event "([^"]*)" has no social media accounts$/) do |title| | ||
@topical_event = EditionableTopicalEvent.find_by(title:) | ||
expect(@topical_event.social_media_accounts).to be_empty | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters