-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a new form for capturing the logic around adding a new qualification to ensure we can add validation correctly.
- Loading branch information
1 parent
0b4c4bf
commit 87ba13a
Showing
14 changed files
with
108 additions
and
73 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
11 changes: 11 additions & 0 deletions
11
app/forms/teacher_interface/add_another_qualification_form.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,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module TeacherInterface | ||
class AddAnotherQualificationForm < BaseForm | ||
attribute :add_another, :boolean | ||
validates :add_another, inclusion: { in: [true, false] } | ||
|
||
def update_model | ||
end | ||
end | ||
end |
6 changes: 3 additions & 3 deletions
6
app/views/teacher_interface/qualifications/add_another.html.erb
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
2 changes: 1 addition & 1 deletion
2
app/views/teacher_interface/work_histories/add_another.html.erb
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
9 changes: 9 additions & 0 deletions
9
spec/forms/teacher_interface/add_another_qualification_form_spec.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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe TeacherInterface::AddAnotherQualificationForm, type: :model do | ||
subject(:form) { described_class.new } | ||
|
||
it { is_expected.to allow_values(true, false).for(:add_another) } | ||
end |
30 changes: 30 additions & 0 deletions
30
spec/support/autoload/page_objects/teacher_interface/add_another.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,30 @@ | ||
# frozen_string_literal: true | ||
|
||
module PageObjects | ||
module TeacherInterface | ||
class AddAnother < SitePrism::Page | ||
element :heading, "h1" | ||
|
||
section :form, "form" do | ||
section :true_radio_item, | ||
PageObjects::GovukRadioItem, | ||
".govuk-radios__item:nth-of-type(1)" | ||
section :false_radio_item, | ||
PageObjects::GovukRadioItem, | ||
".govuk-radios__item:nth-of-type(2)" | ||
|
||
element :submit_button, ".govuk-button:not(.govuk-button--secondary)" | ||
end | ||
|
||
def submit_yes | ||
form.true_radio_item.choose | ||
form.submit_button.click | ||
end | ||
|
||
def submit_no | ||
form.false_radio_item.choose | ||
form.submit_button.click | ||
end | ||
end | ||
end | ||
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
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