Skip to content

Commit

Permalink
basic caoch implemetation with test
Browse files Browse the repository at this point in the history
  • Loading branch information
radscheit committed Nov 24, 2016
1 parent 2ce699c commit f50f0cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/user.rb
Expand Up @@ -26,7 +26,7 @@ class User < ActiveRecord::Base

before_create :set_default_role

ROLES = %i[pupil tutor organizer admin]
ROLES = %i[pupil tutor organizer admin coach]

def role?(base_role)
return false unless role
Expand Down
6 changes: 6 additions & 0 deletions spec/models/user_spec.rb
Expand Up @@ -31,4 +31,10 @@
user = FactoryGirl.build(:user, email: nil)
expect(user).to_not be_valid
end

it "is created by user factory with the role coach" do
user = FactoryGirl.create(:user, role: "coach")
expect(user).to be_valid
end

end

0 comments on commit f50f0cf

Please sign in to comment.