Adds user.verified_organization?
This commit is contained in:
@@ -47,6 +47,10 @@ class User < ActiveRecord::Base
|
|||||||
organization.present?
|
organization.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def verified_organization?
|
||||||
|
organization && organization.verified?
|
||||||
|
end
|
||||||
|
|
||||||
def official?
|
def official?
|
||||||
official_level && official_level > 0
|
official_level && official_level > 0
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -125,6 +125,25 @@ describe User do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "verified_organization?" do
|
||||||
|
it "is falsy when the user is not an organization" do
|
||||||
|
expect(subject).to_not be_verified_organization
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'when it is an organization' do
|
||||||
|
before(:each) { create(:organization, user: subject) }
|
||||||
|
|
||||||
|
it "is false when the user is not a verified organization" do
|
||||||
|
expect(subject).to_not be_verified_organization
|
||||||
|
end
|
||||||
|
|
||||||
|
it "is true when the user is a verified organization" do
|
||||||
|
subject.organization.verify
|
||||||
|
expect(subject).to be_verified_organization
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "organization_attributes" do
|
describe "organization_attributes" do
|
||||||
before(:each) { subject.organization_attributes = {name: 'org'} }
|
before(:each) { subject.organization_attributes = {name: 'org'} }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user