We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 578e335 commit 1d0dbeaCopy full SHA for 1d0dbea
spec/system/judges/new_spec.rb
@@ -62,6 +62,21 @@
62
end
63
# rubocop:enable RSpec/ExampleLength
64
65
+ context "when validations fail" do
66
+ it "shows validation error when name is blank" do
67
+ submit_judge_form(name: "")
68
+ expect(page).to have_text("Name can't be blank")
69
+ end
70
+
71
+ it "does not allow duplicate judge names in the same organization", :aggregate_failures do
72
+ duplicate_name = Faker::Name.unique.name
73
+ create(:judge, name: duplicate_name, casa_org: organization)
74
+ submit_judge_form(name: duplicate_name)
75
+ expect(page).to have_text("Name has already been taken")
76
+ expect(Judge.where(name: duplicate_name, casa_org: organization).count).to eq 1
77
78
79
80
private
81
82
def submit_judge_form(name:, active: true)
0 commit comments