Created
May 21, 2009 02:40
-
-
Save elomar/115233 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require File.dirname(__FILE__) + '/../spec_helper' | |
| describe Event do | |
| it { should belong_to(:organizer, :class_name => "User") } | |
| it { should have_many(:registrations) } | |
| it { should have_many(:users, :through => :registrations) } | |
| it { should have_many(:promocodes)} | |
| it { should validate_presence_of(:title, :location, :description, :start_at, :finish_at)} | |
| it { should validate_numericality_of(:price, :allow_nil => true)} | |
| describe 'confirmed users' do | |
| it 'should return confirmed users' do | |
| event = Event.make(:free) | |
| user = User.make | |
| Registration.make(:event => event, :user => user) | |
| event.confirmed_users.should == [user] | |
| end | |
| it 'should not return pending users' do | |
| event = Event.make(:paid) | |
| Registration.make(:event => event, :user => User.make) | |
| event.confirmed_users.should == [] | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment