fixes required for rails5 upgrade
This commit is contained in:
parent
1b268f293f
commit
a48c36fd89
|
|
@ -1,4 +1,4 @@
|
|||
class CreateAdCampaigns < ActiveRecord::Migration
|
||||
class CreateAdCampaigns < ActiveRecord::Migration[4.2]
|
||||
|
||||
def self.up
|
||||
execute( <<-SQL
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class AddLtvToGenericState < ActiveRecord::Migration
|
||||
class AddLtvToGenericState < ActiveRecord::Migration[4.2]
|
||||
def self.up
|
||||
execute "ALTER TABLE generic_state ADD COLUMN customer_ltv INTEGER"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class AddIndexUsersCampaignMedium < ActiveRecord::Migration
|
||||
class AddIndexUsersCampaignMedium < ActiveRecord::Migration[4.2]
|
||||
def self.up
|
||||
execute("CREATE INDEX index_users_origin_utm_campaign_origin_utm_medium ON public.users USING btree (origin_utm_campaign, origin_utm_medium);")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class AddFirstSubscribedPlanCodeToUsers < ActiveRecord::Migration
|
||||
class AddFirstSubscribedPlanCodeToUsers < ActiveRecord::Migration[4.2]
|
||||
def self.up
|
||||
execute("ALTER TABLE users ADD COLUMN first_subscribed_plan_code VARCHAR(100);")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class CreateUserAssets < ActiveRecord::Migration
|
||||
class CreateUserAssets < ActiveRecord::Migration[4.2]
|
||||
def self.up
|
||||
execute(<<-SQL
|
||||
CREATE TABLE public.user_assets (
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class AddUniqueIndexToUserAssetsExtId < ActiveRecord::Migration
|
||||
class AddUniqueIndexToUserAssetsExtId < ActiveRecord::Migration[4.2]
|
||||
|
||||
def self.up
|
||||
execute("ALTER TABLE user_assets ADD CONSTRAINT user_assets_ext_id_key UNIQUE (ext_id);")
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class AddIndexOnUserAssetsUserId < ActiveRecord::Migration
|
||||
class AddIndexOnUserAssetsUserId < ActiveRecord::Migration[4.2]
|
||||
def self.up
|
||||
execute("CREATE INDEX index_user_assets_user_id ON public.user_assets USING btree (user_id);");
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class UseVideoServerOnSessions < ActiveRecord::Migration
|
||||
class UseVideoServerOnSessions < ActiveRecord::Migration[4.2]
|
||||
def self.up
|
||||
execute("ALTER TABLE music_sessions ADD COLUMN use_video_conferencing_server BOOLEAN")
|
||||
execute("UPDATE music_sessions set use_video_conferencing_server = FALSE")
|
||||
|
|
|
|||
|
|
@ -156,6 +156,8 @@ gem 'rack-cors', '~> 1.0', '>= 1.0.6'
|
|||
|
||||
gem 'webpacker', '4.3.0' # unpin when on Ralis 5.2
|
||||
|
||||
gem 'rails-controller-testing'
|
||||
|
||||
if ENV['FASTER_PATH'] == '1'
|
||||
# https://github.com/danielpclark/faster_path
|
||||
# supposed to dramatically speed up page load time. Gotta install rust. go to github if interested
|
||||
|
|
|
|||
|
|
@ -567,6 +567,10 @@ GEM
|
|||
rails-assets-react-select (2.4.3)
|
||||
rails-assets-reflux (0.3.0)
|
||||
rails-assets-regenerator (0.4.8)
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
actionview (>= 5.0.1.rc1)
|
||||
activesupport (>= 5.0.1.rc1)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
|
|
@ -871,6 +875,7 @@ DEPENDENCIES
|
|||
rails-assets-react-select!
|
||||
rails-assets-reflux (= 0.3.0)!
|
||||
rails-assets-regenerator!
|
||||
rails-controller-testing
|
||||
rails-observers
|
||||
react-rails (= 1.3.3)
|
||||
recurly (= 2.18.16)
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ class ApiSearchController < ApiController
|
|||
|
||||
def filter
|
||||
|
||||
latency_good = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:latency_good])
|
||||
latency_fair = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:latency_fair])
|
||||
latency_high = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:latency_high])
|
||||
latency_good = ActiveRecord::Type::Boolean.new.deserialize(params[:latency_good])
|
||||
latency_fair = ActiveRecord::Type::Boolean.new.deserialize(params[:latency_fair])
|
||||
latency_high = ActiveRecord::Type::Boolean.new.deserialize(params[:latency_high])
|
||||
page = [params[:page].to_i, 1].max
|
||||
limit = 20
|
||||
filter_params = {}
|
||||
|
|
@ -113,9 +113,9 @@ class ApiSearchController < ApiController
|
|||
# filter_params.merge!(genres: genres)
|
||||
# end
|
||||
|
||||
beginner = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:proficiency_beginner])
|
||||
intermediate = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:proficiency_intermediate])
|
||||
expert = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:proficiency_expert])
|
||||
beginner = ActiveRecord::Type::Boolean.new.deserialize(params[:proficiency_beginner])
|
||||
intermediate = ActiveRecord::Type::Boolean.new.deserialize(params[:proficiency_intermediate])
|
||||
expert = ActiveRecord::Type::Boolean.new.deserialize(params[:proficiency_expert])
|
||||
|
||||
proficiency_levels = []
|
||||
proficiency_levels.push(1) if beginner
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ describe "Musician Filter API", type: :request do
|
|||
end
|
||||
|
||||
def login(user)
|
||||
post '/sessions', "session[email]" => user.email, "session[password]" => user.password
|
||||
post '/sessions', params: { "session[email]" => user.email, "session[password]" => user.password }
|
||||
end
|
||||
|
||||
before do
|
||||
|
|
@ -132,7 +132,7 @@ describe "Musician Filter API", type: :request do
|
|||
end
|
||||
|
||||
it "filter musicians when no latency option is selected" do
|
||||
post '/api/filter.json', { latency_good: false, latency_fair: false, latency_high: false }
|
||||
post '/api/filter.json', params: { latency_good: false, latency_fair: false, latency_high: false }
|
||||
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(7)
|
||||
expect(JSON.parse(response.body)["musicians"][0]["latency_data"]).not_to eq(nil)
|
||||
|
|
@ -142,7 +142,7 @@ describe "Musician Filter API", type: :request do
|
|||
end
|
||||
|
||||
it "filter musicians for all latency options" do
|
||||
post '/api/filter.json', { latency_good: true, latency_fair: true, latency_high: true }
|
||||
post '/api/filter.json', params: { latency_good: true, latency_fair: true, latency_high: true }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(6)
|
||||
expect(JSON.parse(response.body)["musicians"][0]["latency_data"]).not_to eq(nil)
|
||||
expect(JSON.parse(response.body)["musicians"][0]["latency_data"]["audio_latency"]).not_to eq(nil)
|
||||
|
|
@ -159,7 +159,7 @@ describe "Musician Filter API", type: :request do
|
|||
end
|
||||
|
||||
it "filter GOOD latency users" do
|
||||
post '/api/filter.json', { latency_good: true, latency_fair: false, latency_high: false }
|
||||
post '/api/filter.json', params: { latency_good: true, latency_fair: false, latency_high: false }
|
||||
expect(response.content_type).to eq("application/json")
|
||||
expect(response).to render_template(:filter)
|
||||
expect(response).to have_http_status(:created)
|
||||
|
|
@ -173,56 +173,56 @@ describe "Musician Filter API", type: :request do
|
|||
end
|
||||
|
||||
it "filter FAIR latency musicians" do
|
||||
post '/api/filter.json', { latency_good: false, latency_fair: true, latency_high: false }
|
||||
post '/api/filter.json', params: { latency_good: false, latency_fair: true, latency_high: false }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(2)
|
||||
end
|
||||
|
||||
it "filter HIGH latency musicians" do
|
||||
post '/api/filter.json', { latency_good: false, latency_fair: false, latency_high: true }
|
||||
post '/api/filter.json', params: { latency_good: false, latency_fair: false, latency_high: true }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(2)
|
||||
end
|
||||
|
||||
it "filter GOOD and FAIR latency musicians" do
|
||||
post '/api/filter.json', { latency_good: true, latency_fair: true, latency_high: false }
|
||||
post '/api/filter.json', params: { latency_good: true, latency_fair: true, latency_high: false }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(4)
|
||||
end
|
||||
|
||||
it "filter GOOD and HIGH latency musicians" do
|
||||
post '/api/filter.json', { latency_good: true, latency_fair: false, latency_high: true }
|
||||
post '/api/filter.json', params: { latency_good: true, latency_fair: false, latency_high: true }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(4)
|
||||
end
|
||||
|
||||
it "filter GOOD, FAIR and HIGH latency musicians" do
|
||||
post '/api/filter.json', { latency_good: true, latency_fair: true, latency_high: true }
|
||||
post '/api/filter.json', params: { latency_good: true, latency_fair: true, latency_high: true }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(6)
|
||||
end
|
||||
|
||||
it "filter musicians by genres" do
|
||||
post '/api/filter.json', { latency_good: true, latency_fair: true, latency_high: true, genres: ['pop'] }
|
||||
post '/api/filter.json', params: { latency_good: true, latency_fair: true, latency_high: true, genres: ['pop'] }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(3)
|
||||
|
||||
post '/api/filter.json', { latency_good: true, latency_fair: true, latency_high: true, genres: ['pop', 'rap'] }
|
||||
post '/api/filter.json', params: { latency_good: true, latency_fair: true, latency_high: true, genres: ['pop', 'rap'] }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(1)
|
||||
end
|
||||
|
||||
it "filter musicians by instruments they play" do
|
||||
|
||||
post '/api/filter.json', { latency_good: true, latency_fair: true, latency_high: true, instruments: [{value: "drums", label: "Drums"}], proficiency_intermediate: true }
|
||||
post '/api/filter.json', params: { latency_good: true, latency_fair: true, latency_high: true, instruments: [{value: "drums", label: "Drums"}], proficiency_intermediate: true }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(4)
|
||||
|
||||
post '/api/filter.json', { latency_good: true, latency_fair: true, latency_high: true, instruments: [{value: "drums", label: "Drums"}, {value: 'violin', label: 'Violin'}], proficiency_expert: true }
|
||||
post '/api/filter.json', params: { latency_good: true, latency_fair: true, latency_high: true, instruments: [{value: "drums", label: "Drums"}, {value: 'violin', label: 'Violin'}], proficiency_expert: true }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(2)
|
||||
end
|
||||
|
||||
it "filter musicians by days ago that they joined" do
|
||||
pending
|
||||
post '/api/filter.json', { latency_good: true, latency_fair: true, latency_high: true, joined_within_days: 1 }
|
||||
post '/api/filter.json', params: { latency_good: true, latency_fair: true, latency_high: true, joined_within_days: 1 }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(2)
|
||||
end
|
||||
|
||||
it "finds user updated_at is within a day ago" do
|
||||
pending
|
||||
post '/api/filter.json', { latency_good: true, latency_fair: true, latency_high: true, active_within_days: 1 }
|
||||
post '/api/filter.json', params: { latency_good: true, latency_fair: true, latency_high: true, active_within_days: 1 }
|
||||
expect(JSON.parse(response.body)["musicians"].size).to eq(1)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue