minor update
This commit is contained in:
parent
33c3a54d12
commit
a3e93a208d
|
|
@ -64,6 +64,16 @@ module JamRuby
|
|||
music_session.save
|
||||
end
|
||||
|
||||
|
||||
# FIXME:
|
||||
# NEED TO SEND NOTIFICATION TO ALL USERS IN THE SESSION THAT RECORDING HAS STARTED HERE.
|
||||
# I'LL STUB IT A BIT. NOTE THAT I REDO THE FIND HERE BECAUSE I DON'T WANT TO SEND THESE
|
||||
# NOTIFICATIONS WHILE THE DB ROW IS LOCKED
|
||||
music_session = MusicSession.find(music_session_id)
|
||||
music_session.connections.each do |connection|
|
||||
# connection.notify_recording_has_started
|
||||
end
|
||||
|
||||
recording
|
||||
end
|
||||
|
||||
|
|
@ -82,6 +92,19 @@ module JamRuby
|
|||
music_session.save
|
||||
end
|
||||
end
|
||||
|
||||
# Update the metadata for the recording
|
||||
def update(description, genres)
|
||||
self.description = description unless description.nil?
|
||||
unless genres.nil?
|
||||
self.genres = []
|
||||
genres.each do |genre_id|
|
||||
g = Genre.find(genre_id)
|
||||
self.genres << g
|
||||
end
|
||||
end
|
||||
save
|
||||
end
|
||||
|
||||
def self.search(query, options = { :limit => 10 })
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,30 @@ describe Recording do
|
|||
expect { @recording.stop }.to raise_error
|
||||
end
|
||||
|
||||
it "should be able to start, stop then start a recording again for the same music session" do
|
||||
@recording = Recording.start(@music_session.id, @user, "Description")
|
||||
@recording.stop
|
||||
@recording2 = Recording.start(@music_session.id, @user, "Description 2")
|
||||
@music_session.recording.should == @recording2
|
||||
end
|
||||
|
||||
it "should attach the recording to all users in a the music session when recording started" do
|
||||
@user2 = FactoryGirl.create(:user)
|
||||
@connection2 = FactoryGirl.create(:connection, :user => @user2)
|
||||
@instrument2 = FactoryGirl.create(:instrument, :description => 'a great instrument')
|
||||
@track2 = FactoryGirl.create(:track, :connection => @connection2, :instrument => @instrument2)
|
||||
|
||||
@music_session.connections << @connection2
|
||||
|
||||
@recording = Recording.start(@music_session.id, @user, "Description")
|
||||
@user.recordings.length.should == 1
|
||||
@user.recordings.first.should == @recording
|
||||
|
||||
@user2.recordings.length.should == 1
|
||||
@user2.recordings.first.should == @recording
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue