-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from alphagov/ensure-user-chooses-a-format
Ensure user chooses supertype / document type
- Loading branch information
Showing
5 changed files
with
57 additions
and
7 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
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
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
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
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,36 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
RSpec.feature "Choosing a format" do | ||
scenario "User forgets to choose a format" do | ||
when_i_dont_choose_a_supertype | ||
then_i_see_a_supertype_error | ||
when_i_choose_a_supertype | ||
and_i_dont_choose_a_document_type | ||
then_i_see_a_document_type_error | ||
end | ||
|
||
def when_i_dont_choose_a_supertype | ||
visit "/" | ||
click_on "New document" | ||
click_on "Continue" | ||
end | ||
|
||
def then_i_see_a_supertype_error | ||
expect(page).to have_content "Please choose a supertype" | ||
end | ||
|
||
def when_i_choose_a_supertype | ||
choose SupertypeSchema.all.reject(&:managed_elsewhere).map(&:label).sample | ||
click_on "Continue" | ||
end | ||
|
||
def and_i_dont_choose_a_document_type | ||
click_on "Continue" | ||
end | ||
|
||
def then_i_see_a_document_type_error | ||
expect(page).to have_content "Please choose a document type" | ||
end | ||
end |