Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions spec/models/concerns/by_organization_scope_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
require "rails_helper"

RSpec.describe ByOrganizationScope, type: :model do
# TODO: Add tests for ByOrganizationScope
describe ".by_organization" do
let(:casa_org) { create(:casa_org) }
let(:other_casa_org) { create(:casa_org) }

pending "add some tests for ByOrganizationScope"
let!(:casa_case_in_org) { create(:casa_case, casa_org: casa_org) }
let!(:casa_case_in_other_org) { create(:casa_case, casa_org: other_casa_org) }

it "returns only the records belonging to the given organization" do
expect(CasaCase.by_organization(casa_org)).to contain_exactly(casa_case_in_org)
end

it "returns no records for an organization without records" do
empty_casa_org = create(:casa_org)

expect(CasaCase.by_organization(empty_casa_org)).to be_empty
end
end
end
12 changes: 10 additions & 2 deletions spec/models/concerns/roles_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
require "rails_helper"

RSpec.describe Roles, type: :model do
# TODO: Add tests for Roles
describe "#role" do
it "returns the titleized model name for each user type" do
expect(build(:volunteer).role).to eq "Volunteer"
expect(build(:supervisor).role).to eq "Supervisor"
expect(build(:casa_admin).role).to eq "Casa Admin"
end

pending "add some tests for Roles"
it "returns the titleized model name for an all casa admin" do
expect(build(:all_casa_admin).role).to eq "All Casa Admin"
end
end
end
Loading