Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sandfortw committed Aug 9, 2023
1 parent 82339ac commit b864587
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/models/case_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class CaseGroup < ApplicationRecord
has_many :case_group_memberships
has_many :casa_cases, through: :case_group_memberships

validates :name, uniqueness: { scope: :casa_org }
validates :name, uniqueness: {scope: :casa_org}
validates_presence_of :case_group_memberships
end

Expand Down
17 changes: 8 additions & 9 deletions spec/models/case_group_spec.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
require "rails_helper"

RSpec.describe CaseGroup, type: :model do

describe 'validations' do
describe "validations" do
it { should validate_presence_of(:case_group_memberships) }

it 'validates uniqueness of name scoped to casa_org' do
it "validates uniqueness of name scoped to casa_org" do
casa_org = create(:casa_org)
create(:case_group, casa_org: casa_org, name: 'The Johnson Family')
non_uniq_case_group = build(:case_group, casa_org: casa_org, name: 'The Johnson Family')
create(:case_group, casa_org: casa_org, name: "The Johnson Family")
non_uniq_case_group = build(:case_group, casa_org: casa_org, name: "The Johnson Family")

expect(non_uniq_case_group).to_not be_valid
expect(non_uniq_case_group.errors[:name]).to include('has already been taken')
end
expect(non_uniq_case_group.errors[:name]).to include("has already been taken")
end
end

describe 'relationships' do
describe "relationships" do
it { should have_many(:case_group_memberships) }
it { should have_many(:casa_cases).through(:case_group_memberships) }
end
Expand Down
2 changes: 1 addition & 1 deletion spec/system/case_groups/case_groups_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
fill_in "Name", with: "A family"
select casa_case.case_number, from: "Cases"
click_on "Submit"

expect(page).to have_text("Name has already been taken")

visit case_groups_path
Expand Down

0 comments on commit b864587

Please sign in to comment.