VRFS-2136 added tests
This commit is contained in:
parent
4bdcf103ce
commit
a47ffea5ad
|
|
@ -132,4 +132,27 @@ describe Band do
|
|||
band_in_austin.lng.should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "recent history" do
|
||||
it "should only retrieve recordings with a claimed recording" do
|
||||
user = FactoryGirl.create(:user)
|
||||
band = FactoryGirl.create(:band)
|
||||
band.users << user
|
||||
band.save!
|
||||
|
||||
claimed_recording = FactoryGirl.create(:claimed_recording, :user => user)
|
||||
claimed_recording.recording.owner = user
|
||||
claimed_recording.recording.band = band
|
||||
claimed_recording.recording.save!
|
||||
|
||||
recording = FactoryGirl.create(:recording, :owner => user, :band => band)
|
||||
|
||||
Recording.where(:owner_id => user.id).size.should == 2
|
||||
Recording.where(:band_id => band.id).size.should == 2
|
||||
|
||||
history = band.recent_history
|
||||
history.size.should == 1
|
||||
history.first.id.should == claimed_recording.recording.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -569,6 +569,24 @@ describe User do
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
describe "recent history" do
|
||||
it "should only retrieve recordings with a claimed recording" do
|
||||
user = FactoryGirl.create(:user)
|
||||
claimed_recording = FactoryGirl.create(:claimed_recording, :user => user)
|
||||
claimed_recording.recording.owner = user
|
||||
claimed_recording.recording.save!
|
||||
|
||||
recording = FactoryGirl.create(:recording, :owner => user)
|
||||
|
||||
Recording.where(:owner_id => user.id).size.should == 2
|
||||
|
||||
history = user.recent_history
|
||||
history.size.should == 1
|
||||
history.first.id.should == claimed_recording.recording.id
|
||||
end
|
||||
end
|
||||
|
||||
=begin
|
||||
describe "update avatar" do
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue