switch to other machine

This commit is contained in:
Seth Call 2026-01-12 07:07:53 -06:00
parent 5c7436ddfc
commit ee306770e3
133 changed files with 1847 additions and 1479 deletions

View File

@ -1,10 +1,6 @@
source 'https://rubygems.org'
unless ENV["LOCAL_DEV"] == "1"
source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/'
end
ruby "3.2.2"
ruby "3.4.8"
devenv = ENV["BUILD_NUMBER"].nil?
@ -37,7 +33,7 @@ gem 'fog-brightbox'
gem 'faraday'
gem 'ruby-prof'
gem 'rubyzip'
gem 'recurly'
gem 'recurly', '~> 2.19'
gem 'icalendar'
gem 'email_validator'
gem 'redis'
@ -72,7 +68,7 @@ gem 'rails-jquery-autocomplete'
gem 'activeadmin'
gem 'activeadmin-searchable_select'
gem 'mime-types'
gem 'fog'
gem 'fog-aws'
gem 'xmlrpc'
gem 'unf'
gem 'country-select'
@ -121,6 +117,8 @@ end
group :development, :test do
gem 'capybara'
gem 'capybara-screenshot'
gem 'cuprite'
gem 'rspec-rails'
gem 'jasmine'
gem 'execjs'

File diff suppressed because it is too large Load Diff

View File

View File

@ -1,47 +1,47 @@
FactoryGirl.define do
FactoryBot.define do
factory :user, :class => JamRuby::User do
sequence(:email) { |n| "person_#{n}@example.com"}
sequence(:first_name) { |n| "Person" }
sequence(:last_name) { |n| "#{n}" }
password "foobar"
password_confirmation "foobar"
email_confirmed true
musician true
city "Apex"
state "NC"
country "US"
terms_of_service true
reuse_card true
password { "foobar" }
password_confirmation { "foobar" }
email_confirmed { true }
musician { true }
city { "Apex" }
state { "NC" }
country { "US" }
terms_of_service { true }
reuse_card { true }
factory :admin do
admin true
admin { true }
end
before(:create) do |user|
user.musician_instruments << FactoryGirl.build(:musician_instrument, player: user)
user.musician_instruments << FactoryBot.build(:musician_instrument, player: user)
end
factory :single_user_session do
after(:create) do |user, evaluator|
music_session = FactoryGirl.create(:active_music_session, :creator => user)
connection = FactoryGirl.create(:connection, :user => user, :music_session => music_session)
music_session = FactoryBot.create(:active_music_session, :creator => user)
connection = FactoryBot.create(:connection, :user => user, :music_session => music_session)
end
end
end
factory :connection, :class => JamRuby::Connection do
sequence(:client_id) { |n| "Client#{n}" }
ip_address "1.1.1.1"
as_musician true
addr 0
locidispid 0
client_type 'client'
gateway 'gateway1'
scoring_timeout Time.now
ip_address { "1.1.1.1" }
as_musician { true }
addr { 0 }
locidispid { 0 }
client_type { 'client' }
gateway { 'gateway1' }
scoring_timeout { Time.now }
sequence(:channel_id) { |n| "Channel#{n}"}
association :user, factory: :user
metronome_open false
metronome_open { false }
end
factory :artifact_update, :class => JamRuby::ArtifactUpdate do
@ -54,8 +54,8 @@ FactoryGirl.define do
factory :musician_instrument, :class=> JamRuby::MusicianInstrument do
instrument { Instrument.find('electric guitar') }
proficiency_level 1
priority 0
proficiency_level { 1 }
priority { 0 }
end
factory :instrument, :class => JamRuby::Instrument do
@ -69,25 +69,25 @@ FactoryGirl.define do
factory :music_session, :class => JamRuby::MusicSession do
sequence(:name) { |n| "Music Session #{n}" }
sequence(:description) { |n| "Music Session Description #{n}" }
fan_chat true
fan_access true
approval_required false
musician_access true
legal_terms true
language 'eng'
legal_policy 'standard'
timezone 'UTC,Etc/UTC'
open_rsvps true
scheduled_start Time.now
scheduled_duration 3600
genre JamRuby::Genre.first
fan_chat { true }
fan_access { true }
approval_required { false }
musician_access { true }
legal_terms { true }
language { 'eng' }
legal_policy { 'standard' }
timezone { 'UTC,Etc/UTC' }
open_rsvps { true }
scheduled_start { Time.now }
scheduled_duration { 3600 }
genre { JamRuby::Genre.first }
association :creator, :factory => :user
end
factory :music_session_user_history, :class => JamRuby::MusicSessionUserHistory do
transient do
history nil
user nil
history { nil }
user { nil }
end
music_session_id { history.id }
@ -96,14 +96,14 @@ FactoryGirl.define do
end
factory :recorded_track, :class => JamRuby::RecordedTrack do
instrument JamRuby::Instrument.first
sound 'stereo'
instrument { JamRuby::Instrument.first }
sound { 'stereo' }
sequence(:client_id) { |n| "client_id-#{n}"}
sequence(:track_id) { |n| "track_id-#{n}"}
sequence(:client_track_id) { |n| "client_track_id-#{n}"}
md5 'abc'
length 1
fully_uploaded true
md5 { 'abc' }
length { 1 }
fully_uploaded { true }
association :user, factory: :user
association :recording, factory: :recording
end
@ -115,7 +115,7 @@ FactoryGirl.define do
factory :recording_with_track do
before(:create) { |recording, evaluator|
recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: evaluator.owner)
recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: evaluator.owner)
}
end
end
@ -123,38 +123,38 @@ FactoryGirl.define do
factory :claimed_recording, :class => JamRuby::ClaimedRecording do
sequence(:name) { |n| "name-#{n}" }
sequence(:description) { |n| "description-#{n}" }
is_public true
is_public { true }
association :genre, factory: :genre
association :user, factory: :user
before(:create) { |claimed_recording|
claimed_recording.recording = FactoryGirl.create(:recording_with_track, owner: claimed_recording.user)
claimed_recording.recording = FactoryBot.create(:recording_with_track, owner: claimed_recording.user)
}
end
factory :mix, :class => JamRuby::Mix do
started_at Time.now
completed_at Time.now
ogg_md5 'abc'
ogg_length 1
started_at { Time.now }
completed_at { Time.now }
ogg_md5 { 'abc' }
ogg_length { 1 }
sequence(:ogg_url) { |n| "recordings/ogg/#{n}" }
mp3_md5 'abc'
mp3_length 1
mp3_md5 { 'abc' }
mp3_length { 1 }
sequence(:mp3_url) { |n| "recordings/mp3/#{n}" }
completed true
completed { true }
before(:create) {|mix|
user = FactoryGirl.create(:user)
mix.recording = FactoryGirl.create(:recording_with_track, owner: user)
mix.recording.claimed_recordings << FactoryGirl.create(:claimed_recording, user: user, recording: mix.recording)
user = FactoryBot.create(:user)
mix.recording = FactoryBot.create(:recording_with_track, owner: user)
mix.recording.claimed_recordings << FactoryBot.create(:claimed_recording, user: user, recording: mix.recording)
}
end
factory :diagnostic, :class => JamRuby::Diagnostic do
type JamRuby::Diagnostic::NO_HEARTBEAT_ACK
creator JamRuby::Diagnostic::CLIENT
data Faker::Lorem.sentence
type { JamRuby::Diagnostic::NO_HEARTBEAT_ACK }
creator { JamRuby::Diagnostic::CLIENT }
data { Faker::Lorem.sentence }
association :user, factory: :user
end
@ -163,20 +163,20 @@ FactoryGirl.define do
association :creator, factory: :user
transient do
name "My Music Session"
description "Come Music Session"
fan_chat true
fan_access true
approval_required false
musician_access true
legal_terms true
genre JamRuby::Genre.first
band nil
name { "My Music Session" }
description { "Come Music Session" }
fan_chat { true }
fan_access { true }
approval_required { false }
musician_access { true }
legal_terms { true }
genre { JamRuby::Genre.first }
band { nil }
end
before(:create) do |session, evaluator|
music_session = FactoryGirl.create(:music_session, name: evaluator.name, description: evaluator.description, fan_chat: evaluator.fan_chat,
music_session = FactoryBot.create(:music_session, name: evaluator.name, description: evaluator.description, fan_chat: evaluator.fan_chat,
fan_access: evaluator.fan_access, approval_required: evaluator.approval_required, musician_access: evaluator.musician_access,
genre: evaluator.genre, creator: evaluator.creator, band: evaluator.band)
session.id = music_session.id
@ -184,7 +184,7 @@ FactoryGirl.define do
factory :active_music_session do
after(:create) { |session|
FactoryGirl.create(:music_session_user_history, :history => session.music_session, :user => session.creator)
FactoryBot.create(:music_session_user_history, :history => session.music_session, :user => session.creator)
}
factory :music_session_with_mount do
@ -195,15 +195,15 @@ FactoryGirl.define do
factory :latency_tester, :class => JamRuby::LatencyTester do
transient do
connection nil
make_connection true
connection { nil }
make_connection { true }
end
sequence(:client_id) { |n| "LatencyTesterClientId-#{n}" }
after(:create) do |latency_tester, evaluator|
latency_tester.connection = evaluator.connection if evaluator.connection
latency_tester.connection = FactoryGirl.create(:connection, client_type: Connection::TYPE_LATENCY_TESTER, client_id: latency_tester.client_id) if evaluator.make_connection
latency_tester.connection = FactoryBot.create(:connection, client_type: Connection::TYPE_LATENCY_TESTER, client_id: latency_tester.client_id) if evaluator.make_connection
latency_tester.save
end
end
@ -226,30 +226,30 @@ FactoryGirl.define do
sequence(:name) { |n| "jam-track-#{n}" }
sequence(:description) { |n| "description-#{n}" }
sequence(:slug) { |n| "slug-#{n}" }
time_signature '4/4'
status 'Production'
recording_type 'Cover'
time_signature { '4/4' }
status { 'Production' }
recording_type { 'Cover' }
sequence(:original_artist) { |n| "original-artist-#{n}" }
sequence(:songwriter) { |n| "songwriter-#{n}" }
sequence(:publisher) { |n| "publisher-#{n}" }
pro 'ASCAP'
sales_region 'United States'
price 1.99
reproduction_royalty true
public_performance_royalty true
reproduction_royalty_amount 0.999
licensor_royalty_amount 0.999
pro_royalty_amount 0.999
pro { 'ASCAP' }
sales_region { 'United States' }
price { 1.99 }
reproduction_royalty { true }
public_performance_royalty { true }
reproduction_royalty_amount { 0.999 }
licensor_royalty_amount { 0.999 }
pro_royalty_amount { 0.999 }
genre JamRuby::Genre.first
genre { JamRuby::Genre.first }
association :licensor, factory: :jam_track_licensor
end
factory :jam_track_track, :class => JamRuby::JamTrackTrack do
position 1
part 'lead guitar'
track_type 'Track'
instrument JamRuby::Instrument.find('electric guitar')
position { 1 }
part { 'lead guitar' }
track_type { 'Track' }
instrument { JamRuby::Instrument.find('electric guitar') }
association :jam_track, factory: :jam_track
end

View File

@ -7,7 +7,7 @@ describe "Artifact Update" do
subject { page }
let(:user) { FactoryGirl.create(:admin) }
let(:user) { FactoryBot.create(:admin) }
before { sign_in user }
describe "crud" do
@ -20,11 +20,11 @@ describe "Artifact Update" do
before do
visit new_admin_artifact_path
fill_in "artifacts_version", with: "1"
fill_in "artifacts_environment", with: "public"
select('JamClient/Win32', from: "artifacts_product")
fill_in "artifacts_environment", with: "public"
attach_file("artifacts_uri", ARTIFACT_FILE)
fill_in "jam_ruby_artifact_update_version", with: "1"
fill_in "jam_ruby_artifact_update_environment", with: "public"
select('JamClient/Win32', from: "jam_ruby_artifact_update_product")
fill_in "jam_ruby_artifact_update_environment", with: "public"
attach_file("jam_ruby_artifact_update_uri", ARTIFACT_FILE)
click_button "Create Artifact update"
end

View File

@ -11,12 +11,12 @@ describe 'Feeds' do
User.delete_all
end
let(:admin) { FactoryGirl.create(:admin) }
let(:user) { FactoryGirl.create(:user) }
let(:admin) { FactoryBot.create(:admin) }
let(:user) { FactoryBot.create(:user) }
let(:music_session) { FactoryGirl.create(:music_session, :creator => user) }
let(:recording) { FactoryGirl.create(:recording_with_track, :owner => user) }
let(:diagnostic) { FactoryGirl.create(:diagnostic, :user => user) }
let(:music_session) { FactoryBot.create(:music_session, :creator => user) }
let(:recording) { FactoryBot.create(:recording_with_track, :owner => user) }
let(:diagnostic) { FactoryBot.create(:diagnostic, :user => user) }
context 'empty dashboard' do
before(:each) do

View File

@ -5,7 +5,7 @@ describe InvitedUser do
subject { page }
# create an administrative user
let(:user) { FactoryGirl.create(:admin) }
let(:user) { FactoryBot.create(:admin) }
before { sign_in user }

View File

@ -9,7 +9,7 @@ describe 'Feeds' do
describe "latency_tester with connection" do
let!(:latency_tester) {FactoryGirl.create(:latency_tester)}
let!(:latency_tester) {FactoryBot.create(:latency_tester)}
before(:each) do
visit admin_latency_testers_path
@ -21,7 +21,7 @@ describe 'Feeds' do
end
describe "latency_tester with no connection" do
let!(:latency_tester) {FactoryGirl.create(:latency_tester, client_id: 'abc', make_connection: false)}
let!(:latency_tester) {FactoryBot.create(:latency_tester, client_id: 'abc', make_connection: false)}
before(:each) do
visit admin_latency_testers_path

View File

@ -30,19 +30,19 @@ require 'rspec/autorun'
require 'capybara/rails'
require 'capybara/rspec'
require 'capybara-screenshot/rspec'
require 'capybara/poltergeist'
require 'capybara/cuprite'
#include Rails.application.routes.url_helpers
include Rails.application.routes.url_helpers
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
Capybara.register_driver :poltergeist do |app|
driver = Capybara::Poltergeist::Driver.new(app, { debug: false, phantomjs_logger: File.open('log/phantomjs.out', 'w') })
Capybara.register_driver :cuprite do |app|
Capybara::Cuprite::Driver.new(app, window_size: [1200, 800])
end
Capybara.javascript_driver = :poltergeist
Capybara.javascript_driver = :cuprite
Capybara.default_max_wait_time = 10
RSpec.configure do |config|
@ -55,7 +55,7 @@ RSpec.configure do |config|
# config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
@ -72,4 +72,7 @@ RSpec.configure do |config|
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
config.infer_spec_type_from_file_location!
config.include Capybara::DSL
end

View File

@ -20,11 +20,11 @@ module JamRuby
end
def destroy_all_shopping_carts
ShoppingCart.destroy_all(anonymous_user_id: @id)
ShoppingCart.where(anonymous_user_id: @id).destroy_all
end
def destroy_jam_track_shopping_carts
ShoppingCart.destroy_all(anonymous_user_id: @id, cart_type: JamTrack::PRODUCT_TYPE)
ShoppingCart.where(anonymous_user_id: @id, cart_type: JamTrack::PRODUCT_TYPE).destroy_all
end
def admin

View File

@ -231,22 +231,21 @@ module JamRuby
end
end
def associate_tracks(tracks)
self.tracks.clear()
unless tracks.nil?
tracks.each do |track|
t = Track.new
t.instrument = Instrument.find_by_id(track["instrument_id"]) || Instrument.find('acoustic guitar')
t.connection = self
t.sound = track["sound"]
t.client_track_id = track["client_track_id"]
t.client_resource_id = track["client_resource_id"]
t.save # todo what if it fails?
self.tracks << t
def associate_tracks(tracks)
self.tracks.clear()
unless tracks.nil?
tracks.each do |track|
t = Track.new
t.instrument = track["instrument_id"].present? ? Instrument.find(track["instrument_id"]) : Instrument.find('acoustic guitar')
t.connection = self
t.sound = track["sound"]
t.client_track_id = track["client_track_id"]
t.client_resource_id = track["client_resource_id"]
t.save # todo what if it fails?
self.tracks << t
end
end
end
end
end
def associate_videos(videos)
unless videos.nil?
self.video_sources.clear()

View File

@ -1,6 +1,4 @@
require 'ipaddr'
=begin
module JamRuby
class JamIsp < ActiveRecord::Base
@ -220,4 +218,3 @@ module JamRuby
end
end
end
=end

View File

@ -242,8 +242,8 @@ module JamRuby
belongs_to :school, :class_name => "JamRuby::School", inverse_of: :students
belongs_to :onboarder, :class_name => "JamRuby::User", inverse_of: :onboarding_users, foreign_key: :onboarder_id
has_many :onboarding_users, :class_name => "JamRuby::User", inverse_of: :onboarder, foreign_key: :onboarder_id
has_one :owned_school, :class_name => "JamRuby::School", inverse_of: :user
has_one :owned_retailer, :class_name => "JamRuby::Retailer", inverse_of: :user
has_one :owned_school, :class_name => "JamRuby::School", inverse_of: :user, dependent: :destroy
has_one :owned_retailer, :class_name => "JamRuby::Retailer", inverse_of: :user, dependent: :destroy
has_many :test_drive_package_choices, :class_name =>"JamRuby::TestDrivePackageChoice"
has_many :jamblasters_users, class_name: "JamRuby::JamblasterUser"
has_many :jamblasters, class_name: 'JamRuby::Jamblaster', through: :jamblasters_users

View File

@ -33,10 +33,10 @@ gem 'fog-brightbox'
gem 'faraday'
gem 'ruby-prof'
gem 'rubyzip'
gem 'recurly'
gem 'recurly', '~> 2.19'
gem 'icalendar'
gem 'email_validator'
gem 'redis'
gem 'redis', '~> 4.8'
gem 'redis-namespace'
gem 'oj'
gem 'bcrypt'
@ -86,6 +86,7 @@ gem 'carmen'
gem 'carrierwave'
gem 'carrierwave_direct'
# gem 'fog' # Removed to avoid pulling in broken fog-rackspace
gem 'fog-aws'
# gem 'fog-rackspace'
gem 'haml-rails'
gem 'unf'
@ -117,6 +118,7 @@ gem 'influxdb-rails'
gem 'sitemap_generator'
gem 'bower-rails'
gem 'react-rails'
gem 'connection_pool', '~> 2.0'
gem 'sendgrid_toolkit'
gem 'stripe'
gem 'zip-codes'
@ -156,6 +158,7 @@ group :test, :cucumber do
gem 'simplecov-rcov'
gem 'capybara'
gem 'capybara-screenshot'
gem 'cuprite'
gem 'selenium-webdriver'
gem 'webdrivers', require: false
gem "show_me_the_cookies"

View File

@ -134,7 +134,7 @@ GEM
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
backports (3.25.3)
base64 (0.2.0)
base64 (0.3.0)
bcrypt (3.1.21)
benchmark (0.5.0)
bigdecimal (4.0.1)
@ -185,12 +185,15 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.3.6)
connection_pool (3.0.2)
connection_pool (2.5.5)
crack (1.0.1)
bigdecimal
rexml
crass (1.0.6)
csv (3.3.5)
cuprite (0.17)
capybara (~> 3.0)
ferrum (~> 0.17.0)
database_cleaner (2.1.0)
database_cleaner-active_record (>= 2, < 3)
database_cleaner-active_record (2.2.2)
@ -267,6 +270,12 @@ GEM
multi_json (>= 1.3)
rack-oauth2 (>= 0.14.4)
tzinfo
ferrum (0.17.1)
addressable (~> 2.5)
base64 (~> 0.2)
concurrent-ruby (~> 1.1)
webrick (~> 1.7)
websocket-driver (~> 0.7)
ffi (1.17.3-aarch64-linux-gnu)
ffi (1.17.3-aarch64-linux-musl)
ffi (1.17.3-arm-linux-gnu)
@ -628,12 +637,8 @@ GEM
execjs
railties (>= 3.2)
tilt
recurly (4.73.0)
base64 (~> 0.2.0)
redis (5.4.1)
redis-client (>= 0.22.0)
redis-client (0.26.3)
connection_pool
recurly (2.20.5)
redis (4.8.1)
redis-namespace (1.11.0)
redis (>= 4)
regexp_parser (2.11.3)
@ -869,6 +874,8 @@ DEPENDENCIES
cause
coffee-rails
coffee-script-source
connection_pool (~> 2.0)
cuprite
database_cleaner
devise
elasticsearch
@ -881,6 +888,7 @@ DEPENDENCIES
faraday
fb_graph
filepicker-rails
fog-aws
fog-brightbox
fpm
geokit-rails
@ -927,8 +935,8 @@ DEPENDENCIES
rails-assets-react-select!
rails-assets-reflux!
react-rails
recurly
redis
recurly (~> 2.19)
redis (~> 4.8)
redis-namespace
responders
resque
@ -1005,7 +1013,7 @@ CHECKSUMS
babel-source (5.8.35) sha256=79ef222a9dcb867ac2efa3b0da35b4bcb15a4bfa67b6b2dcbf1e9a29104498d9
babel-transpiler (0.7.0) sha256=4c06f4ad9e8e1cabe94f99e11df2f140bb72aca9ba067dbb49dc14d9b98d1570
backports (3.25.3) sha256=94298d32dc3c40ca15633b54e282780b49e2db0c045f602ea1907e4f63a17235
base64 (0.2.0) sha256=0f25e9b21a02a0cc0cea8ef92b2041035d39350946e8789c562b2d1a3da01507
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
bcrypt (3.1.21) sha256=5964613d750a42c7ee5dc61f7b9336fb6caca429ba4ac9f2011609946e4a2dcf
benchmark (0.5.0) sha256=465df122341aedcb81a2a24b4d3bd19b6c67c1530713fd533f3ff034e419236c
bigdecimal (4.0.1) sha256=8b07d3d065a9f921c80ceaea7c9d4ae596697295b584c296fe599dd0ad01c4a7
@ -1030,10 +1038,11 @@ CHECKSUMS
coffee-script (2.4.1) sha256=82fe281e11b93c8117b98c5ea8063e71741870f1c4fbb27177d7d6333dd38765
coffee-script-source (1.12.2) sha256=e12b16fd8927fbbf8b87cb2e9a85a6cf457c6881cc7ff8b1af15b31f70da07a4
concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
connection_pool (2.5.5) sha256=e54ff92855753df1fd7c59fa04a398833355f27dd14c074f8c83a05f72a716ad
crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e
crass (1.0.6) sha256=dc516022a56e7b3b156099abc81b6d2b08ea1ed12676ac7a5657617f012bd45d
csv (3.3.5) sha256=6e5134ac3383ef728b7f02725d9872934f523cb40b961479f69cf3afa6c8e73f
cuprite (0.17) sha256=b140d5dc70d08b97ad54bcf45cd95d0bd430e291e9dffe76fff851fddd57c12b
database_cleaner (2.1.0) sha256=1dcba26e3b1576da692fc6bac10136a4744da5bcc293d248aae19640c65d89cd
database_cleaner-active_record (2.2.2) sha256=88296b9f3088c31f7c0d4fcec10f68e4b71c96698043916de59b04debec10388
database_cleaner-core (2.0.1) sha256=8646574c32162e59ed7b5258a97a208d3c44551b854e510994f24683865d846c
@ -1072,6 +1081,7 @@ CHECKSUMS
faraday-rack (1.0.0) sha256=ef60ec969a2bb95b8dbf24400155aee64a00fc8ba6c6a4d3968562bcc92328c0
faraday-retry (1.0.3) sha256=add154f4f399243cbe070806ed41b96906942e7f5259bb1fe6daf2ec8f497194
fb_graph (2.7.17) sha256=7f03b001b8c50c64e361bfcd252c737963794b1d79f35c539801581d9cd1819f
ferrum (0.17.1) sha256=51d591120fc593e5a13b5d9d6474389f5145bb92a91e36eab147b5d096c8cbe7
ffi (1.17.3-aarch64-linux-gnu) sha256=28ad573df26560f0aedd8a90c3371279a0b2bd0b4e834b16a2baa10bd7a97068
ffi (1.17.3-aarch64-linux-musl) sha256=020b33b76775b1abacc3b7d86b287cef3251f66d747092deec592c7f5df764b2
ffi (1.17.3-arm-linux-gnu) sha256=5bd4cea83b68b5ec0037f99c57d5ce2dd5aa438f35decc5ef68a7d085c785668
@ -1229,9 +1239,8 @@ CHECKSUMS
rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e
rdoc (7.0.3) sha256=dfe3d0981d19b7bba71d9dbaeb57c9f4e3a7a4103162148a559c4fc687ea81f9
react-rails (3.2.1) sha256=2235db0b240517596b1cb3e26177ab5bc64d3a56579b0415ee242b1691f81f64
recurly (4.73.0) sha256=9772545aabad6b0f041622610b6e05513b60601fe77e0dc14f0fd8323acd76f1
redis (5.4.1) sha256=b5e675b57ad22b15c9bcc765d5ac26f60b675408af916d31527af9bd5a81faae
redis-client (0.26.3) sha256=37a95ca193b7a79f350c09fe5e696dc15d1701195d559d031a107ab725effc49
recurly (2.20.5) sha256=307c2f1d9307db6e69839f3b5eb978265f27c44aa2a3819fc59ea23a47a560f6
redis (4.8.1) sha256=387ee086694fffc9632aaeb1efe4a7b1627ca783bf373320346a8a20cd93333a
redis-namespace (1.11.0) sha256=e91a1aa2b2d888b6dea1d4ab8d39e1ae6fac3426161feb9d91dd5cca598a2239
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835

View File

@ -1,6 +1,6 @@
class ApiAffiliateController < ApiController
before_filter :api_signed_in_user, :except => [ :create ]
before_action :api_signed_in_user, :except => [ :create ]
include ErrorsHelper

View File

@ -1,7 +1,7 @@
class ApiAlertsController < ApiController
before_filter :api_signed_in_user, only: :create
before_action :api_signed_in_user, only: :create
def log

View File

@ -1,5 +1,5 @@
class ApiAppFeaturesController < ApiController
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -1,9 +1,9 @@
class ApiBackingTracksController < ApiController
# have to be signed in currently to see this screen
before_filter :api_signed_in_user
before_action :api_signed_in_user
before_filter :lookup_recorded_backing_track, :only => [ :backing_track_silent ]
before_action :lookup_recorded_backing_track, :only => [ :backing_track_silent ]
respond_to :json

View File

@ -1,11 +1,11 @@
class ApiBandsController < ApiController
before_filter :api_signed_in_user, :except => [:index, :show, :follower_index]
before_filter :auth_band_member, :only => [:update,
before_action :api_signed_in_user, :except => [:index, :show, :follower_index]
before_action :auth_band_member, :only => [:update,
:recording_create, :recording_update, :recording_destroy,
:invitation_index, :invitation_show, :invitation_create, :invitation_destroy,
:update_photo, :delete_photo, :generate_filepicker_policy]
before_filter :auth_band_admin, :only => [:delete]
before_action :auth_band_admin, :only => [:delete]
respond_to :json

View File

@ -1,6 +1,6 @@
class ApiChatsController < ApiController
before_filter :api_signed_in_user, :check_session
before_action :api_signed_in_user, :check_session
respond_to :json

View File

@ -1,7 +1,7 @@
class ApiClaimedRecordingsController < ApiController
before_filter :api_signed_in_user, :except => [ :download, :show ]
before_filter :look_up_claimed_recording, :only => [ :show, :update, :delete, :download ]
before_action :api_signed_in_user, :except => [ :download, :show ]
before_action :look_up_claimed_recording, :only => [ :show, :update, :delete, :download ]
respond_to :json

View File

@ -1,6 +1,6 @@
class ApiDiagnosticsController < ApiController
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json
def create

View File

@ -2,7 +2,7 @@ class ApiFavoritesController < ApiController
respond_to :json
before_filter :api_signed_in_user
before_action :api_signed_in_user
def index
@claimed_recordings, @next = ClaimedRecording.index_favorites(current_user,

View File

@ -24,9 +24,9 @@
=end
class ApiIcecastController < ApiController
before_filter :local_only, :only => [:test]
before_filter :parse_mount, :only => [:mount_add, :mount_remove, :listener_add, :listener_remove]
before_filter :api_signed_in_user, :only => [ :create_source_change ]
before_action :local_only, :only => [:test]
before_action :parse_mount, :only => [:mount_add, :mount_remove, :listener_add, :listener_remove]
before_action :api_signed_in_user, :only => [ :create_source_change ]
# each request will have this in it, if it's icecast.
#user-agent = Icecast 2.3.3

View File

@ -1,7 +1,7 @@
class ApiInvitationsController < ApiController
# have to be signed in currently to see this screen
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -1,7 +1,7 @@
class ApiInvitedUsersController < ApiController
# have to be signed in currently to see this screen
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -1,11 +1,11 @@
class ApiJamTrackMixdownsController < ApiController
# have to be signed in currently to see this screen
before_filter :api_signed_in_user
before_filter :lookup_jam_track_mixdown, :only => [:download, :enqueue, :update]
before_filter :lookup_jam_track_right, :only => [:download, :enqueue, :update]
before_filter :ip_blacklist, :only => [:download]
before_filter :user_blacklist, :only => [:download]
before_action :api_signed_in_user
before_action :lookup_jam_track_mixdown, :only => [:download, :enqueue, :update]
before_action :lookup_jam_track_right, :only => [:download, :enqueue, :update]
before_action :ip_blacklist, :only => [:download]
before_action :user_blacklist, :only => [:download]
respond_to :json
def log

View File

@ -1,11 +1,11 @@
class ApiJamTracksController < ApiController
# have to be signed in currently to see this screen
before_filter :api_signed_in_user, :except => [:index, :autocomplete, :show_with_artist_info, :artist_index, :public_show]
before_filter :api_any_user, :only => [:index, :autocomplete, :show_with_artist_info, :artist_index]
before_filter :lookup_jam_track_right, :only => [:download, :enqueue, :show_jam_track_right, :mark_active, :download_stem]
before_filter :ip_blacklist, :only => [:download_stem, :download]
before_filter :user_blacklist, :only => [:download_stem, :download]
before_action :api_signed_in_user, :except => [:index, :autocomplete, :show_with_artist_info, :artist_index, :public_show]
before_action :api_any_user, :only => [:index, :autocomplete, :show_with_artist_info, :artist_index]
before_action :lookup_jam_track_right, :only => [:download, :enqueue, :show_jam_track_right, :mark_active, :download_stem]
before_action :ip_blacklist, :only => [:download_stem, :download]
before_action :user_blacklist, :only => [:download_stem, :download]
respond_to :json

View File

@ -1,6 +1,6 @@
class ApiJamblastersController < ApiController
before_filter :api_signed_in_user, except: [:login, :store_token, :auth_users, :can_pair, :is_allowed]
before_action :api_signed_in_user, except: [:login, :store_token, :auth_users, :can_pair, :is_allowed]
respond_to :json

View File

@ -1,7 +1,7 @@
class ApiJoinRequestsController < ApiController
# have to be signed in currently to see this screen
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -1,7 +1,7 @@
class ApiLatencyTestersController < ApiController
# have to be signed in currently to see this screen
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -1,8 +1,8 @@
class ApiLessonBookingsController < ApiController
before_filter :api_signed_in_user
before_filter :lookup_lesson_booking, :only => [:accept, :counter, :cancel, :show]
before_filter :auth_lesson_booking, :only => [:accept, :counter, :cancel, :show]
before_action :api_signed_in_user
before_action :lookup_lesson_booking, :only => [:accept, :counter, :cancel, :show]
before_action :auth_lesson_booking, :only => [:accept, :counter, :cancel, :show]
respond_to :json
def index

View File

@ -1,9 +1,9 @@
class ApiLessonSessionsController < ApiController
before_filter :api_signed_in_user
before_filter :lookup_lesson, except: [:index, :uncollectable, :rating_decision]
before_filter :is_teacher, only: [:accept]
before_filter :is_student, only: []
before_action :api_signed_in_user
before_action :lookup_lesson, except: [:index, :uncollectable, :rating_decision]
before_action :is_teacher, only: [:accept]
before_action :is_student, only: []
respond_to :json
def index

View File

@ -2,8 +2,8 @@ class ApiLinksController < ApiController
respond_to :json
before_filter :api_any_user
before_filter :affiliate_partner
before_action :api_any_user
before_action :affiliate_partner
def log
@log || Logging.logger[ApiLinksController]

View File

@ -4,9 +4,9 @@ class ApiMixesController < ApiController
# hitting these routes.
CRON_TOKEN = "2kkl39sjjf3ijdsflje2923j"
before_filter :api_signed_in_user, :only => [ :schedule ]
before_filter :require_cron_token, :only => [ :next, :finish ]
before_filter :look_up_mix, :only => [ :finish ]
before_action :api_signed_in_user, :only => [ :schedule ]
before_action :require_cron_token, :only => [ :next, :finish ]
before_action :look_up_mix, :only => [ :finish ]
respond_to :json

View File

@ -1,7 +1,7 @@
require 'aws-sdk'
require 'aws-sdk-s3'
class ApiMusicNotationsController < ApiController
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -1,13 +1,13 @@
require 'aws-sdk'
require 'aws-sdk-s3'
class ApiMusicSessionsController < ApiController
# have to be signed in currently to see this screen
before_filter :api_signed_in_user, :except => [ :add_like, :show, :show_history, :add_session_info_comment, :auth ]
before_filter :lookup_session, only: [:show, :update, :delete, :claimed_recording_start, :claimed_recording_stop, :track_sync, :jam_track_open, :jam_track_close, :backing_track_open, :backing_track_close, :metronome_open, :metronome_close, :attach_recording]
before_filter :lookup_perm_session, only: [:get_livestream, :create_livestream, :livestream_transition]
skip_before_filter :api_signed_in_user, only: [:perf_upload]
around_filter :transactions_filter, only:[:sms_index, :ams_index]
before_action :api_signed_in_user, :except => [ :add_like, :show, :show_history, :add_session_info_comment, :auth ]
before_action :lookup_session, only: [:show, :update, :delete, :claimed_recording_start, :claimed_recording_stop, :track_sync, :jam_track_open, :jam_track_close, :backing_track_open, :backing_track_close, :metronome_open, :metronome_close, :attach_recording]
before_action :lookup_perm_session, only: [:get_livestream, :create_livestream, :livestream_transition]
skip_before_action :api_signed_in_user, only: [:perf_upload]
around_action :transactions_filter, only:[:sms_index, :ams_index]
respond_to :json
@ -324,10 +324,10 @@ class ApiMusicSessionsController < ApiController
end
end
def participant_create
client_id = params[:client_id]
if client_id.nil?
def participant_create
puts "DEBUG: participant_create params=#{params.inspect}"
client_id = params[:client_id]
if client_id.nil?
raise JamArgumentError, "client_id must be specified"
end

View File

@ -1,6 +1,6 @@
class ApiPayPalController < ApiController
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -1,6 +1,6 @@
class ApiPaymentHistoriesController < ApiController
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -1,10 +1,10 @@
require 'sanitize'
class ApiPosaCardsController < ApiController
before_filter :api_signed_in_user, :only => [:claim]
before_filter :posa_http_basic_auth, :only => [:activate]
before_action :api_signed_in_user, :only => [:claim]
before_action :posa_http_basic_auth, :only => [:activate]
#before_filter :lookup_review_summary, :only => [:details]
#before_filter :lookup_review, :only => [:update, :delete, :show]
#before_action :lookup_review_summary, :only => [:details]
#before_action :lookup_review, :only => [:update, :delete, :show]
respond_to :json

View File

@ -1,11 +1,11 @@
class ApiRecordingsController < ApiController
before_filter :api_signed_in_user, :except => [ :add_like ]
before_action :api_signed_in_user, :except => [ :add_like ]
before_filter :lookup_recording, :only => [ :show, :stop, :claim, :discard, :keep, :delete_claim, :add_timeline, :add_video_data, :delete_video_data, :mobile_upload, :mobile_update, :mobile_upload_download, :mobile_upload_delete ]
before_filter :lookup_recorded_track, :only => [ :download, :upload_next_part, :upload_sign, :upload_part_complete, :upload_complete ]
before_filter :lookup_recorded_backing_track, :only => [ :backing_track_download, :backing_track_upload_next_part, :backing_track_upload_sign, :backing_track_upload_part_complete, :backing_track_upload_complete ]
before_filter :lookup_recorded_video, :only => [ :video_upload_sign, :video_upload_start, :video_upload_complete ]
before_filter :lookup_stream_mix, :only => [ :upload_next_part_stream_mix, :upload_sign_stream_mix, :upload_part_complete_stream_mix, :upload_complete_stream_mix ]
before_action :lookup_recording, :only => [ :show, :stop, :claim, :discard, :keep, :delete_claim, :add_timeline, :add_video_data, :delete_video_data, :mobile_upload, :mobile_update, :mobile_upload_download, :mobile_upload_delete ]
before_action :lookup_recorded_track, :only => [ :download, :upload_next_part, :upload_sign, :upload_part_complete, :upload_complete ]
before_action :lookup_recorded_backing_track, :only => [ :backing_track_download, :backing_track_upload_next_part, :backing_track_upload_sign, :backing_track_upload_part_complete, :backing_track_upload_complete ]
before_action :lookup_recorded_video, :only => [ :video_upload_sign, :video_upload_start, :video_upload_complete ]
before_action :lookup_stream_mix, :only => [ :upload_next_part_stream_mix, :upload_sign_stream_mix, :upload_part_complete_stream_mix, :upload_complete_stream_mix ]
respond_to :json

View File

@ -1,9 +1,9 @@
require 'jam_ruby/recurly_client'
class ApiRecurlyController < ApiController
before_filter :api_signed_in_user, :except => [:create_account]
before_filter :create_client
before_filter :ip_blacklist, :only => [:place_order]
before_filter :user_blacklist, :only => [:place_order]
before_action :api_signed_in_user, :except => [:create_account]
before_action :create_client
before_action :ip_blacklist, :only => [:place_order]
before_action :user_blacklist, :only => [:place_order]
respond_to :json
@ -12,6 +12,7 @@ class ApiRecurlyController < ApiController
def create_account
billing_info = params[:billing_info]
billing_info = billing_info.to_unsafe_h if billing_info.respond_to?(:to_unsafe_h)
shipping_info = params[:shipping_info]
# should we let the user reuse this card next time?
reuse_card_next_time = params[:reuse_card_next_time] == "true"
@ -109,7 +110,9 @@ class ApiRecurlyController < ApiController
# update Recurly account
def update_account
@account=@client.update_account(current_user, params[:billing_info])
billing_info = params[:billing_info]
billing_info = billing_info.to_unsafe_h if billing_info.respond_to?(:to_unsafe_h)
@account=@client.update_account(current_user, billing_info)
render :json => account_json(@account)
rescue RecurlyClientError => x
render json: {message: x.inspect, errors: x.errors}, :status => 404
@ -129,7 +132,9 @@ class ApiRecurlyController < ApiController
# update Billing Information
def update_billing_info
@account = @client.update_billing_info(current_user, params[:billing_info])
billing_info = params[:billing_info]
billing_info = billing_info.to_unsafe_h if billing_info.respond_to?(:to_unsafe_h)
@account = @client.update_billing_info(current_user, billing_info)
render :json => account_json(@account)
rescue RecurlyClientError => x
render json: {message: x.inspect, errors: x.errors}, :status => 404

View File

@ -2,7 +2,7 @@ class ApiRecurlyWebHookController < ApiController
http_basic_authenticate_with name: Rails.application.config.recurly_webhook_user, password: Rails.application.config.recurly_webhook_pass
before_filter :api_signed_in_user, only: []
before_action :api_signed_in_user, only: []
#respond_to :xml

View File

@ -1,10 +1,10 @@
class ApiRetailerInvitationsController < ApiController
before_filter :api_signed_in_user
before_filter :lookup_retailer, :only => [:index, :create]
before_filter :auth_retailer, :only => [:index, :create]
before_filter :lookup_retailer_invitation, :only => [:delete, :resend]
before_filter :auth_retailer_invitation, :only => [:delete, :resend]
before_action :api_signed_in_user
before_action :lookup_retailer, :only => [:index, :create]
before_action :auth_retailer, :only => [:index, :create]
before_action :lookup_retailer_invitation, :only => [:delete, :resend]
before_action :auth_retailer_invitation, :only => [:delete, :resend]
respond_to :json

View File

@ -1,8 +1,8 @@
class ApiRetailersController < ApiController
before_filter :api_signed_in_user, :except => [:customer_email]
before_filter :lookup_retailer, :only => [:show, :update, :update_avatar, :delete_avatar, :generate_filepicker_policy, :remove_student, :remove_teacher, :customer_email]
before_filter :auth_retailer, :only => [:show, :update, :update_avatar, :delete_avatar, :generate_filepicker_policy, :remove_student, :remove_teacher]
before_action :api_signed_in_user, :except => [:customer_email]
before_action :lookup_retailer, :only => [:show, :update, :update_avatar, :delete_avatar, :generate_filepicker_policy, :remove_student, :remove_teacher, :customer_email]
before_action :auth_retailer, :only => [:show, :update, :update_avatar, :delete_avatar, :generate_filepicker_policy, :remove_student, :remove_teacher]
respond_to :json

View File

@ -1,8 +1,8 @@
require 'sanitize'
class ApiReviewsController < ApiController
before_filter :api_signed_in_user, :except => [:index]
before_filter :lookup_review_summary, :only => [:details]
before_filter :lookup_review, :only => [:update, :delete, :show]
before_action :api_signed_in_user, :except => [:index]
before_action :lookup_review_summary, :only => [:details]
before_action :lookup_review, :only => [:update, :delete, :show]
respond_to :json

View File

@ -1,6 +1,6 @@
class ApiRsvpRequestsController < ApiController
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -1,6 +1,6 @@
class ApiRsvpSlotsController < ApiController
# before_filter :auth_user
# before_action :auth_user
respond_to :json

View File

@ -1,6 +1,6 @@
class ApiSalesController < ApiController
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -1,11 +1,11 @@
class
ApiSchoolInvitationsController < ApiController
before_filter :api_signed_in_user
before_filter :lookup_school, :only => [:index, :create]
before_filter :auth_school, :only => [:index, :create]
before_filter :lookup_school_invitation, :only => [:delete, :resend]
before_filter :auth_school_invitation, :only => [:delete, :resend]
before_action :api_signed_in_user
before_action :lookup_school, :only => [:index, :create]
before_action :auth_school, :only => [:index, :create]
before_action :lookup_school_invitation, :only => [:delete, :resend]
before_action :auth_school_invitation, :only => [:delete, :resend]
respond_to :json

View File

@ -1,8 +1,8 @@
class ApiSchoolsController < ApiController
before_filter :api_signed_in_user
before_filter :lookup_school, :only => [:show, :update, :update_avatar, :delete_avatar, :generate_filepicker_policy, :remove_student, :remove_teacher]
before_filter :auth_school, :only => [:show, :update, :update_avatar, :delete_avatar, :generate_filepicker_policy, :remove_student, :remove_teacher]
before_action :api_signed_in_user
before_action :lookup_school, :only => [:show, :update, :update_avatar, :delete_avatar, :generate_filepicker_policy, :remove_student, :remove_teacher]
before_action :auth_school, :only => [:show, :update, :update_avatar, :delete_avatar, :generate_filepicker_policy, :remove_student, :remove_teacher]
respond_to :json

View File

@ -1,7 +1,7 @@
class ApiScoringController < ApiController
respond_to :json
before_filter :api_signed_in_user
before_action :api_signed_in_user
def work # clientid; returns another clientid
clientid = params[:clientid]

View File

@ -1,7 +1,7 @@
class ApiSearchController < ApiController
# have to be signed in currently to see this screen
before_filter :api_signed_in_user, :except => :jam_tracks
before_action :api_signed_in_user, :except => :jam_tracks
respond_to :json

View File

@ -1,6 +1,6 @@
class ApiShoppingCartsController < ApiController
before_filter :api_any_user
before_action :api_any_user
respond_to :json

View File

@ -1,7 +1,7 @@
class ApiSignupHintsController < ApiController
before_filter :api_anonymous_user, except: [:create_redirect]
before_filter :api_signed_in_user, only: [:create_redirect]
before_action :api_anonymous_user, except: [:create_redirect]
before_action :api_signed_in_user, only: [:create_redirect]
respond_to :json

View File

@ -1,6 +1,6 @@
class ApiStripeController < ApiController
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json
def store

View File

@ -1,6 +1,6 @@
class ApiTeacherDistributionsController < ApiController
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json
def index

View File

@ -1,8 +1,8 @@
class ApiTeachersController < ApiController
before_filter :api_signed_in_user, :except => [:index, :detail, :search, :search_help]
before_filter :auth_teacher, :only => [:update, :delete]
before_filter :auth_user, :only => [:create, :update]
before_action :api_signed_in_user, :except => [:index, :detail, :search, :search_help]
before_action :auth_teacher, :only => [:update, :delete]
before_action :auth_user, :only => [:create, :update]
respond_to :json

View File

@ -1,7 +1,7 @@
require 'sanitize'
class ApiTextMessagesController < ApiController
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -1,6 +1,6 @@
class ApiTwittersController < ApiController
before_filter :api_signed_in_user
before_action :api_signed_in_user
respond_to :json

View File

@ -3,8 +3,8 @@
class ApiUserSyncsController < ApiController
before_filter :api_signed_in_user, :except => [ ]
before_filter :auth_user
before_action :api_signed_in_user, :except => [ ]
before_action :auth_user
respond_to :json

View File

@ -1,9 +1,9 @@
require 'sanitize'
class ApiUsersController < ApiController
before_filter :api_signed_in_user, :except => [:create, :calendar, :show, :signup_confirm, :auth_session_create, :complete, :finalize_update_email, :isp_scoring, :add_play, :crash_dump, :user_assets, :validate_data, :google_auth, :user_event, :onboardings, :update_onboarding, :show_onboarding]
before_action :api_signed_in_user, :except => [:create, :calendar, :show, :signup_confirm, :auth_session_create, :complete, :finalize_update_email, :isp_scoring, :add_play, :crash_dump, :user_assets, :validate_data, :google_auth, :user_event, :onboardings, :update_onboarding, :show_onboarding]
before_filter :auth_user, :only => [:session_settings_show, :session_history_index, :session_user_history_index, :update, :delete, :authorizations, :test_drive_status,
before_action :auth_user, :only => [:session_settings_show, :session_history_index, :session_user_history_index, :update, :delete, :authorizations, :test_drive_status,
:liking_create, :liking_destroy, # likes
:following_create, :following_show, :following_destroy, # followings
:recording_update, :recording_destroy, # recordings
@ -16,7 +16,7 @@ class ApiUsersController < ApiController
:share_session, :share_recording,
:affiliate_report, :audio_latency, :get_latencies, :broadcast_notification, :redeem_giftcard, :post_app_interactions]
before_filter :ip_blacklist, :only => [:create, :redeem_giftcard]
before_action :ip_blacklist, :only => [:create, :redeem_giftcard]
respond_to :json, :except => :calendar
respond_to :ics, :only => :calendar

View File

@ -10,15 +10,15 @@ class ApplicationController < ActionController::Base
# inject username/email into bugsnag data
before_bugsnag_notify :add_user_info_to_bugsnag
before_filter do
before_action do
gon_setup
end
before_filter :set_tracking_cookie
before_filter :track_affiliate_visits
before_filter :track_origin
before_action :set_tracking_cookie
before_action :track_affiliate_visits
before_action :track_origin
#before_filter do
#before_action do
# if params[AffiliatePartner::PARAM_REFERRAL].present? && current_user.nil?
# if cookies[AffiliatePartner::PARAM_COOKIE].blank?
# code = params[AffiliatePartner::PARAM_REFERRAL].downcase

View File

@ -1,7 +1,7 @@
class ExtrasController < ApplicationController
before_filter :signed_in_user
before_filter :admin_user
before_action :signed_in_user
before_action :admin_user
def settings
render layout: "web"

View File

@ -4,7 +4,7 @@ class LandingsController < ApplicationController
respond_to :html
before_filter :posa_http_basic_auth, only: [:posa_activation]
before_action :posa_http_basic_auth, only: [:posa_activation]
def watch_bands
@promo_buzz = PromoBuzz.active

View File

@ -1,7 +1,7 @@
# this is not a jam session - this is an 'auth session'
class SessionsController < ApplicationController
before_filter :api_signed_in_user, only: :paypal_express_checkout
before_action :api_signed_in_user, only: :paypal_express_checkout
layout "web"

View File

@ -16,12 +16,12 @@ class UsersController < ApplicationController
include ClientHelper
before_filter :signed_in_user,
before_action :signed_in_user,
only: [:index, :edit, :update, :destroy]
before_filter :correct_user, only: [:edit, :update]
before_filter :admin_user, only: :destroy
before_filter :is_native_client
before_filter :ip_blacklist, :only => [:create]
before_action :correct_user, only: [:edit, :update]
before_action :admin_user, only: :destroy
before_action :is_native_client
before_action :ip_blacklist, :only => [:create]
rescue_from 'JamRuby::PermissionError' do |exception|
@exception = exception

View File

@ -36,10 +36,11 @@ module SessionsHelper
sign_in user
# port over any shopping cart items
if has_anonymous_user?
shopping_carts = anonymous_user.shopping_carts
anon_user = anonymous_user
if anon_user
shopping_carts = anon_user.shopping_carts
ShoppingCart.move_to_user(user, anonymous_user, shopping_carts)
ShoppingCart.move_to_user(user, anon_user, shopping_carts)
end
if redirect

View File

@ -1,9 +1,10 @@
# encoding: utf-8
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWaveDirect::Uploader
include CarrierWave::MimeTypes
process :set_content_type
include CarrierWave::MiniMagick
#include CarrierWave::MimeTypes
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
def initialize(*)

View File

@ -44,6 +44,13 @@ if defined?(Bundler)
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
begin
gem_path = Gem::Specification.find_by_name("filepicker-rails").gem_dir
require "#{gem_path}/app/helpers/filepicker_rails/form_helper"
rescue => e
puts "Failed to load filepicker helper: #{e}"
end
include JamRuby
# require "rails/test_unit/railtie"

View File

@ -12,7 +12,7 @@ SampleApp::Application.configure do
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil
config.whiny_nils = true
# config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
@ -30,7 +30,7 @@ SampleApp::Application.configure do
config.action_mailer.delivery_method = :test
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# config.active_record.mass_assignment_sanitizer = :strict
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr

View File

@ -18,7 +18,7 @@ SampleApp::Application.configure do
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
@ -33,10 +33,10 @@ SampleApp::Application.configure do
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# config.action_dispatch.best_standards_support = :builtin
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# config.active_record.mass_assignment_sanitizer = :strict
# Do not compress assets
config.assets.compress = false

View File

@ -6,6 +6,7 @@ SampleApp::Application.configure do
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
config.eager_load = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_files = true

View File

@ -1,6 +1,7 @@
require 'jam_web/version'
Bugsnag.configure do |config|
config.api_key = Rails.application.config.bugsnag_key
config.use_ssl = false
config.notify_release_stages = Rails.application.config.bugsnag_notify_release_stages
config.auto_notify = true
config.app_version = JamWeb::VERSION

View File

@ -7,7 +7,7 @@ InfluxDB::Rails.configure do |config|
config.ignored_environments = Rails.application.config.influxdb_ignored_environments
config.async = true
config.debug = false
config.logger = Logging.logger['InfluxDB']
#config.logger = Logging.logger['InfluxDB']
config.series_name_for_controller_runtimes = "web.rails.controller"
config.series_name_for_view_runtimes = "web.rails.view"

View File

@ -1,3 +1,5 @@
require 'image_uploader'
class JamRuby::PromoBuzz < JamRuby::Promotional
mount_uploader :image, ImageUploader
end

View File

@ -1,4 +1,4 @@
class MaxMindManager < BaseManager
class MaxMindManager < JamRuby::BaseManager
def initialize(options={})
super(options)

View File

@ -15,7 +15,7 @@ describe ApiAffiliateController, type: :controller do
describe "traffic_index" do
it "empty" do
get :traffic_index
response.should be_success
response.should be_successful
JSON.parse(response.body)['traffics'].should eq([])
end
@ -23,7 +23,7 @@ describe ApiAffiliateController, type: :controller do
traffic_total = FactoryBot.create(:affiliate_traffic_total, affiliate_partner: partner1, visits: 5, signups: 0, day:Date.today)
get :traffic_index
response.should be_success
response.should be_successful
JSON.parse(response.body)['traffics'].should eq([{"day" => Date.today.to_s, "visits" => 5, "signups" => 0, "affiliate_partner_id" => partner1.id}])
end
end
@ -31,7 +31,7 @@ describe ApiAffiliateController, type: :controller do
describe "monthly_index" do
it "empty" do
get :monthly_index
response.should be_success
response.should be_successful
JSON.parse(response.body)['monthlies'].should eq([])
end
@ -39,7 +39,7 @@ describe ApiAffiliateController, type: :controller do
monthly = FactoryBot.create(:affiliate_monthly_payment, affiliate_partner: partner1, closed: true, due_amount_in_cents: 20, month: 1, year: 2015)
get :monthly_index
response.should be_success
response.should be_successful
JSON.parse(response.body)['monthlies'].should eq([{"closed" => true, "month" => 1, "year" => 2015, "due_amount_in_cents" => 20, "affiliate_partner_id" => partner1.id}])
end
end
@ -48,7 +48,7 @@ describe ApiAffiliateController, type: :controller do
describe "quarterly_index" do
it "empty" do
get :quarterly_index
response.should be_success
response.should be_successful
JSON.parse(response.body)['quarterlies'].should eq([])
end
@ -56,7 +56,7 @@ describe ApiAffiliateController, type: :controller do
quarterly = FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner: partner1, paid: true, closed: true, due_amount_in_cents: 20, quarter: 1, year: 2015)
get :quarterly_index
response.should be_success
response.should be_successful
JSON.parse(response.body)['quarterlies'].should eq([{"closed" => true, "paid" => true, "quarter" => 1, "year" => 2015, "due_amount_in_cents" => 20, "affiliate_partner_id" => partner1.id}])
end
@ -65,7 +65,7 @@ describe ApiAffiliateController, type: :controller do
quarterly = FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner: partner1, paid: false, closed: true, due_amount_in_cents: 20, quarter: 1, year: 2015)
get :quarterly_index
response.should be_success
response.should be_successful
JSON.parse(response.body)['quarterlies'].should eq([])
end
@ -74,7 +74,7 @@ describe ApiAffiliateController, type: :controller do
quarterly = FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner: partner1, paid: true, closed: false, due_amount_in_cents: 20, quarter: 1, year: 2015)
get :quarterly_index
response.should be_success
response.should be_successful
JSON.parse(response.body)['quarterlies'].should eq([])
end
end
@ -82,7 +82,7 @@ describe ApiAffiliateController, type: :controller do
describe "payment_index" do
it "empty" do
get :payment_index
response.should be_success
response.should be_successful
JSON.parse(response.body)['payments'].should eq([])
end
@ -90,7 +90,7 @@ describe ApiAffiliateController, type: :controller do
FactoryBot.create(:affiliate_monthly_payment, affiliate_partner: partner1, closed: true, due_amount_in_cents: 20, month: 1, year: 2015, jamtracks_sold: 1)
get :payment_index
response.should be_success
response.should be_successful
JSON.parse(response.body)['payments'].should eq([{"closed" => true, "paid" => nil, "payment_type" => "monthly", "quarter" => nil, "month" => 1, "year" => 2015, "due_amount_in_cents" => 20, "affiliate_partner_id" => partner1.id, "jamtracks_sold" => 1, "subscriptions" => [] }])
end
@ -106,7 +106,7 @@ describe ApiAffiliateController, type: :controller do
AffiliatePartner.tally_up(Date.new(2015, 1, 1))
get :payment_index
response.should be_success
response.should be_successful
expect(JSON.parse(response.body)['payments']).to have(6).things
expect(JSON.parse(response.body)['payments']).to include({"closed" => false, "paid" => nil, "payment_type" => "monthly", "quarter" => nil, "month" => 1, "year" => 2015, "due_amount_in_cents" => 15, "affiliate_partner_id" => partner1.id, "jamtracks_sold" => 0, "subscriptions" => [{ "plan" => "jamsubsilver", "count" => 1 }] })
end

View File

@ -12,8 +12,8 @@ describe ApiAppFeaturesController, type: :controller do
describe "index" do
it "returns app features of env" do
FactoryBot.create(:app_feature, env: 'production')
get :index, env: 'production'
response.should be_success
get :index, params: { env: 'production' }
response.should be_successful
json = JSON.parse(response.body, :symbolize_names => true)
json.should have(1).item
end

View File

@ -27,8 +27,8 @@ describe ApiClaimedRecordingsController, type: :controller do
it "should show the right thing when one recording just finished" do
controller.current_user = @user
get :show, {format:'json', id: @claimed_recording.id}
response.should be_success
get :show, params: { format:'json', id: @claimed_recording.id }
response.should be_successful
json = JSON.parse(response.body)
json.should_not be_nil
json["id"].should == @claimed_recording.id
@ -46,8 +46,8 @@ describe ApiClaimedRecordingsController, type: :controller do
pending
@recording.recorded_tracks.first.upload_complete
controller.current_user = @user
get :show, :id => @claimed_recording.id
response.should be_success
get :show, params: { :id => @claimed_recording.id }
response.should be_successful
json = JSON.parse(response.body)
json.should_not be_nil
json["recording"]["mixes"].length.should == 1
@ -63,8 +63,8 @@ describe ApiClaimedRecordingsController, type: :controller do
@mix = Mix.next("server")
@mix.finish(10000, "md5")
controller.current_user = @user
get :show, :id => @claimed_recording.id
response.should be_success
get :show, params: { :id => @claimed_recording.id }
response.should be_successful
json = JSON.parse(response.body)
json.should_not be_nil
json["recording"]["mixes"].length.should == 1
@ -77,7 +77,7 @@ describe ApiClaimedRecordingsController, type: :controller do
it "should generate a single output" do
controller.current_user = @user
get :index
response.should be_success
response.should be_successful
json = JSON.parse(response.body)
json.should_not be_nil
json.length.should == 1
@ -89,25 +89,25 @@ describe ApiClaimedRecordingsController, type: :controller do
describe "download" do
it "no mix" do
controller.current_user = @user
get :download, id: @claimed_recording.id
get :download, params: { id: @claimed_recording.id }
response.status.should == 404
end
it "quick mix, not completed" do
quick_mix = FactoryBot.create(:quick_mix)
controller.current_user = @user
get :download, id: quick_mix.recording.candidate_claimed_recording.id
get :download, params: { id: quick_mix.recording.candidate_claimed_recording.id }
response.status.should == 404
end
it "quick mix, completed" do
quick_mix = FactoryBot.create(:quick_mix_completed)
controller.current_user = @user
get :download, id: quick_mix.recording.candidate_claimed_recording.id
get :download, params: { id: quick_mix.recording.candidate_claimed_recording.id }
response.status.should == 302
response.headers['Location'].include?('recordings/ogg').should be true
get :download, id: quick_mix.recording.candidate_claimed_recording.id, type:'mp3'
get :download, params: { id: quick_mix.recording.candidate_claimed_recording.id, type:'mp3' }
response.status.should == 302
response.headers['Location'].include?('recordings/mp3').should be true
end
@ -115,18 +115,18 @@ describe ApiClaimedRecordingsController, type: :controller do
it "final mix, not completed" do
mix = FactoryBot.create(:mix, completed:false)
controller.current_user = @user
get :download, id: mix.recording.candidate_claimed_recording.id
get :download, params: { id: mix.recording.candidate_claimed_recording.id }
response.status.should == 404
end
it "final mix, completed" do
mix = FactoryBot.create(:mix, completed:true)
controller.current_user = @user
get :download, id: mix.recording.candidate_claimed_recording.id
get :download, params: { id: mix.recording.candidate_claimed_recording.id }
response.status.should == 302
response.headers['Location'].include?('recordings/mixed/ogg').should be true
get :download, id: mix.recording.candidate_claimed_recording.id, type:'mp3'
get :download, params: { id: mix.recording.candidate_claimed_recording.id, type:'mp3' }
response.status.should == 302
response.headers['Location'].include?('recordings/mixed/mp3').should be true
end
@ -136,11 +136,11 @@ describe ApiClaimedRecordingsController, type: :controller do
mix = FactoryBot.create(:mix, completed:true)
quick_mix = FactoryBot.create(:quick_mix_completed, recording: mix.recording, user: mix.recording.owner)
controller.current_user = @user
get :download, id: mix.recording.candidate_claimed_recording.id
get :download, params: { id: mix.recording.candidate_claimed_recording.id }
response.status.should == 302
response.headers['Location'].include?('recordings/mixed/ogg').should be true
get :download, id: mix.recording.candidate_claimed_recording.id, type:'mp3'
get :download, params: { id: mix.recording.candidate_claimed_recording.id, type:'mp3' }
response.status.should == 302
response.headers['Location'].include?('recordings/mixed/mp3').should be true
end
@ -150,11 +150,11 @@ describe ApiClaimedRecordingsController, type: :controller do
mix = FactoryBot.create(:mix, completed:false)
quick_mix = FactoryBot.create(:quick_mix_completed, recording: mix.recording, user: mix.recording.owner)
controller.current_user = @user
get :download, id: mix.recording.candidate_claimed_recording.id
get :download, params: { id: mix.recording.candidate_claimed_recording.id }
response.status.should == 302
response.headers['Location'].include?('recordings/ogg').should be true
get :download, id: quick_mix.recording.candidate_claimed_recording.id, type:'mp3'
get :download, params: { id: quick_mix.recording.candidate_claimed_recording.id, type:'mp3' }
response.status.should == 302
response.headers['Location'].include?('recordings/mp3').should be true
end
@ -167,11 +167,11 @@ describe ApiClaimedRecordingsController, type: :controller do
describe "DELETE 'destroy'" do
it "should delete properly" do
controller.current_user = @user
delete :delete, :id => @claimed_recording.id
delete :delete, params: { :id => @claimed_recording.id }
puts response
puts response.body
response.should be_success
response.should be_successful
expect { ClaimedRecording.find(@claimed_recording.id) }.to raise_error
end
end

View File

@ -9,8 +9,8 @@ describe ApiCorporateController, type: :controller do
describe "success" do
it "should work" do
post :feedback, :email => "seth@jamkazam.com", :body => "Hey could someone help me?"
response.should be_success
post :feedback, params: { :email => "seth@jamkazam.com", :body => "Hey could someone help me?" }
response.should be_successful
CorpMailer.deliveries.length.should == 1
end
@ -18,7 +18,7 @@ describe ApiCorporateController, type: :controller do
describe "fail" do
it "should fail due to bad email" do
post :feedback, :email => "seth", :body => "Hey could someone help me?"
post :feedback, params: { :email => "seth", :body => "Hey could someone help me?" }
response.status.should == 422
CorpMailer.deliveries.length.should == 0
error = JSON.parse(response.body)

View File

@ -28,8 +28,7 @@ describe ApiFavoritesController, type: :controller do
it "can return nothing" do
controller.current_user = user
get :index, { user: user}
get :index, params: { user: user }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 0
json[:since].should be_nil
@ -40,8 +39,7 @@ describe ApiFavoritesController, type: :controller do
like = FactoryBot.create(:recording_like, user: user, claimed_recording: claimed_recording, recording: claimed_recording.recording, favorite: true)
controller.current_user = user
get :index, { user: user}
get :index, params: { user: user }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 1
json[:since].should be_nil
@ -52,20 +50,20 @@ describe ApiFavoritesController, type: :controller do
describe "update" do
it "insists on login" do
post :update, {id: '1'}
post :update, params: { id: '1' }
response.status.should == 403
end
it "404 if no like for record" do
controller.current_user = user
post :update, {id: claimed_recording.id}
post :update, params: { id: claimed_recording.id }
response.status.should == 404
end
it "no favorite specified leaves record alone" do
controller.current_user = user
like = FactoryBot.create(:recording_like, user: user, claimed_recording: claimed_recording, recording: claimed_recording.recording, favorite: true)
post :update, {:format => 'json', id: claimed_recording.id}
post :update, params: { :format => 'json', id: claimed_recording.id }
response.status.should == 200
like.reload
@ -75,7 +73,7 @@ describe ApiFavoritesController, type: :controller do
it "can set favorite to false" do
controller.current_user = user
like = FactoryBot.create(:recording_like, user: user, claimed_recording: claimed_recording, recording: claimed_recording.recording, favorite: true)
post :update, {:format => 'json', id: claimed_recording.id, favorite:false}
post :update, params: { :format => 'json', id: claimed_recording.id, favorite:false }
response.status.should == 200
like.reload

View File

@ -60,7 +60,7 @@ describe ApiFeedsController, type: :controller do
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 1
get :index, { time_range:'today' }
get :index, params: { time_range:'today' }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 0
end
@ -75,12 +75,12 @@ describe ApiFeedsController, type: :controller do
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 2
get :index, { type: 'recording'}
get :index, params: { type: 'recording' }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 1
json[:entries][0][:type].should == 'recording'
get :index, { type: 'music_session'}
get :index, params: { type: 'music_session' }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 1
json[:entries][0][:type].should == 'music_session'
@ -97,19 +97,19 @@ describe ApiFeedsController, type: :controller do
ams = ActiveMusicSession.find(claimed_recording.recording.music_session.music_session.id)
ams.before_destroy
get :index, { limit: 1 }
get :index, params: { limit: 1 }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 1
_next = json[:next_page]
_next.should_not be_nil
get :index, { limit: 1, next_page: _next }
get :index, params: { limit: 1, next_page: _next }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 1
_next = json[:next_page]
_next.should_not be_nil
get :index, { limit: 1, next_page: _next }
get :index, params: { limit: 1, next_page: _next }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 0
_next = json[:next_page]
@ -124,7 +124,7 @@ describe ApiFeedsController, type: :controller do
music_session.music_session.save!
controller.current_user = music_session.creator
get :index, { user: music_session.creator.id }
get :index, params: { user: music_session.creator.id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 1
@ -139,7 +139,7 @@ describe ApiFeedsController, type: :controller do
music_session.music_session.reload
music_session.music_session.fan_access.should be false
get :index, { user: music_session.creator.id }
get :index, params: { user: music_session.creator.id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 1
@ -161,7 +161,7 @@ describe ApiFeedsController, type: :controller do
controller.current_user = user
get :index, { band: band.id }
get :index, params: { band: band.id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 1
@ -181,7 +181,7 @@ describe ApiFeedsController, type: :controller do
controller.current_user = user2
get :index, { band: band.id }
get :index, params: { band: band.id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:entries].length.should == 1

View File

@ -14,8 +14,7 @@ describe ApiIcecastController, type: :controller do
it "success" do
post :create_source_change, {format:'json', id: mount.id, success: true, source_direction: true, reason: 'blah', client_id: 'abc'}
post :create_source_change, params: { format:'json', id: mount.id, success: true, source_direction: true, reason: 'blah', client_id: 'abc' }
response.status.should == 200
end
end

View File

@ -19,7 +19,7 @@ describe ApiJamTrackMixdownsController, type: :controller do
it "one result" do
# make a mixdown with no packages
get :index, {id: mixdown.jam_track.id}
get :index, params: { id: mixdown.jam_track.id }
response.status.should eq(200)
json = JSON.parse(response.body)
json["next"].should be_nil
@ -29,7 +29,7 @@ describe ApiJamTrackMixdownsController, type: :controller do
# and then add a package
package = FactoryBot.create(:jam_track_mixdown_package, jam_track_mixdown: mixdown)
get :index, {id: mixdown.jam_track.id}
get :index, params: { id: mixdown.jam_track.id }
response.status.should eq(200)
json = JSON.parse(response.body)
json["next"].should be_nil
@ -41,8 +41,7 @@ describe ApiJamTrackMixdownsController, type: :controller do
describe "create" do
it "success" do
post :create, {:format => 'json', jamTrackID: jam_track.id, name: 'some name', description: 'some description', settings: {speed:5}}
post :create, params: { :format => 'json', jamTrackID: jam_track.id, name: 'some name', description: 'some description', settings: {speed:5} }
response.status.should eq(200)
json = JSON.parse(response.body)
@ -54,8 +53,7 @@ describe ApiJamTrackMixdownsController, type: :controller do
end
it "validates name" do
post :create, {:format => 'json', jamTrackID: jam_track.id, description: 'some description', settings: {speed:5}}
post :create, params: { :format => 'json', jamTrackID: jam_track.id, description: 'some description', settings: {speed:5} }
response.status.should eq(422)
json = JSON.parse(response.body)
@ -67,8 +65,7 @@ describe ApiJamTrackMixdownsController, type: :controller do
it "success" do
jam_track_right.touch
post :enqueue, {:format => 'json', id: mixdown.id, file_type: JamTrackMixdownPackage::FILE_TYPE_AAC, encrypt_type: nil, sample_rate: 48}
post :enqueue, params: { :format => 'json', id: mixdown.id, file_type: JamTrackMixdownPackage::FILE_TYPE_AAC, encrypt_type: nil, sample_rate: 48 }
response.status.should eq(200)
json = JSON.parse(response.body)
@ -83,8 +80,7 @@ describe ApiJamTrackMixdownsController, type: :controller do
it "validates file_type" do
jam_track_right.touch
post :enqueue, {:format => 'json', id: mixdown.id, file_type: 'wrong', encrypt_type: nil, sample_rate: 48}
post :enqueue, params: { :format => 'json', id: mixdown.id, file_type: 'wrong', encrypt_type: nil, sample_rate: 48 }
response.status.should eq(422)
json = JSON.parse(response.body)
@ -97,8 +93,7 @@ describe ApiJamTrackMixdownsController, type: :controller do
JamTrackMixdownPackage.count.should eq(1)
package.jam_track_mixdown.should eq(mixdown)
post :enqueue, {:format => 'json', id: mixdown.id, file_type: package.file_type, encrypt_type: package.encrypt_type, sample_rate: package.sample_rate}
post :enqueue, params: { :format => 'json', id: mixdown.id, file_type: package.file_type, encrypt_type: package.encrypt_type, sample_rate: package.sample_rate }
response.status.should eq(200)
json = JSON.parse(response.body)
@ -115,8 +110,7 @@ describe ApiJamTrackMixdownsController, type: :controller do
jam_track_right.touch
package.touch
post :download, {:format => 'json', id: mixdown.id, file_type: package.file_type, encrypt_type: package.encrypt_type, sample_rate: package.sample_rate}
post :download, params: { :format => 'json', id: mixdown.id, file_type: package.file_type, encrypt_type: package.encrypt_type, sample_rate: package.sample_rate }
response.status.should eq(202)
json = JSON.parse(response.body)
@ -135,8 +129,7 @@ describe ApiJamTrackMixdownsController, type: :controller do
package.url = 'some/bogus/place'
package.save!
post :download, {:format => 'json', id: mixdown.id, file_type: package.file_type, encrypt_type: package.encrypt_type, sample_rate: package.sample_rate}
post :download, params: { :format => 'json', id: mixdown.id, file_type: package.file_type, encrypt_type: package.encrypt_type, sample_rate: package.sample_rate }
response.status.should eq(302)
response['Location'].should include('/some/bogus/place')

View File

@ -28,8 +28,7 @@ describe ApiJamTracksController, type: :controller do
describe "ios_order_placed" do
it "succeeds" do
post :ios_order_placed, { jam_track_id: @jam_track.id }
post :ios_order_placed, params: { jam_track_id: @jam_track.id }
response.status.should == 200
right = @jam_track.right_for_user(@user)
right.id.should eq(JSON.parse(response.body)["jam_track_right_id"])
@ -44,7 +43,7 @@ describe ApiJamTracksController, type: :controller do
it "can see unavailable" do
get :index
response.should be_success
response.should be_successful
json = JSON.parse(response.body)
json["next"].should be_nil
json["jamtracks"].length.should == 2
@ -52,7 +51,7 @@ describe ApiJamTracksController, type: :controller do
# Create another unavailable track and see:
jam_track2 = FactoryBot.create(:jam_track, :status => 'Staging')
get :index
response.should be_success
response.should be_successful
json = JSON.parse(response.body)
json["next"].should be_nil
json["jamtracks"].length.should == 3
@ -62,14 +61,14 @@ describe ApiJamTracksController, type: :controller do
describe "download functionality" do
it "lists available tracks" do
get :index
response.should be_success
response.should be_successful
json = JSON.parse(response.body)
json["next"].should be_nil
json["jamtracks"].length.should == 1
jam_track2 = FactoryBot.create(:jam_track)
get :index
response.should be_success
response.should be_successful
json = JSON.parse(response.body)
json["next"].should be_nil
json["jamtracks"].length.should == 2
@ -78,9 +77,8 @@ describe ApiJamTracksController, type: :controller do
it "finds a download" do
#get "/download/#{right.id}/"
right = JamTrackRight.create(:user=>@user, :jam_track=>@jam_track)
get :download, { :format=>'json', :id=>@jam_track.id, all_fp: 'all', running_fp: 'running' }
response.should be_success
get :download, params: { :format=>'json', :id=>@jam_track.id, all_fp: 'all', running_fp: 'running' }
response.should be_successful
response.status.should == 202
response.body.should =~ /not available.*/
end
@ -89,7 +87,7 @@ describe ApiJamTracksController, type: :controller do
describe "purchased" do
it "can return empty" do
get :purchased
response.should be_success
response.should be_successful
json = JSON.parse(response.body)
json['jamtracks'].length.should eq(0)
json['next'].should eq(nil)
@ -100,7 +98,7 @@ describe ApiJamTracksController, type: :controller do
right = FactoryBot.create(:jam_track_right, jam_track: @jam_track, user: @user)
get :purchased
response.should be_success
response.should be_successful
json = JSON.parse(response.body)
json['jamtracks'].length.should eq(1)
json['jamtracks'][0]['jam_track_right_id'].should eq(right.id)
@ -110,21 +108,21 @@ describe ApiJamTracksController, type: :controller do
describe "jamtrack plays" do
it "handle api call success" do
post :played, { id: @jam_track.id, user: @user }
post :played, params: { id: @jam_track.id, user: @user }
expect(response.status).to eq(201)
json = JSON.parse(response.body)
expect(json.length).to eq(0)
end
it "handle api call 400" do
post :played, { id: '', user: @user }
post :played, params: { id: '', user: @user }
expect(response.status).to eq(400)
json = JSON.parse(response.body)
expect(/JamTrack ID required/).to match(json['message'])
end
it "handle api call 500" do
post :played, { id: 999, user: @user }
post :played, params: { id: 999, user: @user }
expect(response.status).to eq(422)
json = JSON.parse(response.body)
expect(/Unexpected error occurred/).to match(json['message'])
@ -158,11 +156,11 @@ describe ApiJamTracksController, type: :controller do
it "download depends on rights" do
fingerprint={all:'all', running:'running'}
get :download, :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running'
get :download, params: { :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running' }
response.status.should == 403
right = JamTrackRight.create(:user=>@user, :jam_track=>@jam_track)
get :download, :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running'
get :download, params: { :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running' }
response.status.should == 202
right.download_count.should eq(0)
right.private_key_44.should_not be_nil
@ -181,7 +179,7 @@ describe ApiJamTracksController, type: :controller do
right.private_key_48.should_not be_nil
right.download_count.should eq(0)
get :download, :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running'
get :download, params: { :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running' }
response.status.should == 302
response.location.should =~ /.*#{Regexp.escape(right.filename(:url_48))}.*/
right.reload
@ -189,11 +187,11 @@ describe ApiJamTracksController, type: :controller do
end
it "supports multiple bitrates" do
get :download, :id=>@jam_track.id, :sample_rate=>44, all_fp: 'all', running_fp: 'running'
get :download, params: { :id=>@jam_track.id, :sample_rate=>44, all_fp: 'all', running_fp: 'running' }
response.status.should == 403
right = JamTrackRight.create(:user=>@user, :jam_track=>@jam_track)
get :download, :id=>@jam_track.id, :sample_rate=>44, all_fp: 'all', running_fp: 'running'
get :download, params: { :id=>@jam_track.id, :sample_rate=>44, all_fp: 'all', running_fp: 'running' }
response.status.should == 202
right.download_count.should eq(0)
right.private_key_44.should_not be_nil
@ -212,7 +210,7 @@ describe ApiJamTracksController, type: :controller do
right.private_key_48.should_not be_nil
right.download_count.should eq(0)
get :download, :id=>@jam_track.id, :sample_rate=>44, all_fp: 'all', running_fp: 'running'
get :download, params: { :id=>@jam_track.id, :sample_rate=>44, all_fp: 'all', running_fp: 'running' }
response.status.should == 302
response.location.should =~ /.*#{Regexp.escape(right.filename(:url_44))}.*/
right.reload
@ -222,14 +220,14 @@ describe ApiJamTracksController, type: :controller do
describe "keys" do
it "empty" do
get :keys, jamtracks: {tracks: []}
get :keys, params: { jamtracks: {tracks: []} }
response.status.should == 200
json = JSON.parse(response.body)
json.length == 0
end
it "track with no rights" do
get :keys, jamtracks: { tracks: ["#{@jam_track.id}-44"] }
get :keys, params: { jamtracks: { tracks: ["#{@jam_track.id}-44"] } }
response.status.should == 200
json = JSON.parse(response.body)
json.length.should == 1
@ -244,7 +242,7 @@ describe ApiJamTracksController, type: :controller do
right = FactoryBot.create(:jam_track_right, user: @user, private_key_44: nil, private_key_48:nil, jam_track: @jam_track)
get :keys, jamtracks: { tracks: ["#{@jam_track.id}-44", "#{@jam_track.id}-48"] }
get :keys, params: { jamtracks: { tracks: ["#{@jam_track.id}-44", "#{@jam_track.id}-48"] } }
response.status.should == 200
json = JSON.parse(response.body)
json.length.should == 1
@ -258,7 +256,7 @@ describe ApiJamTracksController, type: :controller do
it "track with key" do
right = FactoryBot.create(:jam_track_right, user: @user, private_key_44: 'abc', private_key_48:nil, jam_track: @jam_track)
get :keys, jamtracks: { tracks: ["#{@jam_track.id}-44", "#{@jam_track.id}-48"] }
get :keys, params: { jamtracks: { tracks: ["#{@jam_track.id}-44", "#{@jam_track.id}-48"] } }
response.status.should == 200
json = JSON.parse(response.body)
json.length.should == 1
@ -273,7 +271,7 @@ describe ApiJamTracksController, type: :controller do
it "non-owning user asking for a real track" do
right = FactoryBot.create(:jam_track_right, user: FactoryBot.create(:user), private_key_44: 'abc', private_key_48:nil, jam_track: @jam_track)
get :keys, jamtracks: { tracks: ["#{@jam_track.id}-44", "#{@jam_track.id}-48"] }
get :keys, params: { jamtracks: { tracks: ["#{@jam_track.id}-44", "#{@jam_track.id}-48"] } }
response.status.should == 200
json = JSON.parse(response.body)
json[0]['id'].should == @jam_track.id.to_s
@ -290,8 +288,8 @@ describe ApiJamTracksController, type: :controller do
it "success" do
right = FactoryBot.create(:jam_track_right, user: @user, signed_44: false, signed_48:false)
right.signing_queued_at.should be_nil
post :enqueue, {:format=>'json', :id=>right.jam_track.id, fingerprint: {all: 'all', running: 'running'} }
response.should be_success
post :enqueue, params: { :format=>'json', :id=>right.jam_track.id, fingerprint: {all: 'all', running: 'running'} }
response.should be_successful
right.reload
right.signing_queued_at.should_not be_nil
@ -302,8 +300,8 @@ describe ApiJamTracksController, type: :controller do
it "success" do
right = FactoryBot.create(:jam_track_right, user: @user)
get :show_jam_track_right, {:id=>right.jam_track.id}
response.should be_success
get :show_jam_track_right, params: { :id=>right.jam_track.id }
response.should be_successful
json = JSON.parse(response.body)
json['signing_state'].should eq('QUIET')
json['error_count'].should eq(0)
@ -320,7 +318,7 @@ describe ApiJamTracksController, type: :controller do
right = JamTrackRight.create(:user=>@user, :jam_track=>@jam_track)
right.redeemed = true
right.save!
get :download, :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running'
get :download, params: { :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running' }
response.status.should == 202
MachineFingerprint.count.should eq(2)
@ -331,7 +329,7 @@ describe ApiJamTracksController, type: :controller do
right = JamTrackRight.create(:user=>user2, :jam_track=>@jam_track)
right.redeemed = true
right.save!
get :download, :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running'
get :download, params: { :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running' }
response.status.should == 202
# no error for the user... but we should have a FraudAlert
@ -343,8 +341,8 @@ describe ApiJamTracksController, type: :controller do
right.redeemed = true
right.save!
right.signing_queued_at.should be_nil
post :enqueue, {:format=>'json', :id=>right.jam_track.id, fingerprint: {all: 'all', running: 'running'} }
response.should be_success
post :enqueue, params: { :format=>'json', :id=>right.jam_track.id, fingerprint: {all: 'all', running: 'running'} }
response.should be_successful
user2 = FactoryBot.create(:user)
@ -354,9 +352,9 @@ describe ApiJamTracksController, type: :controller do
right.redeemed = true
right.save!
right.signing_queued_at.should be_nil
post :enqueue, {:format=>'json', :id=>right.jam_track.id, fingerprint: {all: 'all', running: 'running'} }
post :enqueue, params: { :format=>'json', :id=>right.jam_track.id, fingerprint: {all: 'all', running: 'running'} }
response.status.should == 200
get :download, :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running'
get :download, params: { :id=>@jam_track.id, sample_rate: 48, all_fp: 'all', running_fp: 'running' }
response.status.should == 202
FraudAlert.count.should eq(1)
end

View File

@ -17,7 +17,7 @@ describe ApiJamblastersController, type: :controller do
it "works" do
connection1 = FactoryBot.create(:connection, :user => user, client_id: 'abc1')
get :can_pair, {:format => 'json', jbid: connection1.client_id, user_id: user.id}
get :can_pair, params: { :format => 'json', jbid: connection1.client_id, user_id: user.id }
response.status.should == 200
end
end
@ -30,21 +30,21 @@ describe ApiJamblastersController, type: :controller do
end
it "works" do
get :is_allowed, {:format => 'json', jbid: jamblaster.client_id, user_id: user.id}
get :is_allowed, params: { :format => 'json', jbid: jamblaster.client_id, user_id: user.id }
response.status.should == 200
end
#it "disallows different user" do
# user2 = FactoryBot.create(:user)
# get :is_allowed, {:format => 'json', jbid: jamblaster.client_id, user_id: user2.id}
# get :is_allowed, params: { :format => 'json', jbid: jamblaster.client_id, user_id: user2.id }
# response.status.should == 403
#end
end
describe "not already associated" do
it "works" do
get :is_allowed, {:format => 'json', jbid: jamblaster.client_id, user_id: user.id}
get :is_allowed, params: { :format => 'json', jbid: jamblaster.client_id, user_id: user.id }
response.status.should == 200
end
end
@ -58,7 +58,7 @@ describe ApiJamblastersController, type: :controller do
end
it "works" do
get :auth_users, {:format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no}
get :auth_users, params: { :format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no }
response.status.should == 200
json = JSON.parse(response.body)
json["pairing"].should be nil
@ -67,7 +67,7 @@ describe ApiJamblastersController, type: :controller do
pairing1 = FactoryBot.create(:jamblaster_pairing_request, user: user, jamblaster: jamblaster, vtoken:'token2', sibling_key:nil)
get :auth_users, {:format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no}
get :auth_users, params: { :format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no }
response.status.should == 200
json = JSON.parse(response.body)
json["pairing"].should be nil
@ -75,7 +75,7 @@ describe ApiJamblastersController, type: :controller do
pairing1.activate('abc')
pairing1.errors.any?.should be false
get :auth_users, {:format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no}
get :auth_users, params: { :format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no }
response.status.should == 200
json = JSON.parse(response.body)
json["pairing"]["key"].should eql 'abc'
@ -84,7 +84,7 @@ describe ApiJamblastersController, type: :controller do
describe "not already associated" do
it "works" do
get :auth_users, {:format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no}
get :auth_users, params: { :format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no }
response.status.should == 200
json = JSON.parse(response.body)
json["pairing"].should be nil
@ -100,7 +100,7 @@ describe ApiJamblastersController, type: :controller do
}
it "works" do
get :get_tokens, {:format => 'json'}
get :get_tokens, params: { :format => 'json' }
response.status.should == 200
json = JSON.parse(response.body)
json.length.should eq(0)
@ -111,7 +111,7 @@ describe ApiJamblastersController, type: :controller do
user.jamblasters << jamblaster
user.save!
get :get_tokens, {:format => 'json'}
get :get_tokens, params: { :format => 'json' }
response.status.should == 200
json = JSON.parse(response.body)
json.length.should eq(1)
@ -131,7 +131,7 @@ describe ApiJamblastersController, type: :controller do
end
it "works" do
post :start_pairing, {:format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken'}
post :start_pairing, params: { :format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken' }
response.status.should == 200
json = JSON.parse(response.body)
@ -143,7 +143,7 @@ describe ApiJamblastersController, type: :controller do
end
it "returns 422 if bogus jamblaster" do
post :start_pairing, {:format => 'json', jbid: 'nada', vtoken: 'vtoken'}
post :start_pairing, params: { :format => 'json', jbid: 'nada', vtoken: 'vtoken' }
json = JSON.parse(response.body)
response.status.should == 422
json = JSON.parse(response.body)
@ -157,7 +157,7 @@ describe ApiJamblastersController, type: :controller do
describe "not already associated" do
it "works" do
post :start_pairing, {:format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken'}
post :start_pairing, params: { :format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken' }
response.status.should == 200
json = JSON.parse(response.body)
@ -169,7 +169,7 @@ describe ApiJamblastersController, type: :controller do
end
it "returns 422 if bogus jamblaster" do
post :start_pairing, {:format => 'json', jbid: 'nada', vtoken: 'vtoken'}
post :start_pairing, params: { :format => 'json', jbid: 'nada', vtoken: 'vtoken' }
json = JSON.parse(response.body)
response.status.should == 422
json = JSON.parse(response.body)
@ -196,7 +196,7 @@ describe ApiJamblastersController, type: :controller do
end
it "works" do
post :start_pairing, {:format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken2'}
post :start_pairing, params: { :format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken2' }
response.status.should == 200
request = JamblasterPairingRequest.where(jamblaster_client_id: jamblaster.client_id, vtoken: 'vtoken2', user_id: user.id).first
@ -205,7 +205,7 @@ describe ApiJamblastersController, type: :controller do
request.vtoken.should eq 'vtoken2'
request.jamblaster_client_id.should eq jamblaster.client_id
post :login, {:format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user.id, vtoken: 'vtoken2'}
post :login, params: { :format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user.id, vtoken: 'vtoken2' }
json = JSON.parse(response.body)
response.status.should == 200
end
@ -213,7 +213,7 @@ describe ApiJamblastersController, type: :controller do
describe "not already associated" do
it "works" do
post :start_pairing, {:format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken2'}
post :start_pairing, params: { :format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken2' }
response.status.should == 200
request = JamblasterPairingRequest.where(jamblaster_client_id: jamblaster.client_id, vtoken: 'vtoken2', user_id: user.id).first
@ -222,7 +222,7 @@ describe ApiJamblastersController, type: :controller do
request.vtoken.should eq 'vtoken2'
request.jamblaster_client_id.should eq jamblaster.client_id
post :login, {:format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user.id, vtoken: 'vtoken2'}
post :login, params: { :format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user.id, vtoken: 'vtoken2' }
json = JSON.parse(response.body)
response.status.should == 200
end
@ -244,7 +244,7 @@ describe ApiJamblastersController, type: :controller do
end
it "works" do
post :start_pairing, {:format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken4'}
post :start_pairing, params: { :format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken4' }
response.status.should == 200
request = JamblasterPairingRequest.where(jamblaster_client_id: jamblaster.client_id, vtoken: 'vtoken4', user_id: user.id).first
@ -253,16 +253,16 @@ describe ApiJamblastersController, type: :controller do
request.vtoken.should eq 'vtoken4'
request.jamblaster_client_id.should eq jamblaster.client_id
post :login, {:format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user.id, vtoken: 'vtoken4'}
post :login, params: { :format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user.id, vtoken: 'vtoken4' }
json = JSON.parse(response.body)
response.status.should == 200
post :pair, {:format => 'json', vtoken: 'vtoken4', user_id: user.id, jbid: jamblaster.client_id, key: 'abc'}
post :pair, params: { :format => 'json', vtoken: 'vtoken4', user_id: user.id, jbid: jamblaster.client_id, key: 'abc' }
response.status.should == 200
json = JSON.parse(response.body)
json["id"].should eq jamblaster.id
get :get_tokens, {:format => 'json'}
get :get_tokens, params: { :format => 'json' }
response.status.should == 200
json = JSON.parse(response.body)
json.length.should eq(1)
@ -273,7 +273,7 @@ describe ApiJamblastersController, type: :controller do
describe "not already associated" do
it "works" do
post :start_pairing, {:format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken4'}
post :start_pairing, params: { :format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken4' }
response.status.should == 200
request = JamblasterPairingRequest.where(jamblaster_client_id: jamblaster.client_id, vtoken: 'vtoken4', user_id: user.id).first
@ -282,19 +282,19 @@ describe ApiJamblastersController, type: :controller do
request.vtoken.should eq 'vtoken4'
request.jamblaster_client_id.should eq jamblaster.client_id
post :login, {:format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user.id, vtoken: 'vtoken4'}
post :login, params: { :format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user.id, vtoken: 'vtoken4' }
json = JSON.parse(response.body)
response.status.should == 200
jamblaster.reload
jamblaster.users.include?(user).should be false
post :pair, {:format => 'json', vtoken: 'vtoken4', user_id: user.id, jbid: jamblaster.client_id, key: 'abc'}
post :pair, params: { :format => 'json', vtoken: 'vtoken4', user_id: user.id, jbid: jamblaster.client_id, key: 'abc' }
response.status.should == 200
json = JSON.parse(response.body)
json["id"].should eq jamblaster.id
get :get_tokens, {:format => 'json'}
get :get_tokens, params: { :format => 'json' }
response.status.should == 200
json = JSON.parse(response.body)
json.length.should eq(1)
@ -306,7 +306,7 @@ describe ApiJamblastersController, type: :controller do
end
it "across two users" do
post :start_pairing, {:format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken4'}
post :start_pairing, params: { :format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken4' }
response.status.should == 200
request = JamblasterPairingRequest.where(jamblaster_client_id: jamblaster.client_id, vtoken: 'vtoken4', user_id: user.id).first
@ -315,19 +315,19 @@ describe ApiJamblastersController, type: :controller do
request.vtoken.should eq 'vtoken4'
request.jamblaster_client_id.should eq jamblaster.client_id
post :login, {:format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user.id, vtoken: 'vtoken4'}
post :login, params: { :format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user.id, vtoken: 'vtoken4' }
json = JSON.parse(response.body)
response.status.should == 200
jamblaster.reload
jamblaster.users.include?(user).should be false
post :pair, {:format => 'json', vtoken: 'vtoken4', user_id: user.id, jbid: jamblaster.client_id, key: 'abc'}
post :pair, params: { :format => 'json', vtoken: 'vtoken4', user_id: user.id, jbid: jamblaster.client_id, key: 'abc' }
response.status.should == 200
json = JSON.parse(response.body)
json["id"].should eq jamblaster.id
get :get_tokens, {:format => 'json'}
get :get_tokens, params: { :format => 'json' }
response.status.should == 200
json = JSON.parse(response.body)
json.length.should eq(1)
@ -342,7 +342,7 @@ describe ApiJamblastersController, type: :controller do
controller.current_user = user2
post :start_pairing, {:format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken5'}
post :start_pairing, params: { :format => 'json', jbid: jamblaster.client_id, vtoken: 'vtoken5' }
response.status.should == 200
puts "JSON.parse(response.body) #{JSON.parse(response.body)}"
@ -352,19 +352,19 @@ describe ApiJamblastersController, type: :controller do
request.vtoken.should eq 'vtoken5'
request.jamblaster_client_id.should eq jamblaster.client_id
post :login, {:format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user2.id, vtoken: 'vtoken5'}
post :login, params: { :format => 'json', jbid: jamblaster.client_id, serial_no: jamblaster.serial_no, user_id: user2.id, vtoken: 'vtoken5' }
json = JSON.parse(response.body)
response.status.should == 200
jamblaster.reload
jamblaster.users.include?(user2).should be false
post :pair, {:format => 'json', vtoken: 'vtoken5', user_id: user2.id, jbid: jamblaster.client_id, key: 'abcd'}
post :pair, params: { :format => 'json', vtoken: 'vtoken5', user_id: user2.id, jbid: jamblaster.client_id, key: 'abcd' }
response.status.should == 200
json = JSON.parse(response.body)
json["id"].should eq jamblaster.id
get :get_tokens, {:format => 'json'}
get :get_tokens, params: { :format => 'json' }
response.status.should == 200
json = JSON.parse(response.body)
json.length.should eq(1)
@ -384,17 +384,17 @@ describe ApiJamblastersController, type: :controller do
end
it "get_tokens" do
get :get_tokens, {:format => 'json'}
get :get_tokens, params: { :format => 'json' }
response.status.should == 200
end
it "start_pairing" do
post :start_pairing, {:format => 'json'}
post :start_pairing, params: { :format => 'json' }
response.status.should == 422
end
it "pair" do
post :pair, {:format => 'json'}
post :pair, params: { :format => 'json' }
response.status.should == 404
end
end
@ -405,17 +405,17 @@ describe ApiJamblastersController, type: :controller do
end
it "get_tokens" do
get :get_tokens, {:format => 'json'}
get :get_tokens, params: { :format => 'json' }
response.status.should == 403
end
it "start_pairing" do
post :start_pairing, {:format => 'json'}
post :start_pairing, params: { :format => 'json' }
response.status.should == 403
end
it "pair" do
post :pair, {:format => 'json'}
post :pair, params: { :format => 'json' }
response.status.should == 403
end
end

View File

@ -17,7 +17,7 @@ describe ApiLinksController, type: :controller do
describe "jamtrack_song_index" do
it "succeeds with empty data" do
get :jamtrack_song_index, format:'json', affiliate_id: partner1.id
get :jamtrack_song_index, params: { format:'json', affiliate_id: partner1.id }
response.status.should eq(200)
body = JSON.parse(response.body)
body.length.should eq(0)
@ -25,7 +25,7 @@ describe ApiLinksController, type: :controller do
it "succeeds with data" do
jam_track = FactoryBot.create(:jam_track)
get :jamtrack_song_index, format:'json', affiliate_id: partner1.id
get :jamtrack_song_index, params: { format:'json', affiliate_id: partner1.id }
response.status.should eq(200)
body = JSON.parse(response.body)
body.length.should eq(1)
@ -36,7 +36,7 @@ describe ApiLinksController, type: :controller do
describe "jamkazam_general_index" do
it "succeeds" do
get :jamkazam_general_index, format:'json', affiliate_id: partner1.id
get :jamkazam_general_index, params: { format:'json', affiliate_id: partner1.id }
response.status.should eq(200)
body = JSON.parse(response.body)
body.length.should eq(3)
@ -68,7 +68,7 @@ describe ApiLinksController, type: :controller do
}
it "succeeds with no data" do
get :session_index, format:'json', affiliate_id: partner1.id
get :session_index, params: { format:'json', affiliate_id: partner1.id }
response.status.should eq(200)
body = JSON.parse(response.body)
body.length.should eq(0)
@ -77,7 +77,7 @@ describe ApiLinksController, type: :controller do
it "succeeds with one scheduled session" do
session = MusicSession.create(user_partner1, open_params)
get :session_index, format:'json', affiliate_id: partner1.id
get :session_index, params: { format:'json', affiliate_id: partner1.id }
response.status.should eq(200)
body = JSON.parse(response.body)
body.length.should eq(1)
@ -87,7 +87,7 @@ describe ApiLinksController, type: :controller do
describe "recording_index" do
it "succeeds with no data" do
get :recording_index, format:'json', affiliate_id: partner1.id
get :recording_index, params: { format:'json', affiliate_id: partner1.id }
response.status.should eq(200)
body = JSON.parse(response.body)
body.length.should eq(0)
@ -95,7 +95,7 @@ describe ApiLinksController, type: :controller do
it "succeeds with one recording" do
claimed_recording1 = FactoryBot.create(:claimed_recording, user: user_partner1)
get :recording_index, format:'json', affiliate_id: partner1.id
get :recording_index, params: { format:'json', affiliate_id: partner1.id }
response.status.should eq(200)
body = JSON.parse(response.body)
body.length.should eq(1)

View File

@ -13,13 +13,13 @@ describe ApiMixesController, type: :controller do
it "is possible" do
controller.current_user = mix.recording.owner
get :download, {id: mix.id}
get :download, params: { id: mix.id }
response.status.should == 302
mix.reload
mix.download_count.should == 1
get :download, {id: mix.id}
get :download, params: { id: mix.id }
response.status.should == 302
mix.reload
@ -31,7 +31,7 @@ describe ApiMixesController, type: :controller do
mix.download_count = APP_CONFIG.max_audio_downloads
mix.save!
controller.current_user = mix.recording.owner
get :download, {format:'json', id: mix.id}
get :download, params: { format:'json', id: mix.id }
response.status.should == 404
JSON.parse(response.body, symbolize_names: true)[:message].should == "download limit surpassed"
end
@ -44,7 +44,7 @@ describe ApiMixesController, type: :controller do
mix.recording.owner.save!
controller.current_user = mix.recording.owner
get :download, {format:'json', id: mix.id}
get :download, params: { format:'json', id: mix.id }
response.status.should == 302
mix.reload
mix.download_count.should == 101

View File

@ -23,8 +23,8 @@ describe ApiMusicSessionsController, type: :controller do
describe "ams_index" do
it "no results" do
get :ams_index, {client_id: conn.client_id}
response.should be_success
get :ams_index, params: { client_id: conn.client_id }
response.should be_successful
json = JSON.parse(response.body, :symbolize_names => true)
json[:sessions].length.should == 0
end
@ -35,7 +35,7 @@ describe ApiMusicSessionsController, type: :controller do
conn.join_the_session(ams.music_session, true, tracks, user, 10)
conn.errors.any?.should be false
get :ams_index, {client_id: conn.client_id}
get :ams_index, params: { client_id: conn.client_id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:sessions].length.should == 1
json[:sessions][0][:active_music_session][:participants][0][:user][:full_score].should be_nil
@ -50,7 +50,7 @@ describe ApiMusicSessionsController, type: :controller do
other_conn.join_the_session(ams.music_session, true, tracks, user, 10)
other_conn.errors.any?.should be false
get :ams_index, {client_id: conn.client_id}
get :ams_index, params: { client_id: conn.client_id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:sessions].length.should == 1
json[:sessions][0][:active_music_session][:participants][0][:user][:full_score].should be_nil
@ -63,7 +63,7 @@ describe ApiMusicSessionsController, type: :controller do
other_conn.errors.any?.should be false
Score.createx(conn.locidispid, conn.client_id, conn.addr, other_conn.locidispid, other_conn.client_id, other_conn.addr, network_score, nil, nil, {auserid: user.id, buserid: other.id})
get :ams_index, {client_id: conn.client_id}
get :ams_index, params: { client_id: conn.client_id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:sessions].length.should == 1
json[:sessions][0][:active_music_session][:participants]
@ -87,7 +87,7 @@ describe ApiMusicSessionsController, type: :controller do
rsvp_request = FactoryBot.create(:rsvp_request, user: third_user)
rsvp_request_rsvp_slot = FactoryBot.create(:rsvp_request_rsvp_slot, chosen:true, rsvp_request: rsvp_request, rsvp_slot:rsvp_slot)
get :ams_index, {client_id: conn.client_id}
get :ams_index, params: { client_id: conn.client_id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:sessions].length.should == 1
json[:sessions][0][:active_music_session][:participants][0][:user][:full_score].should_not be_nil
@ -113,8 +113,8 @@ describe ApiMusicSessionsController, type: :controller do
describe "sms_index" do
xit "no results" do
get :sms_index, {client_id: conn.client_id}
response.should be_success
get :sms_index, params: { client_id: conn.client_id }
response.should be_successful
json = JSON.parse(response.body, :symbolize_names => true)
json[:sessions].length.should == 0
end
@ -123,7 +123,7 @@ describe ApiMusicSessionsController, type: :controller do
# create a session with self in it
sms = FactoryBot.create(:music_session, creator: user)
get :sms_index, {client_id: conn.client_id}
get :sms_index, params: { client_id: conn.client_id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:sessions].length.should == 1
json[:sessions][0][:approved_rsvps][0][:id].should == user.id
@ -137,7 +137,7 @@ describe ApiMusicSessionsController, type: :controller do
# create a session with someone else in it, but no score
sms = FactoryBot.create(:music_session, creator: other)
get :sms_index, {client_id: conn.client_id}
get :sms_index, params: { client_id: conn.client_id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:sessions].length.should == 1
json[:sessions][0][:approved_rsvps][0][:id].should == other.id
@ -156,7 +156,7 @@ describe ApiMusicSessionsController, type: :controller do
Score.createx(invitee.last_jam_locidispid, 'immaterial', 1, conn.locidispid, conn.client_id, conn.addr, network_score, nil, nil, {auserid: invitee.id, buserid: user.id})
get :sms_index, {client_id: conn.client_id}
get :sms_index, params: { client_id: conn.client_id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:sessions].length.should == 1
json[:sessions][0][:approved_rsvps][0][:id].should == other.id
@ -173,14 +173,14 @@ describe ApiMusicSessionsController, type: :controller do
let(:jam_track) { FactoryBot.create(:jam_track)}
it "does not allow someone to open a track unless they are in the session" do
post :jam_track_open, {:format => 'json', id: ams.id, jam_track_id: jam_track.id}
post :jam_track_open, params: { :format => 'json', id: ams.id, jam_track_id: jam_track.id }
response.status.should == 403
end
it "does not allow someone to open a track unless they own the jam track" do
conn.join_the_session(ams.music_session, true, tracks, user, 10)
post :jam_track_open, {:format => 'json', id: ams.id, jam_track_id: jam_track.id}
post :jam_track_open, params: { :format => 'json', id: ams.id, jam_track_id: jam_track.id }
response.status.should == 403
end
@ -189,12 +189,12 @@ describe ApiMusicSessionsController, type: :controller do
conn.join_the_session(ams.music_session, true, tracks, user, 10)
FactoryBot.create(:jam_track_right, jam_track: jam_track, user: user)
post :jam_track_open, {:format => 'json', id: ams.id, jam_track_id: jam_track.id}
post :jam_track_open, params: { :format => 'json', id: ams.id, jam_track_id: jam_track.id }
response.status.should == 200
end
it "does not allow someone to close a track unless they are in the session" do
post :jam_track_close, {:format => 'json', id: ams.id}
post :jam_track_close, params: { :format => 'json', id: ams.id }
response.status.should == 403
end
@ -203,20 +203,19 @@ describe ApiMusicSessionsController, type: :controller do
conn.join_the_session(ams.music_session, true, tracks, user, 10)
FactoryBot.create(:jam_track_right, jam_track: jam_track, user: user)
post :jam_track_open, {:format => 'json', id: ams.id, jam_track_id: jam_track.id}
post :jam_track_open, params: { :format => 'json', id: ams.id, jam_track_id: jam_track.id }
response.status.should == 200
post :jam_track_close, {:format => 'json', id: ams.id}
post :jam_track_close, params: { :format => 'json', id: ams.id }
response.status.should == 200
end
it "show.rabl shows jam track info when open" do
conn.join_the_session(ams.music_session, true, tracks, user, 10)
FactoryBot.create(:jam_track_right, jam_track: jam_track, user: user)
post :jam_track_open, {:format => 'json', id: ams.id, jam_track_id: jam_track.id}
post :jam_track_open, params: { :format => 'json', id: ams.id, jam_track_id: jam_track.id }
# check the show.rabl for jam_track info
get :show, {:format => 'json', id: ams.id}
get :show, params: { :format => 'json', id: ams.id }
json = JSON.parse(response.body, :symbolize_names => true)
json[:jam_track].should_not be_nil
@ -230,7 +229,7 @@ describe ApiMusicSessionsController, type: :controller do
let(:backing_track) { "foo.mp3"}
it "does not allow someone to open a track unless they are in the session" do
post :backing_track_open, {:format => 'json', id: ams.id, backing_track_path: backing_track}
post :backing_track_open, params: { :format => 'json', id: ams.id, backing_track_path: backing_track }
response.status.should == 403
end
@ -238,7 +237,7 @@ describe ApiMusicSessionsController, type: :controller do
pending "connection with client to determine ownership"
conn.join_the_session(ams.music_session, true, tracks, user, 10)
post :backing_track_open, {:format => 'json', id: ams.id, backing_track_path: backing_track}
post :backing_track_open, params: { :format => 'json', id: ams.id, backing_track_path: backing_track }
response.status.should == 403
end
@ -246,12 +245,12 @@ describe ApiMusicSessionsController, type: :controller do
# put the connection of the user into the session, so th
conn.join_the_session(ams.music_session, true, tracks, user, 10)
post :backing_track_open, {:format => 'json', id: ams.id, backing_track_path: backing_track}
post :backing_track_open, params: { :format => 'json', id: ams.id, backing_track_path: backing_track }
response.status.should == 200
end
it "does not allow someone to close a track unless they are in the session" do
post :backing_track_close, {:format => 'json', id: ams.id}
post :backing_track_close, params: { :format => 'json', id: ams.id }
response.status.should == 403
end
@ -259,10 +258,10 @@ describe ApiMusicSessionsController, type: :controller do
# put the connection of the user into the session, so th
conn.join_the_session(ams.music_session, true, tracks, user, 10)
post :backing_track_open, {:format => 'json', id: ams.id, backing_track_path: backing_track}
post :backing_track_open, params: { :format => 'json', id: ams.id, backing_track_path: backing_track }
response.status.should == 200
post :backing_track_close, {:format => 'json', id: ams.id}
post :backing_track_close, params: { :format => 'json', id: ams.id }
response.status.should == 200
end
end
@ -273,25 +272,25 @@ describe ApiMusicSessionsController, type: :controller do
let(:metronome) { "foo.mp3"}
it "does not allow someone to open a track unless they are in the session" do
post :metronome_open, {:format => 'json', id: ams.id, metronome_path: metronome}
post :metronome_open, params: { :format => 'json', id: ams.id, metronome_path: metronome }
response.status.should == 403
end
it "can open it" do
conn.join_the_session(ams.music_session, true, tracks, user, 10)
post :metronome_open, {:format => 'json', id: ams.id, metronome_path: metronome}
post :metronome_open, params: { :format => 'json', id: ams.id, metronome_path: metronome }
response.status.should == 200
end
it "does not allow someone to close a metronome" do
post :metronome_close, {:format => 'json', id: ams.id}
post :metronome_close, params: { :format => 'json', id: ams.id }
response.status.should == 403
end
it "does allow someone who joied to close a metronome" do
conn.join_the_session(ams.music_session, true, tracks, user, 10)
post :metronome_close, {:format => 'json', id: ams.id}
post :metronome_close, params: { :format => 'json', id: ams.id }
response.status.should == 200
end
@ -299,10 +298,10 @@ describe ApiMusicSessionsController, type: :controller do
# put the connection of the user into the session, so th
conn.join_the_session(ams.music_session, true, tracks, user, 10)
post :metronome_open, {:format => 'json', id: ams.id, metronome_path: metronome}
post :metronome_open, params: { :format => 'json', id: ams.id, metronome_path: metronome }
response.status.should == 200
post :metronome_close, {:format => 'json', id: ams.id}
post :metronome_close, params: { :format => 'json', id: ams.id }
response.status.should == 200
end
end
@ -328,20 +327,20 @@ describe ApiMusicSessionsController, type: :controller do
end
it "returns 403 for invalid token" do
get :auth, session_id: ams.id, token: 'invalid_token', participants: 2
get :auth, params: { session_id: ams.id, token: 'invalid_token', participants: 2 }
expect(response).to have_http_status(403)
expect(response.body).to eq({ code: "invalid_token", message: "No token found for 'invalid_token'" }.to_json)
end
it "returns 403 if user is not in music session" do
ams.users.delete(user)
get :auth, session_id: ams.id, token: temp_token.token, participants: 2
get :auth, params: { session_id: ams.id, token: temp_token.token, participants: 2 }
expect(response).to have_http_status(403)
expect(response.body).to eq({ code: "not_in_session", message: "Not a member of the session" }.to_json)
end
it "returns 404 if token is valid, but session can't be found" do
get :auth, session_id: "bad_session_id", token: temp_token.token, participants: 2
get :auth, params: { session_id: "bad_session_id", token: temp_token.token, participants: 2 }
expect(response).to have_http_status(404)
expect(response.body).to eq({ code: "session_ended", message: "The session is over" }.to_json)
end
@ -349,13 +348,13 @@ describe ApiMusicSessionsController, type: :controller do
it "token expired" do
TempToken.where(token: temp_token.token).update_all(expired_at: 1.day.ago)
get :auth, session_id: ams.id, token: temp_token.token, participants: 2
get :auth, params: { session_id: ams.id, token: temp_token.token, participants: 2 }
expect(response).to have_http_status(403)
expect(response.body).to eq({ code: "expired_token", message: "The token has expired" }.to_json)
end
it "returns 200 ok for valid params" do
get :auth, session_id: ams.id, token: temp_token.token, participants: 2
get :auth, params: { session_id: ams.id, token: temp_token.token, participants: 2 }
expect(response).to have_http_status(200)
expect(response.body).to eq({ name: user.name, user_id: user.id }.to_json)
end

View File

@ -13,9 +13,8 @@ describe ApiPaymentHistoriesController, type: :controller do
describe "index" do
it "empty" do
get :index, { :format => 'json'}
response.should be_success
get :index, params: { :format => 'json' }
response.should be_successful
body = JSON.parse(response.body)
body['next_page'].should be_nil
body['entries'].should eq([])
@ -30,8 +29,8 @@ describe ApiPaymentHistoriesController, type: :controller do
shopping_cart = ShoppingCart.create(user, jam_track)
sale_line_item = SaleLineItem.create_from_shopping_cart(sale, shopping_cart, nil, 'some_adjustment_uuid', nil)
get :index, { :format => 'json'}
response.should be_success
get :index, params: { :format => 'json' }
response.should be_successful
body = JSON.parse(response.body)
body['next_page'].should be_nil
entries = body['entries']
@ -45,8 +44,8 @@ describe ApiPaymentHistoriesController, type: :controller do
transaction = FactoryBot.create(:recurly_transaction_web_hook, invoice_id: sale.recurly_invoice_id, transaction_type: RecurlyTransactionWebHook::VOID, user: user, transaction_at: 1.minute.from_now)
get :index, { :format => 'json'}
response.should be_success
get :index, params: { :format => 'json' }
response.should be_successful
body = JSON.parse(response.body)
body['next_page'].should be_nil
entries = body['entries']

View File

@ -20,8 +20,8 @@ describe ApiPosaCardsController, type: :controller do
describe "activate" do
it "works" do
request.headers['HTTP_AUTHORIZATION'] = authorization
get :activate, slug: retailer.slug, code: posa_card.code
response.should be_success
get :activate, params: { slug: retailer.slug, code: posa_card.code }
response.should be_successful
JSON.parse(response.body)['id'].should eql posa_card.id
posa_card.reload
posa_card.activated_at.should_not be_nil
@ -33,8 +33,8 @@ describe ApiPosaCardsController, type: :controller do
it "works" do
controller.current_user = user
posa_card.activate(retailer)
get :claim, code: posa_card.code
response.should be_success
get :claim, params: { code: posa_card.code }
response.should be_successful
JSON.parse(response.body)['id'].should eql posa_card.id
posa_card.reload
posa_card.claimed_at.should_not be_nil

View File

@ -17,16 +17,16 @@ describe ApiRecordingsController, type: :controller do
describe "start" do
it "should work" do
post :start, {:format => 'json', :music_session_id => @music_session.id}
response.should be_success
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
response.should be_successful
response_body = JSON.parse(response.body)
response_body['id'].should_not be_nil
recording = Recording.find(response_body['id'])
end
it "should not allow multiple starts" do
post :start, {:format => 'json', :music_session_id => @music_session.id}
post :start, {:format => 'json', :music_session_id => @music_session.id}
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
response.status.should == 422
response_body = JSON.parse(response.body)
response_body["errors"]["music_session"][0].should == ValidationMessages::ALREADY_BEING_RECORDED
@ -39,7 +39,7 @@ describe ApiRecordingsController, type: :controller do
claimed_recording = recording.claim(@user, "name", "description", Genre.first, true)
@music_session.claimed_recording_start(@user, claimed_recording)
@music_session.errors.any?.should be false
post :start, {:format => 'json', :music_session_id => @music_session.id}
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
response.status.should == 422
response_body = JSON.parse(response.body)
response_body["errors"]["music_session"][0].should == ValidationMessages::ALREADY_PLAYBACK_RECORDING
@ -48,20 +48,20 @@ describe ApiRecordingsController, type: :controller do
it "should not allow start by somebody not in the music session" do
user2 = FactoryBot.create(:user)
controller.current_user = user2
post :start, {:format => 'json', :music_session_id => @music_session.id}
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
response.status.should == 403
end
end
describe "get" do
it "should work" do
post :start, {:format => 'json', :music_session_id => @music_session.id}
response.should be_success
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
response.should be_successful
response_body = JSON.parse(response.body)
response_body['id'].should_not be_nil
recordingId = response_body['id']
get :show, {:format => 'json', :id => recordingId}
response.should be_success
get :show, params: { :format => 'json', :id => recordingId }
response.should be_successful
response_body = JSON.parse(response.body)
response_body['id'].should == recordingId
end
@ -70,34 +70,34 @@ describe ApiRecordingsController, type: :controller do
describe "stop" do
it "should work" do
post :start, {:format => 'json', :music_session_id => @music_session.id}
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
response_body = JSON.parse(response.body)
recording = Recording.find(response_body['id'])
post :stop, {:format => 'json', :id => recording.id}
response.should be_success
post :stop, params: { :format => 'json', :id => recording.id }
response.should be_successful
response_body = JSON.parse(response.body)
response_body['id'].should_not be_nil
Recording.find(response_body['id']).id.should == recording.id
end
it "should not allow stop on a session not being recorded" do
post :start, {:format => 'json', :music_session_id => @music_session.id}
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
response_body = JSON.parse(response.body)
recording = Recording.find(response_body['id'])
post :stop, {:format => 'json', :id => recording.id}
post :stop, {:format => 'json', :id => recording.id}
post :stop, params: { :format => 'json', :id => recording.id }
post :stop, params: { :format => 'json', :id => recording.id }
response.status.should == 422
response_body = JSON.parse(response.body)
end
it "should not allow stop on a session requested by a different member" do
post :start, {:format => 'json', :music_session_id => @music_session.id}
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
response_body = JSON.parse(response.body)
recording = Recording.find(response_body['id'])
user2 = FactoryBot.create(:user)
controller.current_user = user2
post :stop, {:format => 'json', :id => recording.id}
post :stop, params: { :format => 'json', :id => recording.id }
response.status.should == 403
end
end
@ -106,11 +106,11 @@ describe ApiRecordingsController, type: :controller do
let(:mix) { FactoryBot.create(:mix) }
it "should only allow a user to download a track if they have claimed the recording" do
post :start, {:format => 'json', :music_session_id => @music_session.id}
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
response_body = JSON.parse(response.body)
recording = Recording.find(response_body['id'])
post :stop, {:format => 'json', :id => recording.id}
response.should be_success
post :stop, params: { :format => 'json', :id => recording.id }
response.should be_successful
end
@ -118,13 +118,13 @@ describe ApiRecordingsController, type: :controller do
mix.touch
recorded_track = mix.recording.recorded_tracks[0]
controller.current_user = mix.recording.owner
get :download, {id: recorded_track.recording.id, track_id: recorded_track.client_track_id}
get :download, params: { id: recorded_track.recording.id, track_id: recorded_track.client_track_id }
response.status.should == 302
recorded_track.reload
recorded_track.download_count.should == 1
get :download, {id: recorded_track.recording.id, track_id: recorded_track.client_track_id}
get :download, params: { id: recorded_track.recording.id, track_id: recorded_track.client_track_id }
response.status.should == 302
recorded_track.reload
@ -138,7 +138,7 @@ describe ApiRecordingsController, type: :controller do
recorded_track.download_count = APP_CONFIG.max_audio_downloads
recorded_track.save!
controller.current_user = recorded_track.user
get :download, {format: 'json', id: recorded_track.recording.id, track_id: recorded_track.client_track_id}
get :download, params: { format: 'json', id: recorded_track.recording.id, track_id: recorded_track.client_track_id }
response.status.should == 404
JSON.parse(response.body, symbolize_names: true)[:message].should == "download limit surpassed"
end
@ -153,7 +153,7 @@ describe ApiRecordingsController, type: :controller do
recorded_track.user.save!
controller.current_user = recorded_track.user
get :download, {format: 'json', id: recorded_track.recording.id, track_id: recorded_track.client_track_id}
get :download, params: { format: 'json', id: recorded_track.recording.id, track_id: recorded_track.client_track_id }
response.status.should == 302
recorded_track.reload
recorded_track.download_count.should == 101
@ -164,11 +164,11 @@ describe ApiRecordingsController, type: :controller do
let(:mix) { FactoryBot.create(:mix) }
it "should only allow a user to download a track if they have claimed the recording" do
post :start, {:format => 'json', :music_session_id => @music_session.id}
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
response_body = JSON.parse(response.body)
recording = Recording.find(response_body['id'])
post :stop, {:format => 'json', :id => recording.id}
response.should be_success
post :stop, params: { :format => 'json', :id => recording.id }
response.should be_successful
end
@ -176,13 +176,13 @@ describe ApiRecordingsController, type: :controller do
mix.touch
recorded_track = mix.recording.recorded_tracks[0]
controller.current_user = mix.recording.owner
get :download, {id: recorded_track.recording.id, track_id: recorded_track.client_track_id}
get :download, params: { id: recorded_track.recording.id, track_id: recorded_track.client_track_id }
response.status.should == 302
recorded_track.reload
recorded_track.download_count.should == 1
get :download, {id: recorded_track.recording.id, track_id: recorded_track.client_track_id}
get :download, params: { id: recorded_track.recording.id, track_id: recorded_track.client_track_id }
response.status.should == 302
recorded_track.reload
@ -196,7 +196,7 @@ describe ApiRecordingsController, type: :controller do
recorded_track.download_count = APP_CONFIG.max_audio_downloads
recorded_track.save!
controller.current_user = recorded_track.user
get :download, {format: 'json', id: recorded_track.recording.id, track_id: recorded_track.client_track_id}
get :download, params: { format: 'json', id: recorded_track.recording.id, track_id: recorded_track.client_track_id }
response.status.should == 404
JSON.parse(response.body, symbolize_names: true)[:message].should == "download limit surpassed"
end
@ -211,7 +211,7 @@ describe ApiRecordingsController, type: :controller do
recorded_track.user.save!
controller.current_user = recorded_track.user
get :download, {format: 'json', id: recorded_track.recording.id, track_id: recorded_track.client_track_id}
get :download, params: { format: 'json', id: recorded_track.recording.id, track_id: recorded_track.client_track_id }
response.status.should == 302
recorded_track.reload
recorded_track.download_count.should == 101
@ -239,8 +239,8 @@ describe ApiRecordingsController, type: :controller do
describe "start" do
it "should work" do
post :start, {:format => 'json', :music_session_id => @music_session.id}
response.should be_success
post :start, params: { :format => 'json', :music_session_id => @music_session.id }
response.should be_successful
response_body = JSON.parse(response.body)
response_body['id'].should_not be_nil
recording = Recording.find(response_body['id'])

View File

@ -35,7 +35,7 @@ describe ApiRecurlyController, :type=>:controller do
it "should send correct error" do
@billing_info[:number]='121'
post :create_account, {:format => 'json', :billing_info=>@billing_info, reuse_card_this_time: false, reuse_card_next_time: false}
post :create_account, params: {:format => 'json', :billing_info=>@billing_info, reuse_card_this_time: false, reuse_card_next_time: false}
response.status.should == 404
body = JSON.parse(response.body)
body['errors'].should have(1).items
@ -43,37 +43,37 @@ describe ApiRecurlyController, :type=>:controller do
end
it "should create account" do
post :create_account, {:format => 'json',billing_info: @billing_info, reuse_card_this_time: false, reuse_card_next_time: false}
response.should be_success
post :create_account, params: {:format => 'json',billing_info: @billing_info, reuse_card_this_time: false, reuse_card_next_time: false}
response.should be_successful
body = JSON.parse(response.body)
response.should be_success
response.should be_successful
body['billing_info']['first_name'].should eq(@user.first_name)
end
it "should retrieve account with no billing info" do
post :create_account, {:format => 'json', reuse_card_this_time: false, reuse_card_next_time: false}
response.should be_success
post :create_account, params: {:format => 'json', reuse_card_this_time: false, reuse_card_next_time: false}
response.should be_successful
get :get_account
body = JSON.parse(response.body)
response.should be_success
response.should be_successful
body['billing_info'].should be_nil
end
it "should update account" do
post :create_account, {:format => 'json', billing_info: @billing_info, reuse_card_this_time: false, reuse_card_next_time: false}
response.should be_success
post :create_account, params: {:format => 'json', billing_info: @billing_info, reuse_card_this_time: false, reuse_card_next_time: false}
response.should be_successful
body = JSON.parse(response.body)
body['billing_info']['first_name'].should eq("Person")
controller.current_user = @user
@billing_info[:first_name] = "Thing"
put :update_account, {:format => 'json', billing_info: @billing_info}
put :update_account, params: {:format => 'json', billing_info: @billing_info}
body = JSON.parse(response.body)
body['billing_info']['first_name'].should eq("Thing")
get :get_account, { :format => 'json'}
response.should be_success
get :get_account, params: { :format => 'json'}
response.should be_successful
body = JSON.parse(response.body)
body['billing_info']['first_name'].should eq("Thing")
end
@ -81,8 +81,8 @@ describe ApiRecurlyController, :type=>:controller do
# Note: We don't have any subscriptions yet:
it "should get subscription" do
pending "We don't have any subscriptions yet -- uncomment in routes"
get :get_subscription, { :format => 'json'}
response.should be_success
get :get_subscription, params: { :format => 'json'}
response.should be_successful
body = JSON.parse(response.body)
end
@ -98,19 +98,19 @@ describe ApiRecurlyController, :type=>:controller do
# $enable_tracing = true
post :create_account, {:format => 'json', billing_info: @billing_info, reuse_card_this_time: false, reuse_card_next_time: false}
response.should be_success
post :create_account, params: {:format => 'json', billing_info: @billing_info, reuse_card_this_time: false, reuse_card_next_time: false}
response.should be_successful
body = JSON.parse(response.body)
body['billing_info']['first_name'].should eq("Person")
@billing_info[:state] = "NE"
put :update_billing_info, {format: 'json', billing_info: @billing_info}
put :update_billing_info, params: {format: 'json', billing_info: @billing_info}
response.should be_success
response.should be_successful
body = JSON.parse(response.body)
get :billing_info
response.should be_success
response.should be_successful
body = JSON.parse(response.body)
end

View File

@ -13,13 +13,13 @@ describe ApiRetailerInvitationsController, type: :controller do
describe "index" do
it "works" do
get :index, id: retailer.id
response.should be_success
get :index, params: { id: retailer.id }
response.should be_successful
JSON.parse(response.body)['total_entries'].should eql 0
retailer_invitation_teacher.touch
get :index, id: retailer.id
response.should be_success
get :index, params: { id: retailer.id }
response.should be_successful
JSON.parse(response.body)['total_entries'].should eql 1
end
@ -29,8 +29,8 @@ describe ApiRetailerInvitationsController, type: :controller do
describe "create" do
it "works" do
UserMailer.deliveries.clear
post :create, id: retailer.id, first_name: "Seth", last_name: "Call", email: "seth@jamkazam.com", :format => 'json'
response.should be_success
post :create, params: { id: retailer.id, first_name: "Seth", last_name: "Call", email: "seth@jamkazam.com", :format => 'json' }
response.should be_successful
UserMailer.deliveries.length.should eql 1
JSON.parse(response.body)['id'].should eql RetailerInvitation.find_by_email("seth@jamkazam.com").id
end
@ -39,16 +39,16 @@ describe ApiRetailerInvitationsController, type: :controller do
describe "resend" do
it "works" do
UserMailer.deliveries.clear
post :resend, id: retailer.id, invitation_id: retailer_invitation_teacher.id, :format => 'json'
post :resend, params: { id: retailer.id, invitation_id: retailer_invitation_teacher.id, :format => 'json' }
UserMailer.deliveries.length.should eql 1
response.should be_success
response.should be_successful
end
end
describe "delete" do
it "works" do
delete :delete, id: retailer.id, invitation_id: retailer_invitation_teacher.id, :format => 'json'
response.should be_success
delete :delete, params: { id: retailer.id, invitation_id: retailer_invitation_teacher.id, :format => 'json' }
response.should be_successful
end
end
end

View File

@ -12,8 +12,8 @@ describe ApiRetailersController, type: :controller do
describe "show" do
it "works" do
get :show, id: retailer.id
response.should be_success
get :show, params: { id: retailer.id }
response.should be_successful
JSON.parse(response.body)['id'].should eql retailer.id
end
@ -22,8 +22,8 @@ describe ApiRetailersController, type: :controller do
describe "update" do
it "works" do
post :update, id: retailer.id, name: "Hardy har", format: 'json'
response.should be_success
post :update, params: { id: retailer.id, name: "Hardy har", format: 'json' }
response.should be_successful
json = JSON.parse(response.body)
json['name'].should eql "Hardy har"
end

View File

@ -23,8 +23,8 @@ describe ApiReviewsController, type: :controller do
describe "create" do
it "successful" do
post :create, rating:3, description:"it was ok", target_id: @target.id, target_type:"JamRuby::JamTrack", format: 'json'
response.should be_success
post :create, params: { rating:3, description:"it was ok", target_id: @target.id, target_type:"JamRuby::JamTrack", format: 'json' }
response.should be_successful
Review.index.should have(1).items
end
end
@ -35,15 +35,15 @@ describe ApiReviewsController, type: :controller do
end
it "basic" do
post :update, id:@review.id, mods: {rating:4, description: "not blah"}, :format=>'json'
response.should be_success
post :update, params: { id:@review.id, mods: {rating:4, description: "not blah"}, :format=>'json' }
response.should be_successful
@review.reload
@review.rating.should eq(4)
@review.description.should eq("not blah")
end
it "bad identifier" do
post :update, id:2112, mods: {rating:4, description: "not blah"}, :format=>'json'
post :update, params: { id:2112, mods: {rating:4, description: "not blah"}, :format=>'json' }
response.status.should eql(404)
end
end
@ -54,8 +54,8 @@ describe ApiReviewsController, type: :controller do
end
it "marks review as deleted" do
delete :delete, id:@review.id
response.should be_success
delete :delete, params: { id:@review.id }
response.should be_successful
Review.index.should have(0).items
Review.index(include_deleted:true).should have(1).items
end
@ -70,12 +70,12 @@ describe ApiReviewsController, type: :controller do
end
it "review summaries" do
get :index, format: 'json'
response.should be_success
get :index, params: { format: 'json' }
response.should be_successful
json = JSON.parse(response.body)
ReviewSummary.index.should have(2).items
get :index, format: 'json'
get :index, params: { format: 'json' }
json = JSON.parse(response.body)
json.should have(2).item
end
@ -84,13 +84,13 @@ describe ApiReviewsController, type: :controller do
ReviewSummary.index.should have(2).items
summaries = ReviewSummary.index
get :details, :review_summary_id=>summaries[0].id, format: 'json'
response.should be_success
get :details, params: { :review_summary_id=>summaries[0].id, format: 'json' }
response.should be_successful
json = JSON.parse(response.body)
json.should have(7).items
get :details, :review_summary_id=>summaries[1].id, format: 'json'
response.should be_success
get :details, params: { :review_summary_id=>summaries[1].id, format: 'json' }
response.should be_successful
json = JSON.parse(response.body)
json.should have(5).items
end
@ -99,13 +99,13 @@ describe ApiReviewsController, type: :controller do
summaries = ReviewSummary.index
summaries.should have(2).items
get :details, review_summary_id:summaries[0].id, page: 1, per_page: 3, format: 'json'
response.should be_success
get :details, params: { review_summary_id:summaries[0].id, page: 1, per_page: 3, format: 'json' }
response.should be_successful
json = JSON.parse(response.body)
json.should have(3).items
get :details, review_summary_id:summaries[0].id, page: 3, per_page: 3, format: 'json'
response.should be_success
get :details, params: { review_summary_id:summaries[0].id, page: 3, per_page: 3, format: 'json' }
response.should be_successful
json = JSON.parse(response.body)
json.should have(1).items
end

View File

@ -14,17 +14,17 @@ describe ApiSchoolInvitationsController, type: :controller do
describe "index" do
it "works" do
get :index, id: school.id, as_teacher: true
response.should be_success
get :index, params: { id: school.id, as_teacher: true }
response.should be_successful
JSON.parse(response.body)['total_entries'].should eql 0
school_invitation_teacher.touch
get :index, id: school.id, as_teacher: true
response.should be_success
get :index, params: { id: school.id, as_teacher: true }
response.should be_successful
JSON.parse(response.body)['total_entries'].should eql 1
get :index, id: school.id, as_teacher: false
response.should be_success
get :index, params: { id: school.id, as_teacher: false }
response.should be_successful
JSON.parse(response.body)['total_entries'].should eql 0
end
@ -33,9 +33,9 @@ describe ApiSchoolInvitationsController, type: :controller do
describe "create" do
it "works" do
UserMailer.deliveries.clear
post :create, id: school.id, first_name: "Seth", last_name: "Call", email: "seth@jamkazam.com", as_teacher: true, :format => 'json'
post :create, params: { id: school.id, first_name: "Seth", last_name: "Call", email: "seth@jamkazam.com", as_teacher: true, :format => 'json' }
UserMailer.deliveries.length.should eql 1
response.should be_success
response.should be_successful
JSON.parse(response.body)['id'].should eql SchoolInvitation.find_by_email("seth@jamkazam.com").id
end
end
@ -43,16 +43,16 @@ describe ApiSchoolInvitationsController, type: :controller do
describe "resend" do
it "works" do
UserMailer.deliveries.clear
post :resend, id: school.id, invitation_id: school_invitation_teacher.id, :format => 'json'
post :resend, params: { id: school.id, invitation_id: school_invitation_teacher.id, :format => 'json' }
UserMailer.deliveries.length.should eql 1
response.should be_success
response.should be_successful
end
end
describe "delete" do
it "works" do
delete :delete, id: school.id, invitation_id: school_invitation_teacher.id, :format => 'json'
response.should be_success
delete :delete, params: { id: school.id, invitation_id: school_invitation_teacher.id, :format => 'json' }
response.should be_successful
end
end
end

View File

@ -12,8 +12,8 @@ describe ApiSchoolsController, type: :controller do
describe "show" do
it "works" do
get :show, id: school.id
response.should be_success
get :show, params: { id: school.id }
response.should be_successful
JSON.parse(response.body)['id'].should eql school.id
end
@ -22,8 +22,8 @@ describe ApiSchoolsController, type: :controller do
describe "update" do
it "works" do
post :update, id: school.id, name: "Hardy har", scheduling_communication: 'school', format: 'json'
response.should be_success
post :update, params: { id: school.id, name: "Hardy har", scheduling_communication: 'school', format: 'json' }
response.should be_successful
json = JSON.parse(response.body)
json['name'].should eql "Hardy har"
json['scheduling_communication'].should eql 'school'

Some files were not shown because too many files have changed in this diff Show More