* allowing tests to be skipped, and mostly done with VRFS-1200
This commit is contained in:
parent
1472944648
commit
f3c09f65c2
|
|
@ -1 +1,2 @@
|
|||
ALTER TABLE music_sessions_history ADD COLUMN fan_access BOOLEAN NOT NULL;
|
||||
|
||||
ALTER TABLE music_sessions_history ADD COLUMN fan_access BOOLEAN NOT NULL DEFAULT TRUE;
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
echo "updating dependencies"
|
||||
bundle install --path vendor/bundle
|
||||
|
||||
if [ -z $SKIP_TESTS ]; then
|
||||
echo "running rspec tests"
|
||||
bundle exec rspec
|
||||
|
||||
|
|
@ -12,6 +13,9 @@ else
|
|||
echo "tests failed."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "skipping tests"
|
||||
fi
|
||||
|
||||
echo "build complete"
|
||||
|
||||
|
|
|
|||
|
|
@ -9,5 +9,6 @@ module JamRuby
|
|||
belongs_to :claimed_recording, :class_name => "JamRuby::ClaimedRecording", :foreign_key => "claimed_recording_id"
|
||||
belongs_to :user, :class_name => "JamRuby::User", :foreign_key => "liker_id"
|
||||
|
||||
validates :favorite, :inclusion => {:in => [true, false]}
|
||||
end
|
||||
end
|
||||
|
|
@ -103,6 +103,16 @@
|
|||
});
|
||||
}
|
||||
|
||||
function updateFavorite(claimedRecordingId, favorite) {
|
||||
return $.ajax({
|
||||
url: '/api/favorites/' + claimedRecordingId,
|
||||
type: "POST",
|
||||
data : JSON.stringify({favorite: favorite}),
|
||||
dataType : 'json',
|
||||
contentType: 'application/json'
|
||||
});
|
||||
}
|
||||
|
||||
function validateBand(band) {
|
||||
return $.ajax({
|
||||
type: "POST",
|
||||
|
|
@ -906,6 +916,7 @@
|
|||
this.getBandPhotoFilepickerPolicy = getBandPhotoFilepickerPolicy;
|
||||
this.getBand = getBand;
|
||||
this.validateBand = validateBand;
|
||||
this.updateFavorite = updateFavorite;
|
||||
this.createBandInvitation = createBandInvitation;
|
||||
this.updateBandInvitation = updateBandInvitation;
|
||||
this.removeBandMember = removeBandMember;
|
||||
|
|
|
|||
|
|
@ -34,16 +34,16 @@ class ApiController < ApplicationController
|
|||
def respond_with_model(model, options = {})
|
||||
if model.errors.any?
|
||||
response.status = :unprocessable_entity
|
||||
respond_with model
|
||||
respond_with model, layout: nil
|
||||
else
|
||||
status = options[:new] && options[:new] == true ? 201 : 200
|
||||
redirect_on_success = options[:location]
|
||||
if redirect_on_success
|
||||
location = redirect_on_success.call
|
||||
raise "location must return something" unless location # development time error
|
||||
respond_with model, responder: ApiResponder, status: status, location: location
|
||||
respond_with model, responder: ApiResponder, status: status, location: location, layout: nil
|
||||
else
|
||||
respond_with model, responder: ApiResponder, status: status
|
||||
respond_with model, responder: ApiResponder, status: status, layout: nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,7 +15,12 @@ class ApiFavoritesController < ApiController
|
|||
render "api_favorites/index", :layout => nil
|
||||
end
|
||||
|
||||
def remove_favorite
|
||||
RecordingLiker.find_by_liker_id_and_claimed_recording_id(curren_user.id, params[:claimed_recording_id])
|
||||
def update
|
||||
id = params[:id]
|
||||
like = RecordingLiker.find_by_liker_id_and_claimed_recording_id!(current_user.id, id)
|
||||
like.favorite = params[:favorite] if params.has_key? :favorite
|
||||
like.save
|
||||
|
||||
respond_with_model(like)
|
||||
end
|
||||
end
|
||||
|
|
@ -348,6 +348,7 @@ SampleApp::Application.routes.draw do
|
|||
|
||||
# favorites
|
||||
match '/favorites' => 'api_favorites#index', :via => :get
|
||||
match '/favorites/:id' => 'api_favorites#update', :via => :post
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@ describe ApiFavoritesController do
|
|||
let(:claimed_recording) {FactoryGirl.create(:claimed_recording) }
|
||||
|
||||
before(:each) do
|
||||
RecordingLiker.delete_all
|
||||
ClaimedRecording.delete_all
|
||||
controller.current_user = nil
|
||||
end
|
||||
|
||||
|
||||
describe "index" do
|
||||
it "insists on login" do
|
||||
get :index
|
||||
response.status.should == 403
|
||||
|
|
@ -46,3 +48,21 @@ describe ApiFavoritesController do
|
|||
json[:since].should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe "update" do
|
||||
|
||||
it "insists on login" do
|
||||
post :update, {id: '1'}
|
||||
response.status.should == 403
|
||||
end
|
||||
|
||||
it "requires user param" do
|
||||
controller.current_user = user
|
||||
post :update, {id: claimed_recording.id}
|
||||
response.status.should == 404
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,31 +25,32 @@ require 'jam_ruby'
|
|||
# uncomment this to see active record logs
|
||||
# ActiveRecord::Base.logger = Logger.new(STDOUT) if defined?(ActiveRecord::Base)
|
||||
|
||||
puts "1"
|
||||
|
||||
#puts "1"
|
||||
|
||||
include JamRuby
|
||||
|
||||
puts "2"
|
||||
#puts "2"
|
||||
# put ActionMailer into test mode
|
||||
ActionMailer::Base.delivery_method = :test
|
||||
|
||||
puts "3"
|
||||
#puts "3"
|
||||
RecordedTrack.observers.disable :all # only a few tests want this observer active
|
||||
|
||||
puts "4"
|
||||
#puts "4"
|
||||
# a way to kill tests if they aren't running. capybara is hanging intermittently, I think
|
||||
|
||||
tests_started = false
|
||||
|
||||
Thread.new {
|
||||
puts "thread starting"
|
||||
sleep 30
|
||||
puts "thread waking"
|
||||
unless tests_started
|
||||
puts "tests are hung. exiting..."
|
||||
exit 20
|
||||
end
|
||||
}
|
||||
#Thread.new {
|
||||
# puts "thread starting"
|
||||
# sleep 30
|
||||
# puts "thread waking"
|
||||
# unless tests_started
|
||||
# puts "tests are hung. exiting..."
|
||||
# exit 20
|
||||
# end
|
||||
#}
|
||||
|
||||
Spork.prefork do
|
||||
# Loading more in this block will cause your tests to run faster. However,
|
||||
|
|
|
|||
Loading…
Reference in New Issue