created comments with FactoryGirl
This commit is contained in:
parent
b6d726d40e
commit
eab2894fad
5 changed files with 17 additions and 3 deletions
9
spec/factories/comments.rb
Normal file
9
spec/factories/comments.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :comment do
|
||||
body 'Most interresting comment ever, created by a girl.'
|
||||
user
|
||||
association :commentable, factory: :event
|
||||
end
|
||||
end
|
||||
|
|
@ -47,6 +47,7 @@ FactoryGirl.define do
|
|||
event.difficulty_level = build(:difficulty_level, conference: event.conference)
|
||||
event.track = build(:track, conference: event.conference)
|
||||
event.room = build(:room, conference: event.conference)
|
||||
event.comment_threads << build(:comment, commentable: event)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ describe 'User' do
|
|||
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it{ should be_able_to(:manage, event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it{ should be_able_to([:read, :create], event.comment_threads.first) }
|
||||
end
|
||||
|
||||
context 'when user has the role cfp' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue