* wip
This commit is contained in:
parent
776cc9cddc
commit
92e3dec4f0
|
|
@ -201,7 +201,7 @@ module JamRuby
|
|||
|
||||
|
||||
def has_access?(user)
|
||||
users.exists?(user) || plays.where("player_id=?", user).count != 0
|
||||
users.exists?(user.id) || plays.where("player_id=?", user).count != 0
|
||||
end
|
||||
|
||||
# Start recording a session.
|
||||
|
|
@ -721,7 +721,7 @@ module JamRuby
|
|||
|
||||
private
|
||||
def self.validate_user_is_band_member(user, band)
|
||||
unless band.users.exists? user
|
||||
unless band.users.exists? user.id
|
||||
raise JamPermissionError, ValidationMessages::USER_NOT_BAND_MEMBER_VALIDATION_ERROR
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ end
|
|||
#end
|
||||
|
||||
group :development, :test do
|
||||
gem 'rspec-rails', '2.14.2'
|
||||
gem 'rspec-rails' #, require: "rspec/rails" #, '2.14.2'
|
||||
gem "activerecord-import", "~> 0.4.1"
|
||||
# gem 'guard-rspec', '0.5.5'
|
||||
# gem 'jasmine', '1.3.1'
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ class ApiMusicSessionsController < ApiController
|
|||
|
||||
|
||||
def jam_track_open
|
||||
unless @music_session.users.exists?(current_user)
|
||||
unless @music_session.users.exists?(current_user.id)
|
||||
raise JamPermissionError, ValidationMessages::PERMISSION_VALIDATION_ERROR
|
||||
end
|
||||
|
||||
|
|
@ -593,7 +593,7 @@ class ApiMusicSessionsController < ApiController
|
|||
end
|
||||
|
||||
def jam_track_close
|
||||
unless @music_session.users.exists?(current_user)
|
||||
unless @music_session.users.exists?(current_user.id)
|
||||
raise JamPermissionError, ValidationMessages::PERMISSION_VALIDATION_ERROR
|
||||
end
|
||||
|
||||
|
|
@ -603,7 +603,7 @@ class ApiMusicSessionsController < ApiController
|
|||
end
|
||||
|
||||
def backing_track_open
|
||||
unless @music_session.users.exists?(current_user)
|
||||
unless @music_session.users.exists?(current_user.id)
|
||||
raise JamPermissionError, ValidationMessages::PERMISSION_VALIDATION_ERROR
|
||||
end
|
||||
|
||||
|
|
@ -613,7 +613,7 @@ class ApiMusicSessionsController < ApiController
|
|||
end
|
||||
|
||||
def backing_track_close
|
||||
unless @music_session.users.exists?(current_user)
|
||||
unless @music_session.users.exists?(current_user.id)
|
||||
raise JamPermissionError, ValidationMessages::PERMISSION_VALIDATION_ERROR
|
||||
end
|
||||
|
||||
|
|
@ -622,7 +622,7 @@ class ApiMusicSessionsController < ApiController
|
|||
end
|
||||
|
||||
def metronome_open
|
||||
unless @music_session.users.exists?(current_user)
|
||||
unless @music_session.users.exists?(current_user.id)
|
||||
raise JamPermissionError, ValidationMessages::PERMISSION_VALIDATION_ERROR
|
||||
end
|
||||
|
||||
|
|
@ -631,7 +631,7 @@ class ApiMusicSessionsController < ApiController
|
|||
end
|
||||
|
||||
def metronome_close
|
||||
unless @music_session.users.exists?(current_user)
|
||||
unless @music_session.users.exists?(current_user.id)
|
||||
raise JamPermissionError, ValidationMessages::PERMISSION_VALIDATION_ERROR
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class ApiRecordingsController < ApiController
|
|||
def start
|
||||
music_session = ActiveMusicSession.find(params[:music_session_id])
|
||||
|
||||
raise JamPermissionError, ValidationMessages::PERMISSION_VALIDATION_ERROR unless music_session.users.exists?(current_user)
|
||||
raise JamPermissionError, ValidationMessages::PERMISSION_VALIDATION_ERROR unless music_session.users.exists?(current_user.id)
|
||||
|
||||
@recording = Recording.start(music_session, current_user)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class ApiScoringController < ApiController
|
|||
|
||||
def work # clientid; returns another clientid
|
||||
clientid = params[:clientid]
|
||||
if clientid.nil? then render :json => {message: 'clientid not specified'}, :status => 400; return end
|
||||
if clientid.blank? then render :json => {message: 'clientid not specified'}, :status => 400; return end
|
||||
|
||||
conn = Connection.where(client_id: clientid, user_id: current_user.id).first
|
||||
if conn.nil? then render :json => {message: 'session not found'}, :status => 404; return end
|
||||
|
|
@ -20,7 +20,7 @@ class ApiScoringController < ApiController
|
|||
|
||||
def worklist # clientid; returns a list of clientid
|
||||
clientid = params[:clientid]
|
||||
if clientid.nil? then render :json => {message: 'clientid not specified'}, :status => 400; return end
|
||||
if clientid.blank? then render :json => {message: 'clientid not specified'}, :status => 400; return end
|
||||
|
||||
conn = Connection.where(client_id: clientid, user_id: current_user.id).first
|
||||
if conn.nil? then render :json => {message: 'session not found'}, :status => 404; return end
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ else
|
|||
}
|
||||
|
||||
# only show join_requests if the current_user is in the session
|
||||
child({:join_requests => :join_requests}, :if => lambda { |music_session| music_session.users.exists?(current_user) } ) {
|
||||
child({:join_requests => :join_requests}, :if => lambda { |music_session| music_session.users.exists?(current_user.id) } ) {
|
||||
attributes :id, :text
|
||||
child(:user => :user) {
|
||||
attributes :id, :name
|
||||
|
|
@ -78,7 +78,7 @@ else
|
|||
}
|
||||
|
||||
# only show currently open jam track info if the current user is in the session
|
||||
child({:jam_track => :jam_track}, :if => lambda { |music_session| music_session.users.exists?(current_user) }) {
|
||||
child({:jam_track => :jam_track}, :if => lambda { |music_session| music_session.users.exists?(current_user.id) }) {
|
||||
attributes :id, :name, :description
|
||||
|
||||
child(:jam_track_tracks => :tracks) {
|
||||
|
|
@ -87,7 +87,7 @@ else
|
|||
}
|
||||
|
||||
# only show currently playing recording data if the current_user is in the session
|
||||
child({:claimed_recording => :claimed_recording}, :if => lambda { |music_session| music_session.users.exists?(current_user) }) {
|
||||
child({:claimed_recording => :claimed_recording}, :if => lambda { |music_session| music_session.users.exists?(current_user.id) }) {
|
||||
attributes :id, :name, :description, :is_public
|
||||
|
||||
child(:recording => :recording) {
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ else
|
|||
}
|
||||
|
||||
# only show join_requests if the current_user is in the session
|
||||
node(:join_requests, :if => lambda { |music_session| music_session.users.exists?(current_user) } ) do |music_session|
|
||||
node(:join_requests, :if => lambda { |music_session| music_session.users.exists?(current_user.id) } ) do |music_session|
|
||||
child(:join_requests => :join_requests) {
|
||||
attributes :id, :text
|
||||
child(:user => :user) {
|
||||
|
|
@ -188,7 +188,7 @@ else
|
|||
end
|
||||
|
||||
# only show currently playing recording data if the current_user is in the session
|
||||
node(:claimed_recording, :if => lambda { |music_session| music_session.users.exists?(current_user) } ) do |music_session|
|
||||
node(:claimed_recording, :if => lambda { |music_session| music_session.users.exists?(current_user.id) } ) do |music_session|
|
||||
|
||||
child(:claimed_recording => :claimed_recording) {
|
||||
attributes :id, :name, :description, :is_public
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiAffiliateController do
|
||||
describe ApiAffiliateController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:partner1) {FactoryGirl.create(:affiliate_partner)}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiClaimedRecordingsController do
|
||||
describe ApiClaimedRecordingsController, type: :controller do
|
||||
render_views
|
||||
|
||||
before(:each) do
|
||||
|
|
@ -19,7 +19,7 @@ describe ApiClaimedRecordingsController do
|
|||
@recording.claim(@user, "name", "description", @genre, true)
|
||||
@recording.reload
|
||||
@claimed_recording = @recording.claimed_recordings.first!
|
||||
@recording.has_mix?.should be_false
|
||||
@recording.has_mix?.should be false
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -75,7 +75,6 @@ describe ApiClaimedRecordingsController do
|
|||
|
||||
describe "index" do
|
||||
it "should generate a single output" do
|
||||
pending
|
||||
controller.current_user = @user
|
||||
get :index
|
||||
response.should be_success
|
||||
|
|
@ -106,11 +105,11 @@ describe ApiClaimedRecordingsController do
|
|||
controller.current_user = @user
|
||||
get :download, id: quick_mix.recording.candidate_claimed_recording.id
|
||||
response.status.should == 302
|
||||
response.headers['Location'].include?('recordings/ogg').should be_true
|
||||
response.headers['Location'].include?('recordings/ogg').should be true
|
||||
|
||||
get :download, id: quick_mix.recording.candidate_claimed_recording.id, type:'mp3'
|
||||
response.status.should == 302
|
||||
response.headers['Location'].include?('recordings/mp3').should be_true
|
||||
response.headers['Location'].include?('recordings/mp3').should be true
|
||||
end
|
||||
|
||||
it "final mix, not completed" do
|
||||
|
|
@ -125,11 +124,11 @@ describe ApiClaimedRecordingsController do
|
|||
controller.current_user = @user
|
||||
get :download, id: mix.recording.candidate_claimed_recording.id
|
||||
response.status.should == 302
|
||||
response.headers['Location'].include?('recordings/mixed/ogg').should be_true
|
||||
response.headers['Location'].include?('recordings/mixed/ogg').should be true
|
||||
|
||||
get :download, id: mix.recording.candidate_claimed_recording.id, type:'mp3'
|
||||
response.status.should == 302
|
||||
response.headers['Location'].include?('recordings/mixed/mp3').should be_true
|
||||
response.headers['Location'].include?('recordings/mixed/mp3').should be true
|
||||
end
|
||||
|
||||
it "both completed final mix and stream mix" do
|
||||
|
|
@ -139,11 +138,11 @@ describe ApiClaimedRecordingsController do
|
|||
controller.current_user = @user
|
||||
get :download, id: mix.recording.candidate_claimed_recording.id
|
||||
response.status.should == 302
|
||||
response.headers['Location'].include?('recordings/mixed/ogg').should be_true
|
||||
response.headers['Location'].include?('recordings/mixed/ogg').should be true
|
||||
|
||||
get :download, id: mix.recording.candidate_claimed_recording.id, type:'mp3'
|
||||
response.status.should == 302
|
||||
response.headers['Location'].include?('recordings/mixed/mp3').should be_true
|
||||
response.headers['Location'].include?('recordings/mixed/mp3').should be true
|
||||
end
|
||||
|
||||
it "completed stream mix, incomplete final mix" do
|
||||
|
|
@ -153,11 +152,11 @@ describe ApiClaimedRecordingsController do
|
|||
controller.current_user = @user
|
||||
get :download, id: mix.recording.candidate_claimed_recording.id
|
||||
response.status.should == 302
|
||||
response.headers['Location'].include?('recordings/ogg').should be_true
|
||||
response.headers['Location'].include?('recordings/ogg').should be true
|
||||
|
||||
get :download, id: quick_mix.recording.candidate_claimed_recording.id, type:'mp3'
|
||||
response.status.should == 302
|
||||
response.headers['Location'].include?('recordings/mp3').should be_true
|
||||
response.headers['Location'].include?('recordings/mp3').should be true
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiCorporateController do
|
||||
describe ApiCorporateController, type: :controller do
|
||||
render_views
|
||||
|
||||
before(:each) do
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiFavoritesController do
|
||||
describe ApiFavoritesController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiFeedsController do
|
||||
describe ApiFeedsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiIcecastController do
|
||||
describe ApiIcecastController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) {FactoryGirl.create(:user) }
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
describe ApiJamTracksController do
|
||||
describe ApiJamTracksController, type: :controller do
|
||||
render_views
|
||||
include CarrierWave::Test::Matchers
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ describe ApiJamTracksController do
|
|||
end
|
||||
|
||||
it "handle api call 400" do
|
||||
post :played, { user: @user }
|
||||
post :played, { id: '', user: @user }
|
||||
expect(response.status).to eq(400)
|
||||
json = JSON.parse(response.body)
|
||||
expect(/JamTrack ID required/).to match(json['message'])
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiLatencyTestersController do
|
||||
describe ApiLatencyTestersController, type: :controller do
|
||||
render_views
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiLinksController do
|
||||
describe ApiLinksController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:partner1) {FactoryGirl.create(:affiliate_partner)}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiMixesController do
|
||||
describe ApiMixesController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:mix) { FactoryGirl.create(:mix) }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiMusicSessionsController do
|
||||
describe ApiMusicSessionsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:tracks) { [{'sound' => 'mono', 'client_track_id' => 'abc', 'instrument_id' => 'piano'}] }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiPaymentHistoriesController do
|
||||
describe ApiPaymentHistoriesController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) {FactoryGirl.create(:user)}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiRecordingsController do
|
||||
describe ApiRecordingsController, type: :controller do
|
||||
render_views
|
||||
|
||||
describe "recording with backing track" do
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ require 'spec_helper'
|
|||
require 'jam_ruby/recurly_client'
|
||||
|
||||
describe ApiRecurlyWebHookController, :type=>:request do
|
||||
render_views
|
||||
|
||||
|
||||
let(:success_xml) {
|
||||
'<?xml version="1.0" encoding="UTF-8"?>
|
||||
<successful_payment_notification>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiScoringController do
|
||||
describe ApiScoringController, type: :controller do
|
||||
render_views
|
||||
|
||||
BOGUS_CLIENT_ID = 'nobodyclientid'
|
||||
|
|
@ -62,7 +62,7 @@ describe ApiScoringController do
|
|||
|
||||
it 'try work with mary login and nothing' do
|
||||
controller.current_user = @mary
|
||||
get :work, {}
|
||||
get :work, {clientid: ''}
|
||||
response.should_not be_success
|
||||
json = JSON.parse(response.body, :symbolize_names => true)
|
||||
json.length.should == 1
|
||||
|
|
@ -124,7 +124,7 @@ describe ApiScoringController do
|
|||
|
||||
it 'try worklist with nobody login and nobody' do
|
||||
controller.current_user = nil
|
||||
get :worklist, {}
|
||||
get :worklist, {clientid: ''}
|
||||
response.should_not be_success
|
||||
json = JSON.parse(response.body, :symbolize_names => true)
|
||||
json.length.should == 1
|
||||
|
|
@ -133,7 +133,7 @@ describe ApiScoringController do
|
|||
|
||||
it 'try worklist with mary login and nobody' do
|
||||
controller.current_user = @mary
|
||||
get :worklist, {}
|
||||
get :worklist, {clientid: ''}
|
||||
response.should_not be_success
|
||||
json = JSON.parse(response.body, :symbolize_names => true)
|
||||
json.length.should == 1
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
|||
|
||||
|
||||
|
||||
describe ApiShoppingCartsController do
|
||||
describe ApiShoppingCartsController, type: :controller do
|
||||
|
||||
render_views
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiUserSyncsController do
|
||||
describe ApiUserSyncsController, type: :controller do
|
||||
render_views
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiUsersController do
|
||||
describe ApiUsersController, type: :controller do
|
||||
render_views
|
||||
|
||||
let (:user) { FactoryGirl.create(:user) }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe SessionsController do
|
||||
describe SessionsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ShareTokensController do
|
||||
describe ShareTokensController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ end
|
|||
|
||||
bputs "before loading rails"
|
||||
require 'rspec/rails'
|
||||
bputs "before connection autorun"
|
||||
require 'rspec/autorun'
|
||||
# require 'rspec/autorun'
|
||||
|
||||
|
||||
bputs "before load capybara"
|
||||
|
|
@ -163,6 +162,12 @@ bputs "before register capybara"
|
|||
#ActiveRecord::Base.logger = Logger.new(STDOUT) if defined?(ActiveRecord::Base)
|
||||
|
||||
RSpec.configure do |config|
|
||||
|
||||
# XXX WE COULD GET RID OF THIS IF WE WANT TO UPDATE ALL OF OUR TESTS
|
||||
# Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }` instead. Called from /Users/seth/workspace/jam-cloud/web/spec/controllers/api_jam_tracks_controller_spec.rb:37:in `block (3 levels) in <top (required)>'.
|
||||
#config.expect_with(:rspec) { |c| c.syntax = :should }
|
||||
|
||||
|
||||
# ## Mock Framework
|
||||
#
|
||||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||
|
|
@ -171,7 +176,7 @@ bputs "before register capybara"
|
|||
# config.mock_with :flexmock
|
||||
# config.mock_with :rr
|
||||
config.mock_with :rspec
|
||||
config.color_enabled = true
|
||||
config.color = true
|
||||
|
||||
# by default, do not run tests marked as 'slow'
|
||||
config.filter_run_excluding slow: true unless ENV['RUN_SLOW_TESTS'] == "1" || ENV['SLOW'] == "1" || ENV['ALL_TESTS'] == "1"
|
||||
|
|
@ -210,7 +215,7 @@ bputs "before register capybara"
|
|||
end
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
config.before(:each) do |example|
|
||||
if example.metadata[:js] && (Capybara.current_driver.nil? || Capybara.current_driver.empty? || Capybara.current_driver==:poltergeist)
|
||||
page.driver.resize(1920, 1080)
|
||||
page.driver.headers = { 'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0' }
|
||||
|
|
@ -234,7 +239,7 @@ bputs "before register capybara"
|
|||
reset_session_mapper
|
||||
end
|
||||
|
||||
config.after(:each) do
|
||||
config.after(:each) do |example|
|
||||
|
||||
if example.metadata[:js]
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue