* fixing feed_spec

This commit is contained in:
Seth Call 2015-07-17 07:18:27 -05:00
parent fbc6c0517c
commit c5033435f2
7 changed files with 48 additions and 27 deletions

View File

@ -10,14 +10,8 @@ module JamRuby
attr_accessible :max_concurrent_connections, :session_removed_at, :rating
validates_inclusion_of :rating, :in => -1..1, :allow_nil => true
belongs_to(:user,
:class_name => "JamRuby::User",
:foreign_key => "user_id",
:inverse_of => :music_session_user_histories)
belongs_to(:music_session,
:class_name => "MusicSession",
:foreign_key => "music_session_id")
belongs_to :user, :class_name => "JamRuby::User", :foreign_key => "user_id", :inverse_of => :music_session_user_histories
belongs_to :music_session, :class_name => "MusicSession", :foreign_key => "music_session_id"
def self.latest_history(client_id)
self.where(:client_id => client_id)

View File

@ -236,6 +236,9 @@ describe Sale do
sale_line_item.recurly_adjustment_credit_uuid.should be_nil
sale_line_item.recurly_adjustment_uuid.should eq(user.jam_track_rights.last.recurly_adjustment_uuid)
# sometimes recurly won't mark it 'collected' immediately
sleep 1
# verify subscription is in Recurly
recurly_account = client.get_account(user)
adjustments = recurly_account.adjustments

View File

@ -93,15 +93,24 @@
// $("#spnCommentCount").html(parseInt($("#spnCommentCount").text()) + 1);
renderComment(comment, context.JK.currentUserId, context.JK.currentUserName,
context.JK.currentUserAvatarUrl, $.timeago(Date.now()), context.JK.currentUserMusician, false);
});
})
.fail(function(jqXHR) {
logger.error("unable to add recording comment: " + jqXHR.responseText)
app.notify({text: 'unable to add comment, please try again later.'})
})
}
else if (entityType === 'recording') {
logger.debug("recording comment logged! " + comment)
rest.addRecordingComment(recordingId, JK.currentUserId, comment)
.done(function(response) {
// $("#spnCommentCount", $scope).html(parseInt($("#spnCommentCount").text()) + 1);
renderComment(comment, context.JK.currentUserId, context.JK.currentUserName,
context.JK.currentUserAvatarUrl, $.timeago(Date.now()), context.JK.currentUserMusician, false);
});
})
.fail(function(jqXHR) {
logger.error("unable to add recording comment: " + jqXHR.responseText)
app.notify({text: 'unable to add comment, please try again later.'})
})
}
}
}

View File

@ -141,9 +141,9 @@
downloadUris[platform] = item.uri;
});
})
.fail(function() {
.fail(function(jqXHR) {
removeSpinner();
alert("Currently unable to list client software downloads due to error.");
context.JK.app.notify({text: "Currently unable to list client software downloads due to error."});
})
.always(function() {
selectPlatform(currentOS == null ? 'Win32' : currentOS);

View File

@ -96,7 +96,7 @@ FactoryGirl.define do
factory :user_two_instruments do
before(:create) do |user|
user.musician_instruments << FactoryGirl.create(:musician_instrument, user: user, instrument: JamRuby::Instrument.find('drums'), proficiency_level: 2, priority:1 )
user.musician_instruments << FactoryGirl.create(:musician_instrument, player: user, instrument: JamRuby::Instrument.find('drums'), proficiency_level: 2, priority:1 )
end
end

View File

@ -2,10 +2,11 @@ require 'spec_helper'
describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
let (:user) { FactoryGirl.create(:user) }
let (:user) { FactoryGirl.create(:user_two_instruments) }
before(:each) do
MusicSession.delete_all
MusicSessionUserHistory.delete_all
Recording.delete_all
IcecastMount.delete_all
end
@ -29,8 +30,9 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
describe "sessions" do
before(:each) do
create_session(creator: user)
formal_leave_by(user)
@ams = FactoryGirl.create(:active_music_session, creator:user)
#create_session(creator: user)
#formal_leave_by(user)
end
# it "should render avatar" do
@ -58,7 +60,7 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
it "should render stats" do
visit "/client#/feed"
fast_signin user, "/client#/feed"
# initial stats
find('span.plays').should have_content('0')
@ -81,7 +83,17 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
end
it "should render details" do
visit "/client#/feed"
# for the 'total_instruments' query to work in the rabl, you have to have session_removed_at to be set on both
@ams.music_session.session_removed_at = Time.now
@ams.music_session.save!
MusicSessionUserHistory.count.should eq(1)
msuh = MusicSessionUserHistory.first
msuh.session_removed_at = Time.now
msuh.instruments = 'drums'
msuh.save!
fast_signin user, "/client#/feed"
find('.feed-details a.details').trigger(:click)
# confirm user avatar exists
@ -91,7 +103,7 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
find("a.musician-name[user-id=\"#{user.id}\"][hoveraction=\"musician\"]", text: user.name)
# confirm instrument icons exist
find("img[instrument-id=\"electric guitar\"]")
find("img[instrument-id=\"drums\"]")
# confirm hover bubbles show
find("a.avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"]").hover_intent
@ -122,10 +134,11 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
describe "recordings" do
before(:each) do
start_recording_with(user)
stop_recording
claim_recording("my recording", "my recording description")
formal_leave_by(user)
FactoryGirl.create(:claimed_recording, user: user, name: 'my recording', description: "my recording description")
#start_recording_with(user)
#stop_recording
#claim_recording("my recording", )
#formal_leave_by(user)
MusicSession.delete_all
end
@ -153,7 +166,9 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
# end
it "should render stats" do
visit "/client#/feed"
fast_signin user, "/client#/feed"
find('h1', text: 'feed')
# initial stats
find('span.plays').should have_content('0')
@ -179,7 +194,7 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
end
it "should render details" do
visit "/client#/feed"
fast_signin user, "/client#/feed"
find('.feed-details a.details').trigger(:click)
@ -190,7 +205,7 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
find("a.musician-name[user-id=\"#{user.id}\"][hoveraction=\"musician\"]", text: user.name)
# confirm instrument icons exist
find("img[instrument-id=\"electric guitar\"]")
find("img[instrument-id=\"acoustic guitar\"]")
# confirm hover bubbles show

View File

@ -103,7 +103,7 @@ describe "Session Recordings", :js => true, :type => :feature, :capybara_feature
end
end
# POPUP PROBLEMS
=begin
describe "mixing after the recording" do