File tree Expand file tree Collapse file tree 2 files changed +0
-17
lines changed Expand file tree Collapse file tree 2 files changed +0
-17
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,4 @@ class WorkshopSponsor < ApplicationRecord
33 belongs_to :workshop
44
55 validates :sponsor_id , uniqueness : { scope : :workshop_id , message : :already_sponsoring }
6-
7- scope :hosts , -> { where ( 'workshop_sponsors.host = ?' , true ) }
8- scope :for_workshop , -> ( workshop_id ) { where ( 'workshop_sponsors.workshop_id = ?' , workshop_id ) }
96end
Original file line number Diff line number Diff line change 66 . with_message ( 'already a sponsor' )
77 end
88 end
9-
10- context '#scopes' do
11- context '#hosts' do
12- it 'includes workshops with hosts' do
13- workshop_sponsor = Fabricate ( :workshop_sponsor , host : true )
14-
15- expect ( WorkshopSponsor . hosts ) . to include ( workshop_sponsor )
16- end
17-
18- it 'excludes workshops without hosts' do
19- expect ( WorkshopSponsor . hosts ) . to eq [ ]
20- end
21- end
22- end
239end
You can’t perform that action at this time.
0 commit comments