2015-02-12 03:33:10 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
|
|
describe PerformanceSample do
|
|
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
shared_examples_for :performance_sample_specs do
|
|
|
|
|
let(:claimed_recording) { FactoryGirl.create(:claimed_recording) }
|
2015-02-12 03:33:10 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
describe "index" do
|
2015-02-12 03:33:10 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
before(:all) do
|
|
|
|
|
PerformanceSample.delete_all
|
2015-02-12 03:33:10 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
@player1_sample1 = PerformanceSample.new(:player_id => player1.id, :service_type => "jamkazam", :claimed_recording_id => claimed_recording.id)
|
|
|
|
|
@player1_sample1.save!
|
2015-02-12 03:33:10 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
@player1_sample2 = PerformanceSample.new(:player_id => player1.id, :service_type => "youtube", :service_id => "12345")
|
|
|
|
|
@player1_sample2.save!
|
2015-02-12 03:33:10 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
@player2_sample1 = PerformanceSample.new(:player_id => player2.id, :service_type => "soundcloud", :service_id => "67890")
|
|
|
|
|
@player2_sample1.save!
|
2015-02-12 03:33:10 +00:00
|
|
|
end
|
|
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
context "when request is valid" do
|
|
|
|
|
it "should return all records for user" do
|
|
|
|
|
sample = PerformanceSample.index({:id => player1.id})
|
|
|
|
|
sample.count.should == 2
|
2015-02-12 03:33:10 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
sample = PerformanceSample.index({:id => player2.id})
|
|
|
|
|
sample.count.should == 1
|
|
|
|
|
end
|
2015-02-12 03:33:10 +00:00
|
|
|
end
|
|
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
context "when request is invalid" do
|
|
|
|
|
it "should raise error when options are missing" do
|
|
|
|
|
lambda{PerformanceSample.index}.should raise_error(JamArgumentError)
|
|
|
|
|
end
|
2015-02-13 06:32:55 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
it "should raise error when user id is missing" do
|
|
|
|
|
lambda{PerformanceSample.index({:id => ""})}.should raise_error(JamArgumentError)
|
|
|
|
|
end
|
|
|
|
|
end
|
2015-02-13 06:32:55 +00:00
|
|
|
end
|
|
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
describe "create" do
|
2015-02-12 03:33:10 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
before(:all) do
|
|
|
|
|
PerformanceSample.delete_all
|
2015-02-12 03:33:10 +00:00
|
|
|
end
|
|
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
context "when request is valid" do
|
|
|
|
|
it "should save successfully" do
|
|
|
|
|
PerformanceSample.create(player1, {:player_id => player1.id, :service_type => "youtube", :service_id => "12345"})
|
2015-02-12 03:33:10 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
# make sure we can save a second PerformanceSample for same user and type
|
|
|
|
|
PerformanceSample.create(player1, {:player_id => player1.id, :service_type => "youtube", :service_id => "67890"})
|
|
|
|
|
end
|
2015-02-13 06:32:55 +00:00
|
|
|
end
|
|
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
context "when request is not valid" do
|
|
|
|
|
it "should raise JamPermissionError if requester id does not match id in request" do
|
|
|
|
|
lambda{PerformanceSample.create(player1, {:player_id => player2.id, :service_type => "soundcloud", :service_id => "12345"})}.should raise_error(JamPermissionError)
|
|
|
|
|
end
|
2015-02-13 06:32:55 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
it "should raise error if service type is missing" do
|
|
|
|
|
lambda{PerformanceSample.create(player1, {:player_id => player1.id, :service_id => "12345"})}.should raise_error(StateError)
|
|
|
|
|
end
|
2015-02-12 03:33:10 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
it "should raise error if service id is missing for non-JamKazam sample" do
|
|
|
|
|
lambda{PerformanceSample.create(player1, {:player_id => player1.id, :service_type => "youtube"})}.should raise_error(StateError)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "should raise error if recording id is missing for JamKazam sample" do
|
|
|
|
|
lambda{PerformanceSample.create(player1, {:player_id => player1.id, :service_type => "jamkazam"})}.should raise_error(StateError)
|
|
|
|
|
end
|
2015-02-13 06:32:55 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
it "should not allow duplicate type/service id combination for non-JamKazam sample" do
|
|
|
|
|
PerformanceSample.create(player1, {:player_id => player1.id, :service_type => "youtube", :service_id => "12345"})
|
|
|
|
|
lambda{PerformanceSample.create(player1, {:player_id => player1.id, :service_type => "youtube", :service_id => "12345"})}.should raise_error(ConflictError)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "should not allow duplicate type/recording id combination for JamKazam sample" do
|
|
|
|
|
PerformanceSample.create(player1, {:player_id => player1.id, :service_type => "jamkazam", :claimed_recording_id => claimed_recording.id})
|
|
|
|
|
lambda{PerformanceSample.create(player1, {:player_id => player1.id, :service_type => "jamkazam", :claimed_recording_id => claimed_recording.id})}.should raise_error(ConflictError)
|
|
|
|
|
end
|
2015-02-13 06:32:55 +00:00
|
|
|
end
|
2015-02-12 03:33:10 +00:00
|
|
|
end
|
|
|
|
|
|
2015-02-13 06:32:55 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
describe "destroy" do
|
2015-02-13 06:32:55 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
before(:all) do
|
|
|
|
|
PerformanceSample.delete_all
|
|
|
|
|
@user_sample = PerformanceSample.new(:player_id => player1.id, :service_type => "soundcloud", :service_id => "12345")
|
|
|
|
|
@user_sample.save!
|
|
|
|
|
end
|
2015-02-13 06:32:55 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
context "when request is valid" do
|
|
|
|
|
it "should destroy successfully" do
|
|
|
|
|
ps_list = PerformanceSample.index({:id => player1.id})
|
|
|
|
|
ps_list.count.should == 1
|
|
|
|
|
ps_list.first.service_type.should == "soundcloud"
|
|
|
|
|
ps_list.first.service_id.should == "12345"
|
2015-02-13 06:32:55 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
PerformanceSample.delete(player1, {:player_id => player1.id, :id => @user_sample.id})
|
2015-02-13 06:32:55 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
ps_list = PerformanceSample.index({:id => player1.id})
|
|
|
|
|
ps_list.count.should == 0
|
|
|
|
|
end
|
2015-02-13 06:32:55 +00:00
|
|
|
end
|
|
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
context "when request is not valid" do
|
|
|
|
|
it "should raise JamPermissionError if requester id does not match id in request" do
|
|
|
|
|
lambda{PerformanceSample.delete(player2, {:player_id => player1.id, :id => @user_sample.id})}.should raise_error(JamPermissionError)
|
|
|
|
|
end
|
2015-02-13 06:32:55 +00:00
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
it "should raise error if user sample id is missing" do
|
|
|
|
|
lambda{PerformanceSample.delete(player1, {:player_id => player1.id})}.should raise_error(StateError)
|
|
|
|
|
end
|
2015-02-13 06:32:55 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
|
|
|
|
|
describe "with a user" do
|
|
|
|
|
it_should_behave_like :performance_sample_specs do
|
|
|
|
|
let(:player1) { FactoryGirl.create(:user) }
|
|
|
|
|
let(:player2) { FactoryGirl.create(:user) }
|
|
|
|
|
end
|
2015-07-15 19:57:24 +00:00
|
|
|
|
|
|
|
|
after(:all) {
|
2015-07-15 20:13:44 +00:00
|
|
|
User.delete_all
|
|
|
|
|
RecordedTrack.delete_all
|
|
|
|
|
ClaimedRecording.delete_all
|
|
|
|
|
Recording.delete_all
|
|
|
|
|
ActiveMusicSession.delete_all
|
|
|
|
|
MusicSession.delete_all
|
2015-07-15 19:57:24 +00:00
|
|
|
}
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "with a band" do
|
|
|
|
|
it_should_behave_like :performance_sample_specs do
|
|
|
|
|
let(:player1) { FactoryGirl.create(:band) }
|
|
|
|
|
let(:player2) { FactoryGirl.create(:band) }
|
|
|
|
|
end
|
2015-07-15 19:57:24 +00:00
|
|
|
|
|
|
|
|
after(:all) {
|
|
|
|
|
Band.delete_all
|
2015-07-15 20:13:44 +00:00
|
|
|
RecordedTrack.delete_all
|
|
|
|
|
ClaimedRecording.delete_all
|
|
|
|
|
Recording.delete_all
|
|
|
|
|
ActiveMusicSession.delete_all
|
|
|
|
|
MusicSession.delete_all
|
2015-07-15 19:57:24 +00:00
|
|
|
}
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
end
|
2015-02-12 03:33:10 +00:00
|
|
|
end
|