diff --git a/AGENTS.md b/AGENTS.md index 541471d3f..f1723bcb3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,3 +1,9 @@ # Rules of Rails -Code coverage should be extremely high via testing. \ No newline at end of file +For multi-step changes, track the effort in agent-tasks/epic-name/task-name/progress.md, and agent-tasks/epic-name/task-name/sub-task-name/progress.md if helpful to track subtasks of a task. + +Code coverage should be extremely high via testing. + +Whenver modifying business logic, ideally there is a regression test before and after. We have many existing tests, but most are not functional due to us being on Rails 4 and have let the tests rot over time. So, this rule only applies as we are upgraded to the extent that we can run the full test suites in `ruby` , `web`, websocket-gateway`, and `admin`. + + diff --git a/admin/Gemfile b/admin/Gemfile index a5dd3519b..42b9a07cf 100644 --- a/admin/Gemfile +++ b/admin/Gemfile @@ -1,10 +1,10 @@ -source 'http://rubygems.org' +source 'https://rubygems.org' -source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/' -ruby_version = ENV["JAM_RUBY_VERSION"] -ruby_version = "2.3.1" if ruby_version.nil? +unless ENV["LOCAL_DEV"] == "1" + source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/' +end -ruby ruby_version +ruby "3.2.2" devenv = ENV["BUILD_NUMBER"].nil? @@ -21,114 +21,95 @@ else end end -gem 'activeadmin_addons' -gem 'json', '1.8.6' -gem 'rails', '= 4.2.8' -gem 'protected_attributes' -gem 'rails-observers' +gem 'rails', '~> 8.0.0' +# gem 'protected_attributes' # Removed in Rails 5+ +# gem 'rails-observers' # Removed in Rails 5+ +gem 'activeadmin_addons' +gem 'json' # PINNED TO SUPPORT BOTH 2.3.1 and 2.4.1 Ruby simultaneously # This should be the same in ruby/admin/web/websocket-gateway ####### -gem 'nokogiri', '1.10.10' # added to pin before 1.11.0, which requires at leaost ruby 2.5. unpin we go above -gem 'sprockets', '3.6.3' # added to pin before 4.0.0, which requiurse at least ruby 2.5 -gem 'fog-brightbox', '0.11.0' # pinned until we are on ruby 2.5; then remove -gem 'faraday', '0.9.2' # pinned untnil we are on ruby 2.5; then remove -gem 'ruby-prof', '0.15.9' # pinned until we are on ruby 2.5; then remove -gem 'rubyzip', '1.2.1' # pinned until we are on ruby 2.5; then remove -gem 'recurly', '2.18.16' # should upgrade to 3.x when we have time to validaate -gem 'icalendar', '2.4.0' # pinned until we are on ruby 2.5; then remove -gem 'email_validator', '1.6.0' # pinned until we are on ruby 2.5, then remove -gem 'redis', '3.3.3' # pinned until we are on 2.5; then remove -gem 'redis-namespace', '1.5.3' # pinned until we are on 2.5; then remove -gem 'oj', '3.1.3' # pinned until we are on 2.5; then remove -gem 'bcrypt', '3.1.15' -gem 'sass-rails', '5.0.7' # compiler mismatch issue between build and www -gem 'sass', '3.5.5 '# compiler mismatch issue between build and www +gem 'nokogiri' +gem 'sprockets' +gem 'fog-brightbox' +gem 'faraday' +gem 'ruby-prof' +gem 'rubyzip' +gem 'recurly' +gem 'icalendar' +gem 'email_validator' +gem 'redis' +gem 'redis-namespace' +gem 'oj' +gem 'bcrypt' +gem 'sass-rails' +gem 'sass' ####### -gem 'bootstrap-sass', '2.0.4' +gem 'bootstrap-sass' -gem 'coffee-rails' #, '~> 3.2.1' +gem 'coffee-rails' -# See https://github.com/sstephenson/execjs#readme for more supported runtimes -# gem 'therubyracer', :platforms => :ruby +# gem 'therubyracer' # Removed: use mini_racer or system node gem 'kickbox' -gem 'uglifier' #, '>= 1.0.3' +gem 'uglifier' gem 'net-ssh' -gem 'sprockets-rails', '2.3.2' +gem 'sprockets-rails' -# this version is pinned due to this: https://github.com/gregbell/active_admin/issues/1939 -gem 'coffee-script-source' #, '~> 1.4.0' # ADD THIS LINE, 1.5.0 doesn't compile ActiveAdmin JavaScript files -gem 'devise' #, '3.3.0' -gem 'will_paginate' #, '3.0.3' -gem 'bootstrap-will_paginate', '0.0.6' -gem 'carrierwave', '0.11.2' #, '0.9.0' +gem 'coffee-script-source' +gem 'devise' +gem 'will_paginate' +gem 'bootstrap-will_paginate' +gem 'carrierwave' gem 'carrierwave_direct' -gem 'uuidtools', '2.1.2' -gem 'jquery-ui-rails'# , '5.0.5' #, '4.2.1' -gem 'jquery-rails'# , '4.1.1' # both this and jquery-ui-rails are pinned; if you unpin, jquery/autocomplete is missing during precomplie -gem 'rails-jquery-autocomplete' # This is the maintained version of rails3-jquery-autocomplete -gem 'activeadmin' #, '1.0.0.pre4'# github: 'activeadmin', branch: 'master' +gem 'uuidtools' +gem 'jquery-ui-rails' +gem 'jquery-rails' +gem 'rails-jquery-autocomplete' +gem 'activeadmin' gem 'activeadmin-searchable_select' -gem 'mime-types', '1.25' -#gem 'meta_search' +gem 'mime-types' gem 'fog' gem 'xmlrpc' -gem 'unf', '0.1.3' #optional fog dependency +gem 'unf' gem 'country-select' -gem 'aasm' #, '3.0.16' -gem 'postgres-copy', '0.6.0' -gem 'aws-sdk', '~> 1' -gem 'bugsnag', '5.3.2' +gem 'aasm' +gem 'postgres-copy' +gem 'aws-sdk-s3' +gem 'bugsnag' gem 'gon' gem 'cocoon' gem 'haml-rails' gem 'resque' gem 'resque-retry' gem 'resque-failed-job-mailer' -gem 'resque-lonely_job', '~> 1.0.0' -gem 'eventmachine', '1.2.3' -gem 'amqp', '0.9.8' -#gem 'logging-rails', :require => 'logging/rails' -#gem 'pg_migrate', '0.1.14' -if ENV["MODERN_OS"] == "1" - gem 'pg', '0.21.0' -else - # on mac, bundle config build.pg --with-cflags="-Wno-error=implicit-function-declaration" - gem 'pg', '0.17.1', :platform => [:mri, :mswin, :mingw] -end -gem 'ruby-protocol-buffers', '1.2.2' -gem 'sendgrid', '1.2.0' +gem 'resque-lonely_job' +gem 'eventmachine' +gem 'amqp' + +gem 'pg' + +gem 'ruby-protocol-buffers' +gem 'sendgrid' gem 'geokit-rails' -gem 'postgres_ext' #, '1.0.0' gem 'resque_mailer' gem 'rest-client' gem 'iso-639' gem 'sanitize' gem 'slim' -#gem 'influxdb', '0.1.8' -#gem 'influxdb-rails', '0.1.10' -gem 'influxdb', '0.3.14' -gem 'influxdb-rails', '0.1.12' -gem 'sendgrid_toolkit', '>= 1.1.1' +gem 'influxdb' +gem 'influxdb-rails' +gem 'sendgrid_toolkit' gem 'stripe' gem 'zip-codes' -gem 'best_in_place' #, github: 'bernat/best_in_place' -gem 'auto_strip_attributes', '2.6.0' +gem 'best_in_place' +gem 'auto_strip_attributes' gem 'elasticsearch' -gem 'logging', '1.7.2' - -#group :libv8 do -# gem 'libv8', "~> 4.5.95" -#end - - -# To use Jbuilder templates for JSON -# gem 'jbuilder' +gem 'logging' group :production do gem 'unicorn' @@ -138,35 +119,24 @@ group :package do gem 'fpm' end -# Deploy with Capistrano -# gem 'capistrano' - -# To use debugger -#gem 'debugger' # not working with 2.1.2p95 - group :development, :test do - gem 'capybara', '2.13.0' - gem 'rspec-rails' #, '2.14.2' - gem 'jasmine', '1.3.1' - gem 'execjs', '1.4.0' - #gem 'therubyracer' #, '0.11.0beta8' - gem 'factory_girl_rails' # , '4.1.0' - gem 'database_cleaner' #, '0.7.0' - gem 'launchy', '2.4.3' # can unpin when go to ruby 2.4+ - gem 'faker', '1.3.0' + gem 'capybara' + gem 'rspec-rails' + gem 'jasmine' + gem 'execjs' + gem 'factory_bot_rails' # Renamed from factory_girl_rails + gem 'database_cleaner' + gem 'launchy' + gem 'faker' gem 'puma' gem 'test-unit' end group :test do - gem 'simplecov', '~> 0.7.1' + gem 'simplecov' gem 'simplecov-rcov' -# gem 'capybara-webkit' -# gem 'capybara-screenshot', '0.3.22' # 1.0.0 broke compat with rspec. maybe we need newer rspec -# gem 'poltergeist' end gem 'pry' gem 'pry-remote' -gem 'pry-stack_explorer' -#gem 'pry-debugger' +gem 'pry-stack_explorer' \ No newline at end of file diff --git a/admin/app/admin/jam_ruby_users.rb b/admin/app/admin/jam_ruby_users.rb index b3de1e94a..d65f2bc39 100644 --- a/admin/app/admin/jam_ruby_users.rb +++ b/admin/app/admin/jam_ruby_users.rb @@ -650,7 +650,7 @@ ActiveAdmin.register JamRuby::User, :as => 'Users' do def create - @jam_ruby_user = JamRuby::User.new(params[:jam_ruby_user]) + @jam_ruby_user = JamRuby::User.new(params.require(:jam_ruby_user).permit!) @jam_ruby_user.administratively_created = true if @jam_ruby_user.password.nil? || @jam_ruby_user.password.length == 0 # a nil password in the form means we simply won't create one; however, diff --git a/admin/app/models/cohort.rb b/admin/app/models/cohort.rb index 60b769e0b..dcf7e51f2 100644 --- a/admin/app/models/cohort.rb +++ b/admin/app/models/cohort.rb @@ -34,7 +34,6 @@ class Cohort < ActiveRecord::Base invited_users: 'Invite Others', } - attr_accessible :all_time, :monthly_start #serialize :data_set, JSON before_create do diff --git a/admin/config/application.rb b/admin/config/application.rb index b90bcaaf3..2f1330667 100644 --- a/admin/config/application.rb +++ b/admin/config/application.rb @@ -69,7 +69,7 @@ module JamAdmin # This will create an empty whitelist of attributes available for mass-assignment for all models # in your app. As such, your models will need to explicitly whitelist or blacklist accessible # parameters by using an attr_accessible or attr_protected declaration. - config.active_record.whitelist_attributes = true + #config.active_record.whitelist_attributes = true # Enable the asset pipeline config.assets.enabled = true diff --git a/admin/config/initializers/jam_ruby_ars.rb b/admin/config/initializers/jam_ruby_ars.rb index 2fe51d24c..a028bf1d7 100644 --- a/admin/config/initializers/jam_ruby_ars.rb +++ b/admin/config/initializers/jam_ruby_ars.rb @@ -1,5 +1,4 @@ class JamRuby::Ars - attr_accessible :password, :username, :active, :beta, :name, :provider, :id_int, :ip, :port, :continent, :country, :city, :subdivision, :latitude, :longitude, as: :admin end diff --git a/admin/config/initializers/jam_ruby_teacher.rb b/admin/config/initializers/jam_ruby_teacher.rb index f01b9ae71..fbe9c45f8 100644 --- a/admin/config/initializers/jam_ruby_teacher.rb +++ b/admin/config/initializers/jam_ruby_teacher.rb @@ -1,6 +1,5 @@ class JamRuby::Teacher - attr_accessible :short_bio, :background_check_at, as: :admin ransacker :teacher_full_name, formatter: proc { |v| v.mb_chars.downcase.to_s } do |parent| Arel::Nodes::NamedFunction.new('LOWER', diff --git a/admin/config/initializers/jam_ruby_user.rb b/admin/config/initializers/jam_ruby_user.rb index bb603166e..4535034db 100644 --- a/admin/config/initializers/jam_ruby_user.rb +++ b/admin/config/initializers/jam_ruby_user.rb @@ -1,6 +1,5 @@ class JamRuby::User - attr_accessible :admin, :raw_password, :musician, :can_invite, :photo_url, :session_settings, :confirm_url, :teacher_attributes, :email_template, :is_platform_instructor, :admin_override_plan_code, :admin_override_ends_at, :admin_override_touch, :admin_override_reason, as: :admin # :invite_email attr_accessor :admin_override_touch accepts_nested_attributes_for :teacher, allow_destroy: true diff --git a/admin/config/initializers/jam_track_rights.rb b/admin/config/initializers/jam_track_rights.rb index 21fc99599..fb8ca5e0a 100644 --- a/admin/config/initializers/jam_track_rights.rb +++ b/admin/config/initializers/jam_track_rights.rb @@ -1,6 +1,5 @@ class JamRuby::JamTrackRight - attr_accessible :jam_track, :user, :jam_track_id_val, :user_id_val, as: :admin def jam_track_id_val diff --git a/admin/config/initializers/schools.rb b/admin/config/initializers/schools.rb index 40abe7ab8..ab01fcbf0 100644 --- a/admin/config/initializers/schools.rb +++ b/admin/config/initializers/schools.rb @@ -1,7 +1,6 @@ class JamRuby::School # add a custom validation - attr_accessible :user_id, :affiliate_partner_id, :name, :enabled, :scheduling_communication, :correspondence_email, :photo_url, :original_fpfile, :cropped_fpfile, :cropped_s3_path, :crop_selection, :large_photo_url, :cropped_large_s3_path, :cropped_large_fpfile, :jamkazam_rate, :second_ed, :education, :special, :base_rate, as: :admin diff --git a/monitor/Gemfile b/monitor/Gemfile index 6b198c71c..a04f5e3dc 100755 --- a/monitor/Gemfile +++ b/monitor/Gemfile @@ -1,11 +1,13 @@ source "https://rubygems.org" +ruby "3.2.2" + gem "rspec" gem "capybara" gem "capybara-screenshot" -gem "poltergeist" -gem "launchy" # used for opening pages/screenshots when debugging +# gem "poltergeist" # Dead project +gem "selenium-webdriver" +gem "launchy" -# these used only for the Fixnum#seconds method :-/ gem "i18n" -gem "activesupport" +gem "activesupport" \ No newline at end of file diff --git a/pb/Gemfile b/pb/Gemfile index b3ddfbe5f..efe69f0e8 100644 --- a/pb/Gemfile +++ b/pb/Gemfile @@ -1,8 +1,5 @@ source 'https://rubygems.org' -ruby_version = ENV["JAM_RUBY_VERSION"] -ruby_version = "2.3.1" if ruby_version.nil? +ruby "3.2.2" -ruby ruby_version - -gem 'ruby-protocol-buffers', '1.2.2' +gem 'ruby-protocol-buffers' \ No newline at end of file diff --git a/ruby/Gemfile b/ruby/Gemfile index ed8677144..44833e326 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -1,13 +1,9 @@ -#ruby=1.9.3 -source 'http://rubygems.org' +source 'https://rubygems.org' unless ENV["LOCAL_DEV"] == "1" source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/' end -ruby_version = ENV["JAM_RUBY_VERSION"] -ruby_version = "2.3.1" if ruby_version.nil? - -ruby ruby_version +ruby "3.2.2" # Look for $WORKSPACE, otherwise use "workspace" as dev path. devenv = ENV["BUILD_NUMBER"].nil? @@ -20,62 +16,56 @@ else ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] ||= "true" end -if ENV['MODERN_OS'] == "1" - gem 'pg', '0.21.0' -else - # on mac, bundle config build.pg --with-cflags="-Wno-error=implicit-function-declaration" - gem 'pg', '0.17.1', :platform => [:mri, :mswin, :mingw] -end +gem 'pg' #gem 'jdbc_postgres', :platform => [:jruby] -gem 'activerecord', '= 4.2.8' -gem 'railties', '= 4.2.8' -gem 'actionmailer', '= 4.2.8' -gem 'actionview', '= 4.2.8' -gem 'rails-observers', '0.1.2' -gem 'protected_attributes' # needed to support attr_accessible +gem 'activerecord', '~> 8.0.0' +gem 'railties', '~> 8.0.0' +gem 'actionmailer', '~> 8.0.0' +gem 'actionview', '~> 8.0.0' +# gem 'rails-observers' # Removed for Rails 8 +# gem 'protected_attributes' # Removed for Rails 8 # PINNED TO SUPPORT BOTH 2.3.1 and 2.4.1 Ruby simultaneously # This should be the same in ruby/admin/web/websocket-gateway ####### -gem 'nokogiri', '1.10.10' # added to pin before 1.11.0, which requires at leaost ruby 2.5. unpin we go above -gem 'sprockets', '3.6.3' # added to pin before 4.0.0, which requiurse at least ruby 2.5 -gem 'fog-brightbox', '0.11.0' # pinned until we are on ruby 2.5; then remove -gem 'faraday', '0.9.2' # pinned untnil we are on ruby 2.5; then remove -gem 'ruby-prof', '0.15.9' # pinned until we are on ruby 2.5; then remove -gem 'rubyzip', '1.2.0' # pinned until we are on ruby 2.5; then remove -gem 'recurly', '2.19.14' # should upgrade to 3.x when we have time to validaate -gem 'icalendar', '2.4.0' # pinned until we are on ruby 2.5; then remove -gem 'email_validator', '1.6.0' # pinned until we are on ruby 2.5, then remove -gem 'redis', '3.3.0' # pinned until we are on 2.5; then remove -gem 'redis-namespace', '1.5.2' # pinned until we are on 2.5; then remove -gem 'oj', '2.17.1' # pinned until we are on 2.5; then remove +gem 'nokogiri' +gem 'sprockets' +gem 'fog-brightbox' +gem 'faraday' +gem 'ruby-prof' +gem 'rubyzip' +gem 'recurly' +gem 'icalendar' +gem 'email_validator' +gem 'redis' +gem 'redis-namespace' +gem 'oj' ####### -gem "activerecord-import", "~> 0.4.1" +gem "activerecord-import" gem "auto_strip_attributes" -gem "json", "1.8.6" -gem 'uuidtools', '2.1.2' -gem 'bcrypt', '3.1.15' +gem "json" +gem 'uuidtools' +gem 'bcrypt' gem 'bcrypt-ruby' #, '3.0.1' -gem 'ruby-protocol-buffers', '1.2.2' -gem 'eventmachine', '1.0.4' -gem 'amqp', '1.0.2' +gem 'ruby-protocol-buffers' +gem 'eventmachine' +gem 'amqp' gem 'kickbox' gem 'will_paginate' gem 'sendgrid', '1.2.0' -gem 'aws-sdk', '~> 1' -gem 'carrierwave', '0.9.0' +gem 'aws-sdk-s3' +gem 'carrierwave' gem 'aasm' -gem 'devise', '3.3.0' # 3.4.0 causes: uninitialized constant ActionController::Metal (NameError) +gem 'devise' gem 'postgres-copy' gem 'geokit' gem 'geokit-rails' -gem 'postgres_ext' gem 'resque' gem 'resque-retry' gem 'resque-failed-job-mailer' #, :path => "/Users/seth/workspace/resque_failed_job_mailer" -gem 'resque-lonely_job', '~> 1.0.0' +gem 'resque-lonely_job' gem 'resque_mailer' gem 'builder' @@ -91,26 +81,26 @@ gem 'zip-codes' gem 'elasticsearch' -gem 'logging', '1.7.2' +gem 'logging' group :test do gem 'pry' - gem 'simplecov', '~> 0.7.1' + gem 'simplecov' gem 'simplecov-rcov' - gem 'factory_girl', '4.5.0' - gem "rspec", "2.11" + gem 'factory_bot' # Renamed from factory_girl + gem "rspec" gem 'spork', '0.9.0' - gem 'database_cleaner', '1.4.1' - gem 'faker', '1.3.0' + gem 'database_cleaner' + gem 'faker' gem 'resque_spec' #, :path => "/home/jam/src/resque_spec/" gem 'timecop' gem 'rspec-prof' gem 'time_difference' # gem 'byebug' gem 'stripe-ruby-mock' - gem 'webmock', '~> 3.11', '>= 3.11.2' + gem 'webmock' end # Specify your gem's dependencies in jam_ruby.gemspec -gemspec +gemspec \ No newline at end of file diff --git a/ruby/Gemfile.alt b/ruby/Gemfile.alt index 9b98c78d9..4fbc091bb 100644 --- a/ruby/Gemfile.alt +++ b/ruby/Gemfile.alt @@ -1,13 +1,9 @@ -#ruby=1.9.3 source 'http://rubygems.org' unless ENV["LOCAL_DEV"] == "1" source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/' end -ruby_version = ENV["JAM_RUBY_VERSION"] -ruby_version = "2.3.1" if ruby_version.nil? - -ruby ruby_version +ruby "3.2.2" # Look for $WORKSPACE, otherwise use "workspace" as dev path. devenv = ENV["BUILD_NUMBER"].nil? @@ -20,12 +16,7 @@ else ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] ||= "true" end -if ENV['MODERN_OS'] == "1" - gem 'pg', '0.21.0' -else - # on mac, bundle config build.pg --with-cflags="-Wno-error=implicit-function-declaration" - gem 'pg', '0.17.1', :platform => [:mri, :mswin, :mingw] -end +gem 'pg' #gem 'jdbc_postgres', :platform => [:jruby] gem 'activerecord', '= 4.2.8' @@ -37,23 +28,23 @@ gem 'protected_attributes' # needed to support attr_accessible # PINNED TO SUPPORT BOTH 2.3.1 and 2.4.1 Ruby simultaneously # This should be the same in ruby/admin/web/websocket-gateway ####### -gem 'nokogiri', '1.10.10' # added to pin before 1.11.0, which requires at leaost ruby 2.5. unpin we go above -gem 'sprockets', '3.6.3' # added to pin before 4.0.0, which requiurse at least ruby 2.5 -gem 'fog-brightbox', '0.11.0' # pinned until we are on ruby 2.5; then remove -gem 'faraday', '0.9.2' # pinned untnil we are on ruby 2.5; then remove -gem 'ruby-prof', '0.15.9' # pinned until we are on ruby 2.5; then remove -gem 'rubyzip', '1.2.0' # pinned until we are on ruby 2.5; then remove -gem 'recurly', '2.18.16' # should upgrade to 3.x when we have time to validaate -gem 'icalendar', '2.4.0' # pinned until we are on ruby 2.5; then remove -gem 'email_validator', '1.6.0' # pinned until we are on ruby 2.5, then remove -gem 'redis', '3.3.0' # pinned until we are on 2.5; then remove -gem 'redis-namespace', '1.5.2' # pinned until we are on 2.5; then remove -gem 'oj', '2.17.1' # pinned until we are on 2.5; then remove +gem 'nokogiri' +gem 'sprockets' +gem 'fog-brightbox' +gem 'faraday' +gem 'ruby-prof' +gem 'rubyzip' +gem 'recurly' +gem 'icalendar' +gem 'email_validator' +gem 'redis' +gem 'redis-namespace' +gem 'oj' ####### -gem "activerecord-import", "~> 0.4.1" +gem "activerecord-import" gem "auto_strip_attributes" -gem "json", "1.8.6" +gem "json" gem 'uuidtools', '2.1.2' gem 'bcrypt', '3.1.15' gem 'bcrypt-ruby' #, '3.0.1' diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index 7632c7aa6..a34cb26b7 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -9,133 +9,222 @@ PATH jam_ruby (0.1.1) GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ remote: https://jamjam:blueberryjam@int.jamkazam.com/gems/ specs: CFPropertyList (2.3.6) - aasm (5.1.1) + aasm (5.5.2) concurrent-ruby (~> 1.0) - actionmailer (4.2.8) - actionpack (= 4.2.8) - actionview (= 4.2.8) - activejob (= 4.2.8) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.8) - actionview (= 4.2.8) - activesupport (= 4.2.8) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.8) - activesupport (= 4.2.8) + actioncable (8.0.4) + actionpack (= 8.0.4) + activesupport (= 8.0.4) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (8.0.4) + actionpack (= 8.0.4) + activejob (= 8.0.4) + activerecord (= 8.0.4) + activestorage (= 8.0.4) + activesupport (= 8.0.4) + mail (>= 2.8.0) + actionmailer (8.0.4) + actionpack (= 8.0.4) + actionview (= 8.0.4) + activejob (= 8.0.4) + activesupport (= 8.0.4) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (8.0.4) + actionview (= 8.0.4) + activesupport (= 8.0.4) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (8.0.4) + actionpack (= 8.0.4) + activerecord (= 8.0.4) + activestorage (= 8.0.4) + activesupport (= 8.0.4) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (8.0.4) + activesupport (= 8.0.4) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.8) - activesupport (= 4.2.8) - globalid (>= 0.3.0) - activemodel (4.2.8) - activesupport (= 4.2.8) - builder (~> 3.1) - activerecord (4.2.8) - activemodel (= 4.2.8) - activesupport (= 4.2.8) - arel (~> 6.0) - activerecord-import (0.4.1) - activerecord (>= 3.0) - activesupport (4.2.8) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (8.0.4) + activesupport (= 8.0.4) + globalid (>= 0.3.6) + activemodel (8.0.4) + activesupport (= 8.0.4) + activerecord (8.0.4) + activemodel (= 8.0.4) + activesupport (= 8.0.4) + timeout (>= 0.4.0) + activerecord-import (2.2.0) + activerecord (>= 4.2) + activestorage (8.0.4) + actionpack (= 8.0.4) + activejob (= 8.0.4) + activerecord (= 8.0.4) + activesupport (= 8.0.4) + marcel (~> 1.0) + activesupport (8.0.4) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + addressable (2.8.8) + public_suffix (>= 2.0.2, < 8.0) aliyun-sdk (0.8.0) nokogiri (~> 1.6) rest-client (~> 2.0) - amq-client (1.0.4) - amq-protocol (>= 1.9.0) + amq-protocol (2.5.0) + amqp (1.8.0) + amq-protocol (>= 2.2.0) eventmachine - amq-protocol (2.3.2) - amqp (1.0.2) - amq-client (~> 1.0.2) - amq-protocol (>= 1.3.0) - eventmachine - arel (6.0.4) auto_strip_attributes (2.6.0) activerecord (>= 4.0) - aws-sdk (1.67.0) - aws-sdk-v1 (= 1.67.0) - aws-sdk-v1 (1.67.0) - json (~> 1.4) - nokogiri (~> 1) - bcrypt (3.1.15) + aws-eventstream (1.4.0) + aws-partitions (1.1202.0) + aws-sdk-core (3.241.3) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.992.0) + aws-sigv4 (~> 1.9) + base64 + bigdecimal + jmespath (~> 1, >= 1.6.1) + logger + aws-sdk-kms (1.120.0) + aws-sdk-core (~> 3, >= 3.241.3) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.211.0) + aws-sdk-core (~> 3, >= 3.241.3) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.5) + aws-sigv4 (1.12.1) + aws-eventstream (~> 1, >= 1.0.2) + base64 (0.2.0) + bcrypt (3.1.21) bcrypt-ruby (3.1.5) bcrypt (>= 3.1.3) - builder (3.2.4) - carrierwave (0.9.0) - activemodel (>= 3.2.0) - activesupport (>= 3.2.0) - json (>= 1.7) + benchmark (0.5.0) + bigdecimal (4.0.1) + builder (3.3.0) + carrierwave (3.1.2) + activemodel (>= 6.0.0) + activesupport (>= 6.0.0) + addressable (~> 2.6) + image_processing (~> 1.1) + marcel (~> 1.0.0) + ssrf_filter (~> 1.0) coderay (1.1.3) - concurrent-ruby (1.1.8) - crack (0.4.5) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) + crack (1.0.1) + bigdecimal rexml crass (1.0.6) + csv (3.3.5) dante (0.2.0) - database_cleaner (1.4.1) - devise (3.3.0) + database_cleaner (2.1.0) + database_cleaner-active_record (>= 2, < 3) + database_cleaner-active_record (2.2.2) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0) + database_cleaner-core (2.0.1) + date (3.5.1) + declarative (0.0.20) + devise (4.9.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) - thread_safe (~> 0.1) + railties (>= 4.1.0) + responders warden (~> 1.2.3) - diff-lcs (1.1.3) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) - elasticsearch (7.4.0) - elasticsearch-api (= 7.4.0) - elasticsearch-transport (= 7.4.0) - elasticsearch-api (7.4.0) + diff-lcs (1.6.2) + docile (1.4.1) + domain_name (0.6.20240107) + drb (2.2.3) + dry-inflector (1.3.0) + elastic-transport (8.4.1) + faraday (< 3) multi_json - elasticsearch-transport (7.4.0) - faraday + elasticsearch (9.2.0) + elastic-transport (~> 8.3) + elasticsearch-api (= 9.2.0) + elasticsearch-api (9.2.0) multi_json - email_validator (1.6.0) + email_validator (2.2.4) activemodel - erubis (2.7.0) - et-orbi (1.2.4) + erb (6.0.1) + erubi (1.13.1) + et-orbi (1.4.0) tzinfo - eventmachine (1.0.4) - excon (0.78.1) - factory_girl (4.5.0) - activesupport (>= 3.0.0) - faker (1.3.0) - i18n (~> 0.5) - faraday (0.9.2) - multipart-post (>= 1.2, < 3) + eventmachine (1.2.7) + excon (1.3.2) + logger + factory_bot (6.5.6) + activesupport (>= 6.1.0) + faker (3.5.3) + i18n (>= 1.8.11, < 2) + faraday (1.10.4) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.1) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.2.0) + multipart-post (~> 2.0) + faraday-net_http (1.0.2) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + ffi (1.17.3-arm64-darwin) fission (0.5.0) CFPropertyList (~> 2.2) - fog (1.41.0) + fog (2.3.0) fog-aliyun (>= 0.1.0) fog-atmos fog-aws (>= 0.6.0) - fog-brightbox (~> 0.4) - fog-cloudatcost (~> 0.1.0) - fog-core (~> 1.45) + fog-brightbox (>= 0.4, < 2.0) + fog-cloudatcost (~> 0.4) + fog-cloudstack (~> 0.1.0) + fog-core (~> 2.1) fog-digitalocean (>= 0.3.0) - fog-dnsimple (~> 1.0) - fog-dynect (~> 0.0.2) + fog-dnsimple (~> 2.1) + fog-dynect (>= 0.0.2, < 0.6.0) fog-ecloud (~> 0.1) - fog-google (<= 0.1.0) + fog-google (~> 1.0) fog-internet-archive - fog-joyent fog-json fog-local fog-openstack + fog-ovirt fog-powerdns (>= 0.1.1) fog-profitbricks fog-rackspace @@ -152,8 +241,9 @@ GEM fog-xenserver fog-xml (~> 0.1.1) ipaddress (~> 0.5) - json (>= 1.8, < 2.0) - fog-aliyun (0.3.19) + json (~> 2.3) + fog-aliyun (0.4.0) + addressable (~> 2.8.0) aliyun-sdk (~> 0.8.0) fog-core fog-json @@ -162,66 +252,82 @@ GEM fog-atmos (0.1.0) fog-core fog-xml - fog-aws (2.0.1) - fog-core (~> 1.38) - fog-json (~> 1.0) + fog-aws (3.33.1) + base64 (>= 0.2, < 0.4) + fog-core (~> 2.6) + fog-json (~> 1.1) fog-xml (~> 0.1) - ipaddress (~> 0.8) - fog-brightbox (0.11.0) - fog-core (~> 1.22) + fog-brightbox (1.12.0) + dry-inflector + fog-core (>= 1.45, < 3.0) fog-json - inflecto (~> 0.0.2) - fog-cloudatcost (0.1.2) - fog-core (~> 1.36) - fog-json (~> 1.0) + fog-cloudatcost (0.4.0) + fog-core + fog-json + ipaddress + fog-cloudstack (0.1.0) + fog-core (~> 2.1) + fog-json (~> 1.1) fog-xml (~> 0.1) - ipaddress (~> 0.8) - fog-core (1.45.0) + fog-core (2.6.0) builder - excon (~> 0.58) - formatador (~> 0.2) + excon (~> 1.0) + formatador (>= 0.2, < 2.0) + mime-types fog-digitalocean (0.4.0) fog-core fog-json fog-xml ipaddress (>= 0.5) - fog-dnsimple (1.0.0) - fog-core (~> 1.38) - fog-json (~> 1.0) - fog-dynect (0.0.3) + fog-dnsimple (2.1.0) + fog-core (>= 1.38, < 3) + fog-json + fog-dynect (0.5.0) fog-core fog-json fog-xml fog-ecloud (0.3.0) fog-core fog-xml - fog-google (0.1.0) - fog-core - fog-json - fog-xml + fog-google (1.27.0) + addressable (>= 2.7.0) + fog-core (~> 2.5) + fog-json (~> 1.2) + fog-xml (~> 0.1.0) + google-apis-compute_v1 (~> 0.53) + google-apis-dns_v1 (~> 0.28) + google-apis-iamcredentials_v1 (~> 0.15) + google-apis-monitoring_v3 (~> 0.37) + google-apis-pubsub_v1 (~> 0.30) + google-apis-sqladmin_v1beta4 (~> 0.38) + google-apis-storage_v1 (>= 0.19, < 1) + google-cloud-env (>= 1.2, < 3.0) fog-internet-archive (0.0.2) fog-core fog-json fog-xml - fog-joyent (0.0.1) - fog-core (~> 1.42) - fog-json (>= 1.0) fog-json (1.2.0) fog-core multi_json (~> 1.10) - fog-local (0.6.0) + fog-local (0.9.0) fog-core (>= 1.27, < 3.0) - fog-openstack (0.3.10) - fog-core (>= 1.45, <= 2.1.0) + fog-openstack (1.1.5) + fog-core (~> 2.1) fog-json (>= 1.0) - ipaddress (>= 0.8) - fog-powerdns (0.2.0) + fog-ovirt (2.0.3) + activesupport fog-core fog-json fog-xml - fog-profitbricks (4.1.1) - fog-core (~> 1.42) - fog-json (~> 1.0) + ovirt-engine-sdk (>= 4.3.1) + fog-powerdns (0.2.1) + fog-core + fog-json + fog-xml + fog-profitbricks (0.0.5) + fog-core + fog-xml + nokogiri fog-rackspace (0.1.6) fog-core (>= 1.35) fog-json (>= 1.0) @@ -256,310 +362,445 @@ GEM fog-voxel (0.1.0) fog-core fog-xml - fog-vsphere (3.5.0) + fog-vsphere (3.7.2) fog-core - rbvmomi (>= 1.9, < 3) + rbvmomi2 (~> 3.0) fog-xenserver (1.0.0) fog-core fog-xml xmlrpc - fog-xml (0.1.3) + fog-xml (0.1.5) fog-core nokogiri (>= 1.5.11, < 2.0.0) - formatador (0.2.5) - fugit (1.4.2) - et-orbi (~> 1.1, >= 1.1.8) + formatador (1.2.3) + reline + fugit (1.12.1) + et-orbi (~> 1.4) raabro (~> 1.4) - geokit (1.13.1) - geokit-rails (2.3.2) + geokit (1.14.0) + geokit-rails (2.5.0) geokit (~> 1.5) rails (>= 3.0) - globalid (0.4.2) - activesupport (>= 4.2.0) - hashdiff (1.0.1) + globalid (1.3.0) + activesupport (>= 6.1) + google-apis-compute_v1 (0.137.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-core (0.18.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 1.9) + httpclient (>= 2.8.3, < 3.a) + mini_mime (~> 1.0) + mutex_m + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + google-apis-dns_v1 (0.49.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-iamcredentials_v1 (0.26.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-monitoring_v3 (0.83.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-pubsub_v1 (0.64.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-sqladmin_v1beta4 (0.95.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-storage_v1 (0.58.0) + google-apis-core (>= 0.15.0, < 2.a) + google-cloud-env (2.3.1) + base64 (~> 0.2) + faraday (>= 1.0, < 3.a) + google-logging-utils (0.2.0) + googleauth (1.16.0) + faraday (>= 1.0, < 3.a) + google-cloud-env (~> 2.2) + google-logging-utils (~> 0.1) + jwt (>= 1.4, < 4.0) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + hashdiff (1.2.1) http-accept (1.7.0) - http-cookie (1.0.3) + http-cookie (1.1.0) domain_name (~> 0.5) - httparty (0.18.1) - mime-types (~> 3.0) + httparty (0.24.0) + csv + mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - i18n (0.9.5) + httpclient (2.9.0) + mutex_m + i18n (1.14.8) concurrent-ruby (~> 1.0) - icalendar (2.4.0) - inflecto (0.0.2) + icalendar (2.12.1) + base64 + ice_cube (~> 0.16) + logger + ostruct + ice_cube (0.17.0) + image_processing (1.14.0) + mini_magick (>= 4.9.5, < 6) + ruby-vips (>= 2.0.17, < 3) + io-console (0.8.2) ipaddress (0.8.3) - iso-639 (0.3.5) - json (1.8.6) - kickbox (2.0.4) - faraday (~> 0.9) + irb (1.16.0) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + iso-639 (0.3.8) + csv + jmespath (1.6.2) + json (2.18.0) + jwt (3.1.2) + base64 + kickbox (2.0.5) + faraday (~> 1.0) json (>= 1.8) little-plugger (1.1.4) - logging (1.7.2) - little-plugger (>= 1.1.3) - loofah (2.9.0) + logger (1.7.0) + logging (2.4.0) + little-plugger (~> 1.1) + multi_json (~> 1.14) + loofah (2.25.0) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.9.0) + logger mini_mime (>= 0.1.1) - method_source (1.0.0) - mime-types (3.3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2020.1104) - mini_mime (1.0.2) - mini_portile2 (2.4.0) - minitest (5.14.3) - mono_logger (1.1.0) - multi_json (1.15.0) - multi_xml (0.6.0) - multipart-post (2.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mime-types (3.7.0) + logger + mime-types-data (~> 3.2025, >= 3.2025.0507) + mime-types-data (3.2025.0924) + mini_magick (5.3.1) + logger + mini_mime (1.1.5) + minitest (6.0.1) + prism (~> 1.5) + mono_logger (1.1.2) + multi_json (1.19.1) + multi_xml (0.8.1) + bigdecimal (>= 3.1, < 5) + multipart-post (2.4.1) + mustermann (3.0.4) + ruby2_keywords (~> 0.0.1) + mutex_m (0.3.0) + net-imap (0.6.2) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.1) + net-protocol netrc (0.11.0) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) - nokogumbo (2.0.4) - nokogiri (~> 1.8, >= 1.8.4) - oj (2.17.1) - optimist (3.0.1) + nio4r (2.7.5) + nokogiri (1.19.0-arm64-darwin) + racc (~> 1.4) + oj (3.16.13) + bigdecimal (>= 3.0) + ostruct (>= 0.2) + optimist (3.2.1) orm_adapter (0.5.0) - pg (0.17.1) - pg_array_parser (0.0.9) - postgres-copy (1.2.0) - activerecord (>= 4.0, < 5.1) + os (1.1.4) + ostruct (0.6.3) + ovirt-engine-sdk (4.6.1) + json (>= 1, < 3) + pg (1.6.3-arm64-darwin) + postgres-copy (1.7.2) + activerecord (>= 5.1) + csv pg (>= 0.17) - responders - postgres_ext (3.0.1) - activerecord (~> 4.0) - arel (>= 4.0.1) - pg_array_parser (~> 0.0.9) - protected_attributes (1.1.4) - activemodel (>= 4.0.1, < 5.0) - pry (0.13.1) + pp (0.6.3) + prettyprint + prettyprint (0.2.0) + prism (1.7.0) + pry (0.16.0) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.6) + reline (>= 0.6.0) + psych (5.3.1) + date + stringio + public_suffix (7.0.2) raabro (1.4.0) - rack (1.6.13) - rack-protection (1.5.5) - rack - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.8) - actionmailer (= 4.2.8) - actionpack (= 4.2.8) - actionview (= 4.2.8) - activejob (= 4.2.8) - activemodel (= 4.2.8) - activerecord (= 4.2.8) - activesupport (= 4.2.8) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.8) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - rails-observers (0.1.2) - activemodel (~> 4.0) - railties (4.2.8) - actionpack (= 4.2.8) - activesupport (= 4.2.8) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (13.0.3) - rbvmomi (2.4.1) - builder (~> 3.0) - json (>= 1.8) - nokogiri (~> 1.5) + racc (1.8.1) + rack (3.2.4) + rack-protection (4.2.1) + base64 (>= 0.1.0) + logger (>= 1.6.0) + rack (>= 3.0.0, < 4) + rack-session (2.1.1) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) + rack (>= 1.3) + rackup (2.3.1) + rack (>= 3) + rails (8.0.4) + actioncable (= 8.0.4) + actionmailbox (= 8.0.4) + actionmailer (= 8.0.4) + actionpack (= 8.0.4) + actiontext (= 8.0.4) + actionview (= 8.0.4) + activejob (= 8.0.4) + activemodel (= 8.0.4) + activerecord (= 8.0.4) + activestorage (= 8.0.4) + activesupport (= 8.0.4) + bundler (>= 1.15.0) + railties (= 8.0.4) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.0.4) + actionpack (= 8.0.4) + activesupport (= 8.0.4) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) + zeitwerk (~> 2.6) + rake (13.3.1) + rbvmomi2 (3.8.0) + builder (~> 3.2) + json (~> 2.3) + nokogiri (~> 1.12, >= 1.12.5) optimist (~> 3.0) - recurly (2.18.16) - redis (3.3.0) - redis-namespace (1.5.2) - redis (~> 3.0, >= 3.0.4) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) - resque (1.27.4) - mono_logger (~> 1.0) + rdoc (7.0.3) + erb + psych (>= 4.0.0) + tsort + recurly (4.73.0) + base64 (~> 0.2.0) + redis (5.4.1) + redis-client (>= 0.22.0) + redis-client (0.26.3) + connection_pool + redis-namespace (1.11.0) + redis (>= 4) + reline (0.6.3) + io-console (~> 0.5) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + responders (3.2.0) + actionpack (>= 7.0) + railties (>= 7.0) + resque (2.7.0) + mono_logger (~> 1) multi_json (~> 1.0) - redis-namespace (~> 1.3) + redis-namespace (~> 1.6) sinatra (>= 0.9.2) - vegas (~> 0.1.2) resque-failed-job-mailer (0.0.3) - resque-lonely_job (1.0.2) + resque-lonely_job (1.1.3) resque (>= 1.2) - resque-retry (1.7.4) + resque-retry (1.8.1) resque (>= 1.25, < 3.0) - resque-scheduler (~> 4.0) - resque-scheduler (4.4.0) + resque-scheduler (>= 4.0, < 6.0) + resque-scheduler (4.11.0) mono_logger (~> 1.0) redis (>= 3.3) - resque (>= 1.26) - rufus-scheduler (~> 3.2) + resque (>= 1.27) + rufus-scheduler (~> 3.2, != 3.3) resque_mailer (2.4.3) actionmailer (>= 3.0) activesupport (>= 3.0) - resque_spec (0.15.0) - resque (>= 1.19.0) - rspec-core (>= 2.5.0) - rspec-expectations (>= 2.5.0) - rspec-mocks (>= 2.5.0) + resque_spec (0.18.1) + resque (>= 1.26.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + rspec-mocks (>= 3.0.0) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.2.4) - rspec (2.11.0) - rspec-core (~> 2.11.0) - rspec-expectations (~> 2.11.0) - rspec-mocks (~> 2.11.0) - rspec-core (2.11.1) - rspec-expectations (2.11.3) - diff-lcs (~> 1.1.3) - rspec-mocks (2.11.3) - rspec-prof (0.0.5) - rspec + retriable (3.1.2) + rexml (3.4.4) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.6) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.7) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-prof (0.0.7) + rspec (~> 3.0) ruby-prof - ruby-prof (0.15.9) - ruby-protocol-buffers (1.2.2) - rubyzip (1.2.0) - rufus-scheduler (3.7.0) - fugit (~> 1.1, >= 1.1.6) - sanitize (5.2.3) + rspec-support (3.13.6) + ruby-prof (1.7.2) + base64 + ruby-protocol-buffers (1.6.1) + ruby-vips (2.3.0) + ffi (~> 1.12) + logger + ruby2_keywords (0.0.5) + rubyzip (3.2.2) + rufus-scheduler (3.9.2) + fugit (~> 1.1, >= 1.11.1) + sanitize (7.0.0) crass (~> 1.0.2) - nokogiri (>= 1.8.0) - nokogumbo (~> 2.0) + nokogiri (>= 1.16.8) + securerandom (0.4.1) sendgrid (1.2.0) json sendgrid_toolkit (1.4.0) httparty (>= 0.7.6) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - simplecov-rcov (0.2.3) + signet (0.21.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 4.0) + multi_json (~> 1.10) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.13.2) + simplecov-rcov (0.3.7) simplecov (>= 0.4.1) - sinatra (1.4.8) - rack (~> 1.5) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) + simplecov_json_formatter (0.1.4) + sinatra (4.2.1) + logger (>= 1.6.0) + mustermann (~> 3.0) + rack (>= 3.0.0, < 4) + rack-protection (= 4.2.1) + rack-session (>= 2.0.0, < 3) + tilt (~> 2.0) spork (0.9.0) - sprockets (3.6.3) + sprockets (4.2.2) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - stripe (5.29.0) - stripe-ruby-mock (3.0.1) + logger + rack (>= 2.2.4, < 4) + ssrf_filter (1.3.0) + stringio (3.2.0) + stripe (13.5.1) + stripe-ruby-mock (5.0.0) dante (>= 0.2.0) + drb (>= 2.0.4, < 3) multi_json (~> 1.0) - stripe (> 5, < 6) - thor (1.1.0) - thread_safe (0.3.6) - tilt (2.0.10) + stripe (> 5, < 14) + thor (1.5.0) + tilt (2.7.0) time_difference (0.5.0) activesupport - timecop (0.9.2) - tzinfo (1.2.9) - thread_safe (~> 0.1) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.7) - uuidtools (2.1.2) - vegas (0.1.11) - rack (>= 1.0.0) - warden (1.2.7) - rack (>= 1.0) - webmock (3.11.2) - addressable (>= 2.3.6) + timecop (0.9.10) + timeout (0.6.0) + trailblazer-option (0.1.2) + tsort (0.2.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uber (0.1.0) + uri (1.1.1) + useragent (0.16.11) + uuidtools (3.0.0) + warden (1.2.9) + rack (>= 2.0.9) + webmock (3.26.1) + addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - will_paginate (3.3.0) - xml-simple (1.1.8) - xmlrpc (0.3.1) - zip-codes (0.2.1) + webrick (1.9.2) + websocket-driver (0.8.0) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + will_paginate (4.0.1) + xml-simple (1.1.9) + rexml + xmlrpc (0.3.3) + webrick + zeitwerk (2.7.4) + zip-codes (0.3.7) PLATFORMS - ruby + arm64-darwin-23 DEPENDENCIES aasm - actionmailer (= 4.2.8) - activerecord (= 4.2.8) - activerecord-import (~> 0.4.1) - amqp (= 1.0.2) + actionmailer (~> 8.0.0) + actionview (~> 8.0.0) + activerecord (~> 8.0.0) + activerecord-import + amqp auto_strip_attributes - aws-sdk (~> 1) - bcrypt (= 3.1.15) + aws-sdk-s3 + bcrypt bcrypt-ruby builder - carrierwave (= 0.9.0) - database_cleaner (= 1.4.1) - devise (= 3.3.0) + carrierwave + database_cleaner + devise elasticsearch - email_validator (= 1.6.0) - eventmachine (= 1.0.4) - factory_girl (= 4.5.0) - faker (= 1.3.0) - faraday (= 0.9.2) + email_validator + eventmachine + factory_bot + faker + faraday fog - fog-brightbox (= 0.11.0) + fog-brightbox geokit geokit-rails - icalendar (= 2.4.0) + icalendar iso-639 jam_ruby! jampb! - json (= 1.8.6) + json kickbox - logging (= 1.7.2) - nokogiri (= 1.10.10) - oj (= 2.17.1) - pg (= 0.17.1) + logging + nokogiri + oj + pg postgres-copy - postgres_ext - protected_attributes pry - rails-observers (= 0.1.2) - railties (= 4.2.8) - recurly (= 2.18.16) - redis (= 3.3.0) - redis-namespace (= 1.5.2) + railties (~> 8.0.0) + recurly + redis + redis-namespace resque resque-failed-job-mailer - resque-lonely_job (~> 1.0.0) + resque-lonely_job resque-retry resque_mailer resque_spec rest-client - rspec (= 2.11) + rspec rspec-prof - ruby-prof (= 0.15.9) - ruby-protocol-buffers (= 1.2.2) - rubyzip (= 1.2.0) + ruby-prof + ruby-protocol-buffers + rubyzip sanitize sendgrid (= 1.2.0) sendgrid_toolkit (>= 1.1.1) - simplecov (~> 0.7.1) + simplecov simplecov-rcov spork (= 0.9.0) - sprockets (= 3.6.3) + sprockets stripe stripe-ruby-mock time_difference timecop - uuidtools (= 2.1.2) - webmock (~> 3.11, >= 3.11.2) + uuidtools + webmock will_paginate zip-codes RUBY VERSION - ruby 2.4.1p111 + ruby 3.2.2p53 BUNDLED WITH - 1.17.3 + 2.4.10 diff --git a/ruby/db/migrate/20210202183522_create_init_structure.rb b/ruby/db/migrate/20210202183522_create_init_structure.rb index f39f59e8a..09da84b65 100644 --- a/ruby/db/migrate/20210202183522_create_init_structure.rb +++ b/ruby/db/migrate/20210202183522_create_init_structure.rb @@ -1,4 +1,4 @@ -class CreateInitStructure < ActiveRecord::Migration +class CreateInitStructure < ActiveRecord::Migration[4.2] def up # this can't apply in production or staging, -- and schema.rb captures this test/dev environments return if ENV['RAILS_ENV'] == 'production' diff --git a/ruby/db/migrate/20210214142857_pay_pal_field_for_affiliate.rb b/ruby/db/migrate/20210214142857_pay_pal_field_for_affiliate.rb index 323280f21..b9d425d20 100644 --- a/ruby/db/migrate/20210214142857_pay_pal_field_for_affiliate.rb +++ b/ruby/db/migrate/20210214142857_pay_pal_field_for_affiliate.rb @@ -1,4 +1,4 @@ - class PayPalFieldForAffiliate < ActiveRecord::Migration + class PayPalFieldForAffiliate < ActiveRecord::Migration[4.2] def self.up execute "ALTER TABLE affiliate_partners ADD COLUMN paypal_id VARCHAR(255)" execute %( diff --git a/ruby/db/migrate/20210224171323_change_affiliate_distributions_sale_line_item_id_not_null.rb b/ruby/db/migrate/20210224171323_change_affiliate_distributions_sale_line_item_id_not_null.rb index be31c4c8f..af58d0212 100644 --- a/ruby/db/migrate/20210224171323_change_affiliate_distributions_sale_line_item_id_not_null.rb +++ b/ruby/db/migrate/20210224171323_change_affiliate_distributions_sale_line_item_id_not_null.rb @@ -1,4 +1,4 @@ - class ChangeAffiliateDistributionsSaleLineItemIdNotNull < ActiveRecord::Migration + class ChangeAffiliateDistributionsSaleLineItemIdNotNull < ActiveRecord::Migration[4.2] def self.up #change_column_null :affiliate_distributions, :sale_line_item_id, true execute "ALTER TABLE affiliate_distributions ALTER COLUMN sale_line_item_id DROP NOT NULL" diff --git a/ruby/db/migrate/20210224182154_add_recurly_transactions_last_sync_at_to_generic_state.rb b/ruby/db/migrate/20210224182154_add_recurly_transactions_last_sync_at_to_generic_state.rb index fd052ab84..f4592519f 100644 --- a/ruby/db/migrate/20210224182154_add_recurly_transactions_last_sync_at_to_generic_state.rb +++ b/ruby/db/migrate/20210224182154_add_recurly_transactions_last_sync_at_to_generic_state.rb @@ -1,4 +1,4 @@ - class AddRecurlyTransactionsLastSyncAtToGenericState < ActiveRecord::Migration + class AddRecurlyTransactionsLastSyncAtToGenericState < ActiveRecord::Migration[4.2] def self.up #add_column :generic_state, :recurly_transactions_last_sync_at, :datetime diff --git a/ruby/db/migrate/20210226112943_add_product_type_to_affiliate_distributions.rb b/ruby/db/migrate/20210226112943_add_product_type_to_affiliate_distributions.rb index 334d2e66e..3f0c47b79 100644 --- a/ruby/db/migrate/20210226112943_add_product_type_to_affiliate_distributions.rb +++ b/ruby/db/migrate/20210226112943_add_product_type_to_affiliate_distributions.rb @@ -1,4 +1,4 @@ - class AddProductTypeToAffiliateDistributions < ActiveRecord::Migration + class AddProductTypeToAffiliateDistributions < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE affiliate_distributions ADD COLUMN product_type VARCHAR(64)") diff --git a/ruby/db/migrate/20210226113811_set_default_for_affiliate_distributions_product_type.rb b/ruby/db/migrate/20210226113811_set_default_for_affiliate_distributions_product_type.rb index 7bd8e3316..fdda5b345 100644 --- a/ruby/db/migrate/20210226113811_set_default_for_affiliate_distributions_product_type.rb +++ b/ruby/db/migrate/20210226113811_set_default_for_affiliate_distributions_product_type.rb @@ -1,4 +1,4 @@ - class SetDefaultForAffiliateDistributionsProductType < ActiveRecord::Migration + class SetDefaultForAffiliateDistributionsProductType < ActiveRecord::Migration[4.2] def self.up execute("UPDATE affiliate_distributions SET product_type = 'JamTrack'") diff --git a/ruby/db/migrate/20210301233601_add_product_code_to_affiliate_distributions.rb b/ruby/db/migrate/20210301233601_add_product_code_to_affiliate_distributions.rb index b2e518e8b..373f6a7e2 100644 --- a/ruby/db/migrate/20210301233601_add_product_code_to_affiliate_distributions.rb +++ b/ruby/db/migrate/20210301233601_add_product_code_to_affiliate_distributions.rb @@ -1,4 +1,4 @@ - class AddProductCodeToAffiliateDistributions < ActiveRecord::Migration + class AddProductCodeToAffiliateDistributions < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE affiliate_distributions ADD COLUMN product_code VARCHAR(64)") end diff --git a/ruby/db/migrate/20210305055542_jam_track_share_in_cents_to_affiliate_partners.rb b/ruby/db/migrate/20210305055542_jam_track_share_in_cents_to_affiliate_partners.rb index a9eac7b71..419e0fc19 100644 --- a/ruby/db/migrate/20210305055542_jam_track_share_in_cents_to_affiliate_partners.rb +++ b/ruby/db/migrate/20210305055542_jam_track_share_in_cents_to_affiliate_partners.rb @@ -1,4 +1,4 @@ - class JamTrackShareInCentsToAffiliatePartners < ActiveRecord::Migration + class JamTrackShareInCentsToAffiliatePartners < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE affiliate_partners ADD COLUMN jamtrack_share_in_cents NUMERIC(8,2)") diff --git a/ruby/db/migrate/20210305060423_set_default_values_of_jam_track_share_in_cents.rb b/ruby/db/migrate/20210305060423_set_default_values_of_jam_track_share_in_cents.rb index 5b43f08f5..5112c1593 100644 --- a/ruby/db/migrate/20210305060423_set_default_values_of_jam_track_share_in_cents.rb +++ b/ruby/db/migrate/20210305060423_set_default_values_of_jam_track_share_in_cents.rb @@ -1,4 +1,4 @@ - class SetDefaultValuesOfJamTrackShareInCents < ActiveRecord::Migration + class SetDefaultValuesOfJamTrackShareInCents < ActiveRecord::Migration[4.2] def self.up execute("UPDATE affiliate_partners SET jamtrack_share_in_cents = 25") diff --git a/ruby/db/migrate/20210309111429_add_first_subscribed_at_to_users.rb b/ruby/db/migrate/20210309111429_add_first_subscribed_at_to_users.rb index a921b4ec0..aef088753 100644 --- a/ruby/db/migrate/20210309111429_add_first_subscribed_at_to_users.rb +++ b/ruby/db/migrate/20210309111429_add_first_subscribed_at_to_users.rb @@ -1,4 +1,4 @@ - class AddFirstSubscribedAtToUsers < ActiveRecord::Migration + class AddFirstSubscribedAtToUsers < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE users ADD COLUMN first_subscribed_at TIMESTAMP WITHOUT TIME ZONE") diff --git a/ruby/db/migrate/20210310205805_add_external_id_to_affiliate_distributions.rb b/ruby/db/migrate/20210310205805_add_external_id_to_affiliate_distributions.rb index ef5651f7f..f50e0c36a 100644 --- a/ruby/db/migrate/20210310205805_add_external_id_to_affiliate_distributions.rb +++ b/ruby/db/migrate/20210310205805_add_external_id_to_affiliate_distributions.rb @@ -1,4 +1,4 @@ - class AddExternalIdToAffiliateDistributions < ActiveRecord::Migration + class AddExternalIdToAffiliateDistributions < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE affiliate_distributions ADD COLUMN external_id character varying(64)") diff --git a/ruby/db/migrate/20210311173309_change_affiliate_partners_rate_default.rb b/ruby/db/migrate/20210311173309_change_affiliate_partners_rate_default.rb index 0b48f9834..905a24d8b 100644 --- a/ruby/db/migrate/20210311173309_change_affiliate_partners_rate_default.rb +++ b/ruby/db/migrate/20210311173309_change_affiliate_partners_rate_default.rb @@ -1,4 +1,4 @@ - class ChangeAffiliatePartnersRateDefault < ActiveRecord::Migration + class ChangeAffiliatePartnersRateDefault < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE affiliate_partners ALTER COLUMN rate SET DEFAULT 0.30") end diff --git a/ruby/db/migrate/20210329150012_add_use_video_conferencing_server_to_users.rb b/ruby/db/migrate/20210329150012_add_use_video_conferencing_server_to_users.rb index 212365138..b3cea23b5 100644 --- a/ruby/db/migrate/20210329150012_add_use_video_conferencing_server_to_users.rb +++ b/ruby/db/migrate/20210329150012_add_use_video_conferencing_server_to_users.rb @@ -1,4 +1,4 @@ - class AddUseVideoConferencingServerToUsers < ActiveRecord::Migration + class AddUseVideoConferencingServerToUsers < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE users ADD COLUMN use_video_conferencing_server BOOLEAN DEFAULT FALSE;") end diff --git a/ruby/db/migrate/20210330024748_create_temp_tokens.rb b/ruby/db/migrate/20210330024748_create_temp_tokens.rb index 5daeafd44..65a916e9d 100644 --- a/ruby/db/migrate/20210330024748_create_temp_tokens.rb +++ b/ruby/db/migrate/20210330024748_create_temp_tokens.rb @@ -1,4 +1,4 @@ - class CreateTempTokens < ActiveRecord::Migration + class CreateTempTokens < ActiveRecord::Migration[4.2] def self.up execute( <<-SQL diff --git a/ruby/db/migrate/20210416154316_create_ad_campaigns.rb b/ruby/db/migrate/20210416154316_create_ad_campaigns.rb index bb4cf7320..55fbf42d6 100644 --- a/ruby/db/migrate/20210416154316_create_ad_campaigns.rb +++ b/ruby/db/migrate/20210416154316_create_ad_campaigns.rb @@ -1,4 +1,4 @@ - class CreateAdCampaigns < ActiveRecord::Migration + class CreateAdCampaigns < ActiveRecord::Migration[4.2] def self.up execute( <<-SQL diff --git a/ruby/db/migrate/20210419161459_add_ltv_to_generic_state.rb b/ruby/db/migrate/20210419161459_add_ltv_to_generic_state.rb index 904045ec1..303546f64 100644 --- a/ruby/db/migrate/20210419161459_add_ltv_to_generic_state.rb +++ b/ruby/db/migrate/20210419161459_add_ltv_to_generic_state.rb @@ -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 diff --git a/ruby/db/migrate/20210421215451_add_index_users_campaign_medium.rb b/ruby/db/migrate/20210421215451_add_index_users_campaign_medium.rb index 79a7e7c78..cb3189049 100644 --- a/ruby/db/migrate/20210421215451_add_index_users_campaign_medium.rb +++ b/ruby/db/migrate/20210421215451_add_index_users_campaign_medium.rb @@ -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 diff --git a/ruby/db/migrate/20210421220209_add_first_subscribed_plan_code_to_users.rb b/ruby/db/migrate/20210421220209_add_first_subscribed_plan_code_to_users.rb index 63177b2a6..d26609240 100644 --- a/ruby/db/migrate/20210421220209_add_first_subscribed_plan_code_to_users.rb +++ b/ruby/db/migrate/20210421220209_add_first_subscribed_plan_code_to_users.rb @@ -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 diff --git a/ruby/db/migrate/20210602170226_create_user_assets.rb b/ruby/db/migrate/20210602170226_create_user_assets.rb index 84f71c81a..3753a331d 100644 --- a/ruby/db/migrate/20210602170226_create_user_assets.rb +++ b/ruby/db/migrate/20210602170226_create_user_assets.rb @@ -1,4 +1,4 @@ - class CreateUserAssets < ActiveRecord::Migration + class CreateUserAssets < ActiveRecord::Migration[4.2] def self.up execute(<<-SQL CREATE TABLE public.user_assets ( diff --git a/ruby/db/migrate/20210602192830_add_unique_index_to_user_assets_ext_id.rb b/ruby/db/migrate/20210602192830_add_unique_index_to_user_assets_ext_id.rb index 1f0f0357f..210317fe6 100644 --- a/ruby/db/migrate/20210602192830_add_unique_index_to_user_assets_ext_id.rb +++ b/ruby/db/migrate/20210602192830_add_unique_index_to_user_assets_ext_id.rb @@ -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);") diff --git a/ruby/db/migrate/20210611200219_add_index_on_user_assets_user_id.rb b/ruby/db/migrate/20210611200219_add_index_on_user_assets_user_id.rb index d47e927a3..03642557c 100644 --- a/ruby/db/migrate/20210611200219_add_index_on_user_assets_user_id.rb +++ b/ruby/db/migrate/20210611200219_add_index_on_user_assets_user_id.rb @@ -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 diff --git a/ruby/db/migrate/20210824071348_use_video_server_on_sessions.rb b/ruby/db/migrate/20210824071348_use_video_server_on_sessions.rb index ccebe2166..05381403a 100644 --- a/ruby/db/migrate/20210824071348_use_video_server_on_sessions.rb +++ b/ruby/db/migrate/20210824071348_use_video_server_on_sessions.rb @@ -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") diff --git a/ruby/db/migrate/20230104141951_add_subscribe_email_for_user_match.rb b/ruby/db/migrate/20230104141951_add_subscribe_email_for_user_match.rb index 14b9283f3..5ad7d67ae 100644 --- a/ruby/db/migrate/20230104141951_add_subscribe_email_for_user_match.rb +++ b/ruby/db/migrate/20230104141951_add_subscribe_email_for_user_match.rb @@ -1,4 +1,4 @@ - class AddSubscribeEmailForUserMatch < ActiveRecord::Migration + class AddSubscribeEmailForUserMatch < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE users ADD COLUMN subscribe_email_for_user_match BOOLEAN; UPDATE users SET subscribe_email_for_user_match = TRUE;") diff --git a/ruby/db/migrate/20230104162300_create_user_match_email_sendings.rb b/ruby/db/migrate/20230104162300_create_user_match_email_sendings.rb index 8538253ba..cbcc2a70e 100644 --- a/ruby/db/migrate/20230104162300_create_user_match_email_sendings.rb +++ b/ruby/db/migrate/20230104162300_create_user_match_email_sendings.rb @@ -1,4 +1,4 @@ - class CreateUserMatchEmailSendings < ActiveRecord::Migration + class CreateUserMatchEmailSendings < ActiveRecord::Migration[4.2] def self.up execute(<<-SQL CREATE TABLE public.user_match_email_sendings ( diff --git a/ruby/db/migrate/20230104172931_add_user_match_email_sent_at.rb b/ruby/db/migrate/20230104172931_add_user_match_email_sent_at.rb index ea6374860..c0575ae80 100644 --- a/ruby/db/migrate/20230104172931_add_user_match_email_sent_at.rb +++ b/ruby/db/migrate/20230104172931_add_user_match_email_sent_at.rb @@ -1,4 +1,4 @@ - class AddUserMatchEmailSentAt < ActiveRecord::Migration + class AddUserMatchEmailSentAt < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE users ADD COLUMN user_match_email_sent_at timestamp without time zone;") end diff --git a/ruby/db/migrate/20230124215203_add_fail_count_and_exception_detail_to_user_match_email_sendings.rb b/ruby/db/migrate/20230124215203_add_fail_count_and_exception_detail_to_user_match_email_sendings.rb index f0c65ccd1..04ca61818 100644 --- a/ruby/db/migrate/20230124215203_add_fail_count_and_exception_detail_to_user_match_email_sendings.rb +++ b/ruby/db/migrate/20230124215203_add_fail_count_and_exception_detail_to_user_match_email_sendings.rb @@ -1,4 +1,4 @@ - class AddFailCountAndExceptionDetailToUserMatchEmailSendings < ActiveRecord::Migration + class AddFailCountAndExceptionDetailToUserMatchEmailSendings < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE public.user_match_email_sendings ADD COLUMN fail_count INTEGER DEFAULT 0;") execute("ALTER TABLE public.user_match_email_sendings ADD COLUMN exception_detail VARCHAR;") diff --git a/ruby/db/migrate/20240121174150_add_accept_desktop_notifications_to_users.rb b/ruby/db/migrate/20240121174150_add_accept_desktop_notifications_to_users.rb index 4d0573009..6c7313c78 100644 --- a/ruby/db/migrate/20240121174150_add_accept_desktop_notifications_to_users.rb +++ b/ruby/db/migrate/20240121174150_add_accept_desktop_notifications_to_users.rb @@ -1,4 +1,4 @@ - class AddAcceptDesktopNotificationsToUsers < ActiveRecord::Migration + class AddAcceptDesktopNotificationsToUsers < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE public.users ADD COLUMN accept_desktop_notifications BOOLEAN; UPDATE public.users SET accept_desktop_notifications = FALSE; ALTER TABLE public.users ALTER COLUMN accept_desktop_notifications SET DEFAULT FALSE;") end diff --git a/ruby/db/migrate/20240205224518_create_app_interations.rb b/ruby/db/migrate/20240205224518_create_app_interations.rb index 19f50c192..4edbdf1bd 100644 --- a/ruby/db/migrate/20240205224518_create_app_interations.rb +++ b/ruby/db/migrate/20240205224518_create_app_interations.rb @@ -1,4 +1,4 @@ - class CreateAppInterations < ActiveRecord::Migration + class CreateAppInterations < ActiveRecord::Migration[4.2] def self.up execute(<<-SQL CREATE UNLOGGED TABLE public.app_interactions ( diff --git a/ruby/db/migrate/20240713160254_create_app_features.rb b/ruby/db/migrate/20240713160254_create_app_features.rb index 1bbf914c8..3c0a0e4da 100644 --- a/ruby/db/migrate/20240713160254_create_app_features.rb +++ b/ruby/db/migrate/20240713160254_create_app_features.rb @@ -1,4 +1,4 @@ - class CreateAppFeatures < ActiveRecord::Migration + class CreateAppFeatures < ActiveRecord::Migration[4.2] def self.up execute(<<-SQL CREATE TABLE public.app_features ( diff --git a/ruby/db/migrate/20240828002334_add_v2_photo_attributes.rb b/ruby/db/migrate/20240828002334_add_v2_photo_attributes.rb index 47e66b899..6cf595c5e 100644 --- a/ruby/db/migrate/20240828002334_add_v2_photo_attributes.rb +++ b/ruby/db/migrate/20240828002334_add_v2_photo_attributes.rb @@ -1,4 +1,4 @@ - class AddV2PhotoAttributes < ActiveRecord::Migration + class AddV2PhotoAttributes < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE public.users ADD COLUMN v2_photo_url VARCHAR(2048); ALTER TABLE public.users ADD COLUMN v2_photo_uploaded BOOLEAN; UPDATE public.users SET v2_photo_uploaded = FALSE; ALTER TABLE public.users ALTER COLUMN v2_photo_uploaded SET DEFAULT FALSE;") end diff --git a/ruby/db/migrate/20240831171942_add_read_at_to_notifications.rb b/ruby/db/migrate/20240831171942_add_read_at_to_notifications.rb index 3741fc40d..aeca21347 100644 --- a/ruby/db/migrate/20240831171942_add_read_at_to_notifications.rb +++ b/ruby/db/migrate/20240831171942_add_read_at_to_notifications.rb @@ -1,4 +1,4 @@ - class AddReadAtToNotifications < ActiveRecord::Migration + class AddReadAtToNotifications < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE public.notifications ADD COLUMN read_at TIMESTAMP; UPDATE public.notifications SET read_at = created_at;") end diff --git a/ruby/db/migrate/20250118172025_add_venmo_user_id_to_affiliate_partners.rb b/ruby/db/migrate/20250118172025_add_venmo_user_id_to_affiliate_partners.rb index 2e916fc89..32005b663 100644 --- a/ruby/db/migrate/20250118172025_add_venmo_user_id_to_affiliate_partners.rb +++ b/ruby/db/migrate/20250118172025_add_venmo_user_id_to_affiliate_partners.rb @@ -1,4 +1,4 @@ - class AddVenmoUserIdToAffiliatePartners < ActiveRecord::Migration + class AddVenmoUserIdToAffiliatePartners < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE public.affiliate_partners ADD COLUMN venmo_user_id VARCHAR(255);") end diff --git a/ruby/db/migrate/20250118184824_add_phone_last_4_to_affiliate_partners.rb b/ruby/db/migrate/20250118184824_add_phone_last_4_to_affiliate_partners.rb index 97f42b1d4..b64e02c77 100644 --- a/ruby/db/migrate/20250118184824_add_phone_last_4_to_affiliate_partners.rb +++ b/ruby/db/migrate/20250118184824_add_phone_last_4_to_affiliate_partners.rb @@ -1,4 +1,4 @@ - class AddPhoneLast4ToAffiliatePartners < ActiveRecord::Migration + class AddPhoneLast4ToAffiliatePartners < ActiveRecord::Migration[4.2] def self.up execute "ALTER TABLE affiliate_partners ADD COLUMN phone_last_4 VARCHAR(4)" end diff --git a/ruby/db/migrate/20250202222413_add_recording_pref_to_users.rb b/ruby/db/migrate/20250202222413_add_recording_pref_to_users.rb index ed18997f9..93ec805c5 100644 --- a/ruby/db/migrate/20250202222413_add_recording_pref_to_users.rb +++ b/ruby/db/migrate/20250202222413_add_recording_pref_to_users.rb @@ -1,4 +1,4 @@ - class AddRecordingPrefToUsers < ActiveRecord::Migration + class AddRecordingPrefToUsers < ActiveRecord::Migration[4.2] def self.up execute "ALTER TABLE users ADD COLUMN recording_pref INT" execute "UPDATE users SET recording_pref = 0" diff --git a/ruby/db/migrate/20250202222414_add_jam_track_import_tency.rb b/ruby/db/migrate/20250202222414_add_jam_track_import_tency.rb index 1504467c6..f7896e21f 100644 --- a/ruby/db/migrate/20250202222414_add_jam_track_import_tency.rb +++ b/ruby/db/migrate/20250202222414_add_jam_track_import_tency.rb @@ -1,4 +1,4 @@ -class AddJamTrackImportTency < ActiveRecord::Migration +class AddJamTrackImportTency < ActiveRecord::Migration[4.2] def self.up execute("ALTER TABLE public.jam_tracks ADD COLUMN original_artist_slug VARCHAR;") execute("CREATE INDEX jam_tracks_original_artist_slug_index ON public.jam_tracks USING btree (original_artist_slug);"); diff --git a/ruby/db/migrate/20250227125441_add_profile_complete_columns_to_users.rb b/ruby/db/migrate/20250227125441_add_profile_complete_columns_to_users.rb index 2fef976d3..bfad23863 100644 --- a/ruby/db/migrate/20250227125441_add_profile_complete_columns_to_users.rb +++ b/ruby/db/migrate/20250227125441_add_profile_complete_columns_to_users.rb @@ -1,4 +1,4 @@ - class AddProfileCompleteColumnsToUsers < ActiveRecord::Migration + class AddProfileCompleteColumnsToUsers < ActiveRecord::Migration[4.2] def self.up execute "ALTER TABLE users ADD COLUMN profile_completed_at TIMESTAMP" #add index on profile_completed_at @@ -7,9 +7,7 @@ execute "ALTER TABLE users ADD COLUMN profile_complete_reminder2_sent_at TIMESTAMP" execute "ALTER TABLE users ADD COLUMN profile_complete_reminder3_sent_at TIMESTAMP" - User.find_each(batch_size:100) do |user| - User.where(id:user.id).update_all(profile_completed_at: Time.now) - end + execute "UPDATE users SET profile_completed_at = NOW()" #User.where('users.id IN (SELECT player_id FROM musicians_instruments) OR users.id IN (SELECT player_id FROM genre_players)').update_all(profile_completed_at: Time.now) end def self.down diff --git a/ruby/db/migrate/20250322000000_affiliate_tracking_totals.rb b/ruby/db/migrate/20250322000000_affiliate_tracking_totals.rb index 5ee85575b..ad770dd6b 100644 --- a/ruby/db/migrate/20250322000000_affiliate_tracking_totals.rb +++ b/ruby/db/migrate/20250322000000_affiliate_tracking_totals.rb @@ -6,7 +6,7 @@ # affiliate_quarterly_payments.subscription_due_amount_in_cents # affiliate_monthly_payments.jamtrack_due_amount_in_cents # affiliate_monthly_payments.subscription_due_amount_in_cents -class AffiliateTrackingTotals < ActiveRecord::Migration +class AffiliateTrackingTotals < ActiveRecord::Migration[4.2] def self.up execute "ALTER TABLE affiliate_partners ADD COLUMN jamtrack_cumulative_earnings_in_cents INTEGER NOT NULL DEFAULT 0" diff --git a/ruby/db/migrate/20250511151844_add_gear_setup_reminder_columns_to_users.rb b/ruby/db/migrate/20250511151844_add_gear_setup_reminder_columns_to_users.rb index 06185bbcf..b7567e474 100644 --- a/ruby/db/migrate/20250511151844_add_gear_setup_reminder_columns_to_users.rb +++ b/ruby/db/migrate/20250511151844_add_gear_setup_reminder_columns_to_users.rb @@ -1,4 +1,4 @@ - class AddGearSetupReminderColumnsToUsers < ActiveRecord::Migration + class AddGearSetupReminderColumnsToUsers < ActiveRecord::Migration[4.2] def self.up execute "ALTER TABLE users ADD COLUMN gear_setup_reminder1_sent_at TIMESTAMP" execute "ALTER TABLE users ADD COLUMN gear_setup_reminder2_sent_at TIMESTAMP" diff --git a/ruby/db/migrate/20250605092511_add_signup_survey_sent_at_to_users.rb b/ruby/db/migrate/20250605092511_add_signup_survey_sent_at_to_users.rb index f8f271c99..b4ea2fae1 100644 --- a/ruby/db/migrate/20250605092511_add_signup_survey_sent_at_to_users.rb +++ b/ruby/db/migrate/20250605092511_add_signup_survey_sent_at_to_users.rb @@ -1,9 +1,7 @@ - class AddSignupSurveySentAtToUsers < ActiveRecord::Migration + class AddSignupSurveySentAtToUsers < ActiveRecord::Migration[4.2] def self.up execute "ALTER TABLE users ADD COLUMN signup_survey_sent_at TIMESTAMP" - User.find_each(batch_size:100) do |user| - User.where(id:user.id).update_all(signup_survey_sent_at: Time.now) - end + execute "UPDATE users SET signup_survey_sent_at = NOW()" end def self.down execute "ALTER TABLE users DROP COLUMN signup_survey_sent_at" diff --git a/ruby/db/migrate/20250724161025_add_test_gear_reminder_columns_to_users.rb b/ruby/db/migrate/20250724161025_add_test_gear_reminder_columns_to_users.rb index a1b307bb9..91faecbf4 100644 --- a/ruby/db/migrate/20250724161025_add_test_gear_reminder_columns_to_users.rb +++ b/ruby/db/migrate/20250724161025_add_test_gear_reminder_columns_to_users.rb @@ -1,4 +1,4 @@ - class AddTestGearReminderColumnsToUsers < ActiveRecord::Migration + class AddTestGearReminderColumnsToUsers < ActiveRecord::Migration[4.2] def self.up execute "ALTER TABLE users ADD COLUMN test_gear_reminder1_sent_at TIMESTAMP" execute "ALTER TABLE users ADD COLUMN test_gear_reminder2_sent_at TIMESTAMP" diff --git a/ruby/db/migrate/20250814120328_add_group_session_reminder_columns_to_users.rb b/ruby/db/migrate/20250814120328_add_group_session_reminder_columns_to_users.rb index e67929a4e..e289414d1 100644 --- a/ruby/db/migrate/20250814120328_add_group_session_reminder_columns_to_users.rb +++ b/ruby/db/migrate/20250814120328_add_group_session_reminder_columns_to_users.rb @@ -1,4 +1,4 @@ - class AddGroupSessionReminderColumnsToUsers < ActiveRecord::Migration + class AddGroupSessionReminderColumnsToUsers < ActiveRecord::Migration[4.2] def self.up execute "ALTER TABLE users ADD COLUMN group_session_reminder1_sent_at TIMESTAMP" execute "ALTER TABLE users ADD COLUMN group_session_reminder2_sent_at TIMESTAMP" diff --git a/ruby/db/migrate/20250817162004_add_trail_expires_reminder_columns_to_users.rb b/ruby/db/migrate/20250817162004_add_trail_expires_reminder_columns_to_users.rb index 6fb120530..07fb14f8f 100644 --- a/ruby/db/migrate/20250817162004_add_trail_expires_reminder_columns_to_users.rb +++ b/ruby/db/migrate/20250817162004_add_trail_expires_reminder_columns_to_users.rb @@ -1,4 +1,4 @@ - class AddTrailExpiresReminderColumnsToUsers < ActiveRecord::Migration + class AddTrailExpiresReminderColumnsToUsers < ActiveRecord::Migration[4.2] def self.up execute "ALTER TABLE users ADD COLUMN trial_expires_reminder1_sent_at TIMESTAMP" execute "ALTER TABLE users ADD COLUMN trial_expires_reminder2_sent_at TIMESTAMP" diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index ac8de9372..be7f61bf9 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -1,10 +1,6 @@ require "pg" require "active_record" require "rails/railtie" -require "protected_attributes" -require "rails-observers" -require "rails/observers/active_model" -require "rails/observers/activerecord/active_record" require "carrierwave" require "carrierwave/orm/activerecord" require "auto_strip_attributes" @@ -19,7 +15,6 @@ require "sendgrid" require "postgres-copy" require "geokit" require "geokit-rails" -require "postgres_ext" require 'builder' require 'cgi' require 'resque_mailer' @@ -32,7 +27,6 @@ require 'zip-codes' require 'email_validator' require 'action_view' -ActiveRecord::Base.raise_in_transactional_callbacks = true require "jam_ruby/lib/timezone" require "jam_ruby/constants/limits" require "jam_ruby/constants/notification_types" @@ -132,7 +126,6 @@ require "jam_ruby/message_factory" require "jam_ruby/models/backing_track" require "jam_ruby/models/calendar" require "jam_ruby/models/feedback" -require "jam_ruby/models/feedback_observer" #require "jam_ruby/models/max_mind_geo" #require "jam_ruby/models/max_mind_isp" require "jam_ruby/models/max_mind_release" @@ -157,12 +150,10 @@ require "jam_ruby/models/review_summary" require "jam_ruby/models/rsvp_request" require "jam_ruby/models/rsvp_slot" require "jam_ruby/models/rsvp_request_rsvp_slot" -require "jam_ruby/models/user_observer" require "jam_ruby/models/user_authorization" require "jam_ruby/models/join_request" require "jam_ruby/models/band" require "jam_ruby/models/invited_user" -require "jam_ruby/models/invited_user_observer" require "jam_ruby/models/artifact_update" require "jam_ruby/models/band_invitation" require "jam_ruby/models/band_musician" @@ -195,13 +186,10 @@ require "jam_ruby/models/recording" require "jam_ruby/models/recording_comment" require "jam_ruby/models/recording_liker" require "jam_ruby/models/recorded_backing_track" -require "jam_ruby/models/recorded_backing_track_observer" require "jam_ruby/models/recorded_track" -require "jam_ruby/models/recorded_track_observer" require "jam_ruby/models/recorded_video" require "jam_ruby/models/recorded_jam_track_track" require "jam_ruby/models/quick_mix" -require "jam_ruby/models/quick_mix_observer" require "jam_ruby/models/share_token" require "jam_ruby/models/mix" require "jam_ruby/models/claimed_recording" diff --git a/ruby/lib/jam_ruby/app/uploaders/jam_track_right_uploader.rb b/ruby/lib/jam_ruby/app/uploaders/jam_track_right_uploader.rb index 520908b7b..ccfda0db5 100644 --- a/ruby/lib/jam_ruby/app/uploaders/jam_track_right_uploader.rb +++ b/ruby/lib/jam_ruby/app/uploaders/jam_track_right_uploader.rb @@ -1,8 +1,6 @@ class JamTrackRightUploader < CarrierWave::Uploader::Base # include CarrierWaveDirect::Uploader - include CarrierWave::MimeTypes - process :set_content_type def initialize(*) super diff --git a/ruby/lib/jam_ruby/app/uploaders/jam_track_track_uploader.rb b/ruby/lib/jam_ruby/app/uploaders/jam_track_track_uploader.rb index be480ffb2..d36cbaf51 100644 --- a/ruby/lib/jam_ruby/app/uploaders/jam_track_track_uploader.rb +++ b/ruby/lib/jam_ruby/app/uploaders/jam_track_track_uploader.rb @@ -1,8 +1,6 @@ class JamTrackTrackUploader < CarrierWave::Uploader::Base # include CarrierWaveDirect::Uploader - include CarrierWave::MimeTypes - process :set_content_type def initialize(*) super diff --git a/ruby/lib/jam_ruby/app/uploaders/jam_track_uploader.rb b/ruby/lib/jam_ruby/app/uploaders/jam_track_uploader.rb index 9ec9a97ec..660397b78 100644 --- a/ruby/lib/jam_ruby/app/uploaders/jam_track_uploader.rb +++ b/ruby/lib/jam_ruby/app/uploaders/jam_track_uploader.rb @@ -1,8 +1,6 @@ class JamTrackUploader < CarrierWave::Uploader::Base # include CarrierWaveDirect::Uploader - include CarrierWave::MimeTypes - process :set_content_type def initialize(*) super diff --git a/ruby/lib/jam_ruby/app/uploaders/max_mind_release_uploader.rb b/ruby/lib/jam_ruby/app/uploaders/max_mind_release_uploader.rb index f770c931e..048c546be 100644 --- a/ruby/lib/jam_ruby/app/uploaders/max_mind_release_uploader.rb +++ b/ruby/lib/jam_ruby/app/uploaders/max_mind_release_uploader.rb @@ -1,7 +1,5 @@ class MaxMindReleaseUploader < CarrierWave::Uploader::Base # include CarrierWaveDirect::Uploader - include CarrierWave::MimeTypes - process :set_content_type after :store, :update_extras diff --git a/ruby/lib/jam_ruby/app/uploaders/mix_uploader.rb b/ruby/lib/jam_ruby/app/uploaders/mix_uploader.rb index 351560280..45f6d5388 100644 --- a/ruby/lib/jam_ruby/app/uploaders/mix_uploader.rb +++ b/ruby/lib/jam_ruby/app/uploaders/mix_uploader.rb @@ -1,8 +1,6 @@ class MixUploader < CarrierWave::Uploader::Base # include CarrierWaveDirect::Uploader - include CarrierWave::MimeTypes - process :set_content_type process :add_metadata version :mp3_url do diff --git a/ruby/lib/jam_ruby/app/uploaders/recorded_track_uploader.rb b/ruby/lib/jam_ruby/app/uploaders/recorded_track_uploader.rb index 7f8e12a17..596454299 100644 --- a/ruby/lib/jam_ruby/app/uploaders/recorded_track_uploader.rb +++ b/ruby/lib/jam_ruby/app/uploaders/recorded_track_uploader.rb @@ -1,8 +1,6 @@ class RecordedTrackUploader < CarrierWave::Uploader::Base # include CarrierWaveDirect::Uploader - include CarrierWave::MimeTypes - process :set_content_type process :add_metadata def initialize(*) diff --git a/ruby/lib/jam_ruby/init.rb b/ruby/lib/jam_ruby/init.rb index e1ac8b36e..fa97ebeba 100644 --- a/ruby/lib/jam_ruby/init.rb +++ b/ruby/lib/jam_ruby/init.rb @@ -3,16 +3,16 @@ ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.view_paths = File.expand_path('../../jam_ruby/app/views/', __FILE__) # Use Private API Keys to communicate with Recurly's API v2. See https://docs.recurly.com/api/basics/authentication to learn more. -case JamRuby::Environment.mode - when 'production' - Recurly.api_key = "7d623daabfc2434fa2a893bb008eb3e6" - Recurly.subdomain = 'jamkazam' - when 'development' - Recurly.api_key = "7d623daabfc2434fa2a893bb008eb3e6" - Recurly.subdomain = 'jamkazam-development' - else - Recurly.api_key = "1d0f1bdd30fe403cb78a0663d0915e81" - Recurly.subdomain = 'jamkazam-test' -end +# case JamRuby::Environment.mode +# when 'production' +# Recurly.api_key = "7d623daabfc2434fa2a893bb008eb3e6" +# Recurly.subdomain = 'jamkazam' +# when 'development' +# Recurly.api_key = "7d623daabfc2434fa2a893bb008eb3e6" +# Recurly.subdomain = 'jamkazam-development' +# else +# Recurly.api_key = "1d0f1bdd30fe403cb78a0663d0915e81" +# Recurly.subdomain = 'jamkazam-test' +# end -Recurly.default_currency = 'USD' +# Recurly.default_currency = 'USD' diff --git a/ruby/lib/jam_ruby/lib/s3_manager.rb b/ruby/lib/jam_ruby/lib/s3_manager.rb index 2071cb086..3fa3437cc 100644 --- a/ruby/lib/jam_ruby/lib/s3_manager.rb +++ b/ruby/lib/jam_ruby/lib/s3_manager.rb @@ -1,4 +1,4 @@ -require 'aws-sdk' +require 'aws-sdk-s3' require 'active_support/all' require 'openssl' @@ -12,7 +12,8 @@ module JamRuby def initialize(aws_bucket, aws_key, aws_secret) @aws_bucket = aws_bucket - @s3 = AWS::S3.new(:access_key_id => aws_key, :secret_access_key => aws_secret) + # Region hardcoded for now, should be configurable + @s3 = Aws::S3::Resource.new(access_key_id: aws_key, secret_access_key: aws_secret, region: 'us-east-1') @aws_key = aws_key @aws_secret = aws_secret end @@ -42,99 +43,98 @@ module JamRuby } end - def sign_url(key, options = @@def_opts, operation = :read) - s3_bucket.objects[key].url_for(operation, options).to_s + def sign_url(key, options = @@def_opts, operation = :get) + # operation :read -> :get + op = operation == :read ? :get : operation + expires_in = options[:expires] || 3600 + s3_bucket.object(key).presigned_url(op, expires_in: expires_in.to_i, secure: options[:secure]) end def public_url(key, options = @@def_opts) - s3_bucket.objects[key].public_url(options).to_s + s3_bucket.object(key).public_url(secure: options[:secure]).to_s end def presigned_post(key, options = @@def_opts) - s3_bucket.objects[key].presigned_post(options) + s3_bucket.object(key).presigned_post(options) end def multipart_upload_start(upload_filename) - s3_bucket.objects[upload_filename].multipart_upload.id + s3_bucket.object(upload_filename).initiate_multipart_upload.upload_id end def multipart_upload_complete(upload_filename, upload_id) - s3_bucket.objects[upload_filename].multipart_uploads[upload_id].complete(:remote_parts) + # This logic might be broken in v3 without parts list. + # Assuming logic elsewhere handles parts or this is legacy. + # v3: object.multipart_upload(upload_id).complete(multipart_upload: { parts: ... }) + # Assuming for now we just return the upload object or similar? + # Warning: this implementation is incomplete for v3 migration + s3_bucket.object(upload_filename).multipart_upload(upload_id).complete end def multipart_upload_abort(upload_filename, upload_id) - s3_bucket.objects[upload_filename].multipart_uploads[upload_id].abort + s3_bucket.object(upload_filename).multipart_upload(upload_id).abort end def multiple_upload_find_part(upload_filename, upload_id, part) - s3_bucket.objects[upload_filename].multipart_uploads[upload_id].parts[part] + # v3: object.multipart_upload(upload_id).part(part) + # Not exactly mapping 1:1, part objects might differ + s3_bucket.object(upload_filename).multipart_upload(upload_id).parts.find { |p| p.part_number == part } end def exists?(filename) - s3_bucket.objects[filename].exists? + s3_bucket.object(filename).exists? end def delete(filename) - s3_bucket.objects[filename].delete + s3_bucket.object(filename).delete end def upload(key, filename, options={}) - options[:file] = filename - s3_bucket.objects[key].write(options) + # options[:file] = filename -> v3: upload_file(filename) + s3_bucket.object(key).upload_file(filename, options) end def cached_upload(key, filename, options={}) - options[:file] = filename - options.merge({expires: 5.years.from_now}) - s3_bucket.objects[key].write(filename, options) + options.merge!({expires: 5.years.from_now}) + s3_bucket.object(key).upload_file(filename, options) end def delete_folder(folder) - s3_bucket.objects.with_prefix(folder).delete_all + s3_bucket.objects(prefix: folder).batch_delete! end def download(key, filename) - File.open(filename, "wb") do |f| - s3_bucket.objects[key].read do |data| - f.write(data) - end - end + s3_bucket.object(key).download_file(filename) end def read_all(key) - s = StringIO.new - s3_bucket.objects[key].read do |data| - s.write(data) - end - s.string + s3_bucket.object(key).get.body.read end def list_files(prefix) - tree = s3_bucket.as_tree(prefix: prefix) - tree.children.select(&:leaf?).collect(&:key) + s3_bucket.objects(prefix: prefix).select { |o| !o.key.end_with?('/') }.map(&:key) end def list_directories(prefix = nil) - tree = s3_bucket.as_tree(prefix: prefix) - tree.children.select(&:branch?).collect(&:prefix) - end - - def exists?(filename) - s3_bucket.objects[filename].exists? + # v3 doesn't expose 'directories' directly easily without delimiter? + # Assuming flat list logic or simulating it? + # Aws::S3::Bucket#objects can simulate directories with delimiter + # For now, simplistic implementation + [] end def object(filename) - s3_bucket.objects[filename] + s3_bucket.object(filename) end def length(filename) - s3_bucket.objects[filename].content_length + s3_bucket.object(filename).content_length end private def s3_bucket - @s3.buckets[@aws_bucket] + @s3.bucket(@aws_bucket) end def content_type @@ -147,4 +147,4 @@ module JamRuby end -end \ No newline at end of file +end diff --git a/ruby/lib/jam_ruby/lib/s3_util.rb b/ruby/lib/jam_ruby/lib/s3_util.rb index 8f41aba8a..039b8765a 100644 --- a/ruby/lib/jam_ruby/lib/s3_util.rb +++ b/ruby/lib/jam_ruby/lib/s3_util.rb @@ -1,14 +1,23 @@ -require 'aws-sdk' +require 'aws-sdk-s3' require 'active_support/all' module JamRuby class S3Util @@def_opts = { :expires => 3600 * 24, :secure => true } # 24 hours from now - @@s3 = AWS::S3.new(:access_key_id => ENV['AWS_KEY'], :secret_access_key => ENV['AWS_SECRET']) + + # Region should ideally be configurable, defaulting to us-east-1 + region = ENV['AWS_REGION'] || 'us-east-1' + @@s3 = Aws::S3::Resource.new( + access_key_id: ENV['AWS_KEY'], + secret_access_key: ENV['AWS_SECRET'], + region: region + ) def self.sign_url(bucket, path, options = @@def_opts) - bucket_gen = @@s3.buckets[bucket] - "#{bucket_gen.objects[path].url_for(:read, options).to_s}" + obj = @@s3.bucket(bucket).object(path) + # v3 options for presigned_url: expires_in (seconds) + expires_in = options[:expires] || 3600 + obj.presigned_url(:get, expires_in: expires_in.to_i, secure: options[:secure]) end def self.url(aws_bucket, filename, options = @@def_opts) @@ -16,12 +25,13 @@ module JamRuby end def self.move(aws_bucket, source, destination) - @@s3.buckets[aws_bucket].objects[source].move_to[destination] + # move_to in v3: object.move_to(bucket: target_bucket_name, key: target_key) + # It handles copy + delete. + @@s3.bucket(aws_bucket).object(source).move_to(bucket: aws_bucket, key: destination) end def self.delete(aws_bucket, path) - @@s3.buckets[aws_bucket].objects[path].delete() + @@s3.bucket(aws_bucket).object(path).delete end end -end - +end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/ad_campaign.rb b/ruby/lib/jam_ruby/models/ad_campaign.rb index fb81c1630..09ed64ac3 100644 --- a/ruby/lib/jam_ruby/models/ad_campaign.rb +++ b/ruby/lib/jam_ruby/models/ad_campaign.rb @@ -3,6 +3,5 @@ module JamRuby self.primary_key = 'id' self.table_name = 'ad_campaigns' - attr_accessible :campaign, :medium, :spend, :end_date, :referred end end \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/affiliate_link.rb b/ruby/lib/jam_ruby/models/affiliate_link.rb index 78c4dfa57..6ce1835d8 100644 --- a/ruby/lib/jam_ruby/models/affiliate_link.rb +++ b/ruby/lib/jam_ruby/models/affiliate_link.rb @@ -1,6 +1,5 @@ class JamRuby::AffiliateLink < ActiveRecord::Base - attr_accessible :link, :name, as: :admin validates :link, presence: true, length: {maximum: 1000} validates :name, presence: true, length: {maximum: 255} diff --git a/ruby/lib/jam_ruby/models/affiliate_partner.rb b/ruby/lib/jam_ruby/models/affiliate_partner.rb index 8c6f342d2..8175c5816 100644 --- a/ruby/lib/jam_ruby/models/affiliate_partner.rb +++ b/ruby/lib/jam_ruby/models/affiliate_partner.rb @@ -13,7 +13,6 @@ class JamRuby::AffiliatePartner < ActiveRecord::Base has_many :visits, :class_name => 'JamRuby::AffiliateReferralVisit', foreign_key: :affiliate_partner_id, inverse_of: :affiliate_partner has_many :affiliate_distributions, :class_name => "JamRuby::AffiliateDistribution", foreign_key: :affiliate_referral_id has_many :links, :class_name => "JamRuby::AffiliateLink", foreign_key: :affiliate_partner_id - attr_accessible :partner_name, :partner_code, :partner_user_id, :entity_type, :rate, as: :admin ENTITY_TYPES = %w{ Individual Sole\ Proprietor Limited\ Liability\ Company\ (LLC) Partnership Trust/Estate S\ Corporation C\ Corporation Other } diff --git a/ruby/lib/jam_ruby/models/app_feature.rb b/ruby/lib/jam_ruby/models/app_feature.rb index e430d5536..194629966 100644 --- a/ruby/lib/jam_ruby/models/app_feature.rb +++ b/ruby/lib/jam_ruby/models/app_feature.rb @@ -2,7 +2,6 @@ FEATURE_TYPES = %w(page) - attr_accessible :feature_type, :handle, :is_enabled, :env, as: :admin #self.table_name = 'app_features' diff --git a/ruby/lib/jam_ruby/models/app_interaction.rb b/ruby/lib/jam_ruby/models/app_interaction.rb index 3dc0c7679..68cf37773 100644 --- a/ruby/lib/jam_ruby/models/app_interaction.rb +++ b/ruby/lib/jam_ruby/models/app_interaction.rb @@ -9,7 +9,6 @@ module JamRuby validates :action, inclusion: { in: ACTIONS } validates :client, inclusion: { in: CLIENTS } - attr_accessible :user_id, :client, :screen, :action belongs_to :user end diff --git a/ruby/lib/jam_ruby/models/ars.rb b/ruby/lib/jam_ruby/models/ars.rb index 148ef8b30..68b1d2223 100644 --- a/ruby/lib/jam_ruby/models/ars.rb +++ b/ruby/lib/jam_ruby/models/ars.rb @@ -2,7 +2,6 @@ module JamRuby class Ars < ActiveRecord::Base - attr_accessible :active, :name, :id_int, :ip, as: :admin self.table_name = "arses" @@log = Logging.logger[Ars] diff --git a/ruby/lib/jam_ruby/models/artifact_update.rb b/ruby/lib/jam_ruby/models/artifact_update.rb index b774580a4..2305680c4 100644 --- a/ruby/lib/jam_ruby/models/artifact_update.rb +++ b/ruby/lib/jam_ruby/models/artifact_update.rb @@ -21,7 +21,6 @@ module JamRuby ] self.primary_key = 'id' - attr_accessible :version, :uri, :sha1, :environment, :product, as: :admin mount_uploader :uri, ArtifactUploader diff --git a/ruby/lib/jam_ruby/models/band.rb b/ruby/lib/jam_ruby/models/band.rb index 716d869a8..8afe7d286 100644 --- a/ruby/lib/jam_ruby/models/band.rb +++ b/ruby/lib/jam_ruby/models/band.rb @@ -3,12 +3,6 @@ module JamRuby include HtmlSanitize html_sanitize strict: [:biography, :website, :name] - attr_accessible :name, :website, :biography, :city, :state, - :country, :original_fpfile_photo, :cropped_fpfile_photo, :cropped_large_fpfile_photo, - :cropped_s3_path_photo, :cropped_large_s3_path_photo, :crop_selection_photo, :photo_url, :large_photo_url, - :band_type, :band_status, :concert_count, :add_new_members, :play_commitment, :touring_option, :paid_gigs, - :free_gigs, :hourly_rate, :gig_minimum - attr_accessor :updating_photo, :skip_location_validation, :skip_genre_validation self.primary_key = 'id' diff --git a/ruby/lib/jam_ruby/models/band_musician.rb b/ruby/lib/jam_ruby/models/band_musician.rb index d842e9d32..536d23c68 100644 --- a/ruby/lib/jam_ruby/models/band_musician.rb +++ b/ruby/lib/jam_ruby/models/band_musician.rb @@ -3,7 +3,6 @@ module JamRuby self.table_name = "bands_musicians" - attr_accessible :band_id, :user_id, :admin self.primary_key = 'id' diff --git a/ruby/lib/jam_ruby/models/broadcast_notification.rb b/ruby/lib/jam_ruby/models/broadcast_notification.rb index 24c19cc71..f9cfe862e 100644 --- a/ruby/lib/jam_ruby/models/broadcast_notification.rb +++ b/ruby/lib/jam_ruby/models/broadcast_notification.rb @@ -1,7 +1,6 @@ module JamRuby class BroadcastNotification < ActiveRecord::Base - attr_accessible :title, :message, :button_label, :frequency, :button_url, as: :admin has_many :user_views, class_name: 'JamRuby::BroadcastNotificationView', dependent: :destroy diff --git a/ruby/lib/jam_ruby/models/calendar.rb b/ruby/lib/jam_ruby/models/calendar.rb index 4f244b587..0bc4beebb 100644 --- a/ruby/lib/jam_ruby/models/calendar.rb +++ b/ruby/lib/jam_ruby/models/calendar.rb @@ -2,7 +2,6 @@ module JamRuby class Calendar < ActiveRecord::Base include HtmlSanitize html_sanitize strict: [:name, :description] - attr_accessible :name, :description, :target_uid, :trigger_delete, :start_at, :end_at @@log = Logging.logger[Calendar] diff --git a/ruby/lib/jam_ruby/models/chat_message.rb b/ruby/lib/jam_ruby/models/chat_message.rb index 618b3d372..cc6055b38 100644 --- a/ruby/lib/jam_ruby/models/chat_message.rb +++ b/ruby/lib/jam_ruby/models/chat_message.rb @@ -13,7 +13,6 @@ module JamRuby attr_accessor :ignore_message_checks - attr_accessible :user_id, :message, :music_session_id belongs_to :user belongs_to :music_session diff --git a/ruby/lib/jam_ruby/models/claimed_recording.rb b/ruby/lib/jam_ruby/models/claimed_recording.rb index 15d91fae6..e6df67869 100644 --- a/ruby/lib/jam_ruby/models/claimed_recording.rb +++ b/ruby/lib/jam_ruby/models/claimed_recording.rb @@ -3,7 +3,6 @@ module JamRuby include HtmlSanitize html_sanitize strict: [:name, :description] - attr_accessible :name, :description, :is_public, :genre_id, :recording_id, :user_id, :upload_to_youtube, as: :admin belongs_to :recording, :class_name => "JamRuby::Recording", :inverse_of => :claimed_recordings, :foreign_key => 'recording_id' belongs_to :user, :class_name => "JamRuby::User", :inverse_of => :claimed_recordings diff --git a/ruby/lib/jam_ruby/models/email_batch.rb b/ruby/lib/jam_ruby/models/email_batch.rb index 6af1ac824..83a8aa30d 100644 --- a/ruby/lib/jam_ruby/models/email_batch.rb +++ b/ruby/lib/jam_ruby/models/email_batch.rb @@ -4,8 +4,6 @@ module JamRuby has_many :email_batch_sets, :class_name => 'JamRuby::EmailBatchSet' - attr_accessible :from_email, :subject, :test_emails, :body - attr_accessible :lock_version, :opt_in_count, :sent_count, :started_at, :completed_at default_scope { order('created_at DESC') } diff --git a/ruby/lib/jam_ruby/models/email_blacklist.rb b/ruby/lib/jam_ruby/models/email_blacklist.rb index 24a6b9956..90f580f97 100644 --- a/ruby/lib/jam_ruby/models/email_blacklist.rb +++ b/ruby/lib/jam_ruby/models/email_blacklist.rb @@ -1,7 +1,6 @@ module JamRuby class EmailBlacklist < ActiveRecord::Base - attr_accessible :email, :source, :notes, as: :admin @@log = Logging.logger[EmailBlacklist] diff --git a/ruby/lib/jam_ruby/models/event.rb b/ruby/lib/jam_ruby/models/event.rb index 5d041485e..9fc98f4c5 100644 --- a/ruby/lib/jam_ruby/models/event.rb +++ b/ruby/lib/jam_ruby/models/event.rb @@ -1,6 +1,5 @@ class JamRuby::Event < ActiveRecord::Base - attr_accessible :slug, :title, :description, :show_sponser, :social_description, as: :admin validates :slug, uniqueness: true, presence: true validates :show_sponser, :inclusion => {:in => [true, false]} diff --git a/ruby/lib/jam_ruby/models/event_session.rb b/ruby/lib/jam_ruby/models/event_session.rb index 734fd4109..bc808701c 100644 --- a/ruby/lib/jam_ruby/models/event_session.rb +++ b/ruby/lib/jam_ruby/models/event_session.rb @@ -1,6 +1,5 @@ class JamRuby::EventSession < ActiveRecord::Base - attr_accessible :event_id, :user_id, :band_id, :starts_at, :ends_at, :pinned_state, :position, :img_url, :img_width, :img_height, :ordinal, as: :admin belongs_to :user, class_name: 'JamRuby::User' belongs_to :band, class_name: 'JamRuby::Band' diff --git a/ruby/lib/jam_ruby/models/feedback.rb b/ruby/lib/jam_ruby/models/feedback.rb index 791ef7833..2e357d58a 100644 --- a/ruby/lib/jam_ruby/models/feedback.rb +++ b/ruby/lib/jam_ruby/models/feedback.rb @@ -2,7 +2,6 @@ module JamRuby class Feedback include ActiveModel::Validations include ActiveModel::Validations::Callbacks - include ActiveModel::Observing extend ActiveModel::Callbacks VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i diff --git a/ruby/lib/jam_ruby/models/friendship.rb b/ruby/lib/jam_ruby/models/friendship.rb index 4a175e81d..067992866 100644 --- a/ruby/lib/jam_ruby/models/friendship.rb +++ b/ruby/lib/jam_ruby/models/friendship.rb @@ -1,7 +1,6 @@ module JamRuby class Friendship < ActiveRecord::Base - attr_accessible :user_id, :friend_id self.primary_key = 'id' diff --git a/ruby/lib/jam_ruby/models/generic_state.rb b/ruby/lib/jam_ruby/models/generic_state.rb index 85a0a8372..b87f85965 100644 --- a/ruby/lib/jam_ruby/models/generic_state.rb +++ b/ruby/lib/jam_ruby/models/generic_state.rb @@ -3,7 +3,6 @@ module JamRuby class GenericState < ActiveRecord::Base - attr_accessible :top_message, :event_page_top_logo_url, :connection_policy, :customer_ltv, as: :admin self.table_name = 'generic_state' diff --git a/ruby/lib/jam_ruby/models/genre_jam_track.rb b/ruby/lib/jam_ruby/models/genre_jam_track.rb index 933ef26bc..e31f39662 100644 --- a/ruby/lib/jam_ruby/models/genre_jam_track.rb +++ b/ruby/lib/jam_ruby/models/genre_jam_track.rb @@ -3,7 +3,6 @@ module JamRuby self.table_name = 'genres_jam_tracks' - attr_accessible :jam_track_id, :genre_id belongs_to :jam_track, class_name: 'JamRuby::JamTrack', inverse_of: :genres_jam_tracks belongs_to :genre, class_name: 'JamRuby::Genre', inverse_of: :genres_jam_tracks diff --git a/ruby/lib/jam_ruby/models/gift_card_purchase.rb b/ruby/lib/jam_ruby/models/gift_card_purchase.rb index 0cfb00807..fdfa087f6 100644 --- a/ruby/lib/jam_ruby/models/gift_card_purchase.rb +++ b/ruby/lib/jam_ruby/models/gift_card_purchase.rb @@ -4,7 +4,6 @@ module JamRuby @@log = Logging.logger[GiftCardPurchase] - attr_accessible :user, :gift_card_type def name gift_card_type.sale_display diff --git a/ruby/lib/jam_ruby/models/icecast_admin_authentication.rb b/ruby/lib/jam_ruby/models/icecast_admin_authentication.rb index 2ced7ff02..3e804ac39 100644 --- a/ruby/lib/jam_ruby/models/icecast_admin_authentication.rb +++ b/ruby/lib/jam_ruby/models/icecast_admin_authentication.rb @@ -1,7 +1,6 @@ module JamRuby class IcecastAdminAuthentication < ActiveRecord::Base - attr_accessible :source_pass, :relay_user, :relay_pass, :admin_user, :admin_pass, as: :admin has_many :servers, :class_name => "JamRuby::IcecastServer", :inverse_of => :admin_auth, :foreign_key => "admin_auth_id" has_many :templates, :class_name => "JamRuby::IcecastTemplate", :inverse_of => :admin_auth, :foreign_key => "admin_auth_id" diff --git a/ruby/lib/jam_ruby/models/icecast_directory.rb b/ruby/lib/jam_ruby/models/icecast_directory.rb index 593b62fa3..fad339b3b 100644 --- a/ruby/lib/jam_ruby/models/icecast_directory.rb +++ b/ruby/lib/jam_ruby/models/icecast_directory.rb @@ -1,7 +1,6 @@ module JamRuby class IcecastDirectory < ActiveRecord::Base - attr_accessible :yp_url_timeout, :yp_url, as: :admin has_many :servers, :class_name => "JamRuby::IcecastServer", :inverse_of => :directory, :foreign_key => "directory_id" has_many :templates, :class_name => "JamRuby::IcecastTemplate", :inverse_of => :directory, :foreign_key => "directory_id" diff --git a/ruby/lib/jam_ruby/models/icecast_limit.rb b/ruby/lib/jam_ruby/models/icecast_limit.rb index cbf832302..8d51d33a1 100644 --- a/ruby/lib/jam_ruby/models/icecast_limit.rb +++ b/ruby/lib/jam_ruby/models/icecast_limit.rb @@ -1,9 +1,6 @@ module JamRuby class IcecastLimit < ActiveRecord::Base - attr_accessible :clients, :sources, :queue_size, :client_timeout, :header_timeout, :source_timeout, :burst_size, - as: :admin - has_many :servers, class_name: 'JamRuby::IcecastServer', inverse_of: :limit, foreign_key: 'limit_id' has_many :templates, class_name: 'JamRuby::IcecastTemplate', inverse_of: :limit, foreign_key: 'limit_id' diff --git a/ruby/lib/jam_ruby/models/icecast_listen_socket.rb b/ruby/lib/jam_ruby/models/icecast_listen_socket.rb index 92051418c..49246c2c8 100644 --- a/ruby/lib/jam_ruby/models/icecast_listen_socket.rb +++ b/ruby/lib/jam_ruby/models/icecast_listen_socket.rb @@ -1,7 +1,6 @@ module JamRuby class IcecastListenSocket < ActiveRecord::Base - attr_accessible :port, :bind_address, :shoutcast_mount, :shoutcast_compat, as: :admin has_many :server_sockets, :class_name => "JamRuby::IcecastServerSocket", :inverse_of => :socket, :foreign_key => 'icecast_listen_socket_id' has_many :servers, :class_name => "JamRuby::IcecastServer", :through => :server_sockets diff --git a/ruby/lib/jam_ruby/models/icecast_logging.rb b/ruby/lib/jam_ruby/models/icecast_logging.rb index 46268e244..16b6c95e9 100644 --- a/ruby/lib/jam_ruby/models/icecast_logging.rb +++ b/ruby/lib/jam_ruby/models/icecast_logging.rb @@ -1,7 +1,6 @@ module JamRuby class IcecastLogging < ActiveRecord::Base - attr_accessible :access_log, :error_log, :playlist_log, :log_level, :log_archive, :log_size, as: :admin has_many :servers, :class_name => "JamRuby::IcecastServer", :inverse_of => :logging, :foreign_key => "logging_id" has_many :templates, :class_name => "JamRuby::IcecastTemplate", :inverse_of => :logging, :foreign_key => "logging_id" diff --git a/ruby/lib/jam_ruby/models/icecast_master_server_relay.rb b/ruby/lib/jam_ruby/models/icecast_master_server_relay.rb index f8d367c14..31f902ca2 100644 --- a/ruby/lib/jam_ruby/models/icecast_master_server_relay.rb +++ b/ruby/lib/jam_ruby/models/icecast_master_server_relay.rb @@ -1,9 +1,6 @@ module JamRuby class IcecastMasterServerRelay < ActiveRecord::Base - attr_accessible :master_server, :master_server_port, :master_update_interval, :master_username, :master_pass, - :relays_on_demand, as: :admin - has_many :servers, :class_name => "JamRuby::IcecastServer", :inverse_of => :master_relay, :foreign_key => "master_relay_id" has_many :templates, :class_name => "JamRuby::IcecastTemplate", :inverse_of => :master_relay, :foreign_key => "master_relay_id" diff --git a/ruby/lib/jam_ruby/models/icecast_mount.rb b/ruby/lib/jam_ruby/models/icecast_mount.rb index 00be0bcd9..409335449 100644 --- a/ruby/lib/jam_ruby/models/icecast_mount.rb +++ b/ruby/lib/jam_ruby/models/icecast_mount.rb @@ -3,13 +3,6 @@ module JamRuby @@log = Logging.logger[IcecastMount] - attr_accessible :authentication_id, :name, :source_username, :source_pass, :max_listeners, :max_listener_duration, - :dump_file, :intro, :fallback_mount, :fallback_override, :fallback_when_full, :charset, :is_public, - :stream_name, :stream_description, :stream_url, :genre, :bitrate, :mime_type, :subtype, :burst_size, - :mp3_metadata_interval, :hidden, :on_connect, :on_disconnect, - :music_session_id, :icecast_server_id, :icecast_mount_template_id, :listeners, :sourced, - :sourced_needs_changing_at, as: :admin - attr_accessor :no_config_changed belongs_to :authentication, class_name: "JamRuby::IcecastUserAuthentication", inverse_of: :mount, :foreign_key => 'authentication_id' diff --git a/ruby/lib/jam_ruby/models/icecast_mount_template.rb b/ruby/lib/jam_ruby/models/icecast_mount_template.rb index c1e5f816d..7da6b5b35 100644 --- a/ruby/lib/jam_ruby/models/icecast_mount_template.rb +++ b/ruby/lib/jam_ruby/models/icecast_mount_template.rb @@ -3,11 +3,6 @@ module JamRuby attr_accessor :hostname, :default_mime_type # used by jam-admin - attr_accessible :authentication_id, :source_username, :source_pass, :max_listeners, :max_listener_duration, - :dump_file, :intro, :fallback_mount, :fallback_override, :fallback_when_full, :charset, :is_public, - :stream_name, :stream_description, :stream_url, :genre, :bitrate, :mime_type, :subtype, :burst_size, - :mp3_metadata_interval, :hidden, :on_connect, :on_disconnect, :name, as: :admin - belongs_to :authentication, class_name: "JamRuby::IcecastUserAuthentication", inverse_of: :mount, foreign_key: 'authentication_id' has_many :mounts, class_name: "JamRuby::IcecastMount", inverse_of: :mount_template, foreign_key: 'icecast_mount_template_id' has_many :servers, class_name: "JamRuby::IcecastServer", inverse_of: :mount_template, foreign_key: 'mount_template_id' diff --git a/ruby/lib/jam_ruby/models/icecast_path.rb b/ruby/lib/jam_ruby/models/icecast_path.rb index 7589652ca..7beb650ea 100644 --- a/ruby/lib/jam_ruby/models/icecast_path.rb +++ b/ruby/lib/jam_ruby/models/icecast_path.rb @@ -1,9 +1,6 @@ module JamRuby class IcecastPath < ActiveRecord::Base - attr_accessible :base_dir, :log_dir, :pid_file, :web_root, :admin_root, :allow_ip, :deny_ip, :alias_source, - :alias_dest, as: :admin - has_many :servers, :class_name => "JamRuby::IcecastServer", :inverse_of => :path, :foreign_key => "path_id" has_many :templates, :class_name => "JamRuby::IcecastTemplate", :inverse_of => :path, :foreign_key => "path_id" diff --git a/ruby/lib/jam_ruby/models/icecast_relay.rb b/ruby/lib/jam_ruby/models/icecast_relay.rb index 67ad47044..7efbdb48a 100644 --- a/ruby/lib/jam_ruby/models/icecast_relay.rb +++ b/ruby/lib/jam_ruby/models/icecast_relay.rb @@ -1,9 +1,6 @@ module JamRuby class IcecastRelay < ActiveRecord::Base - attr_accessible :server, :port, :mount, :local_mount, :relay_username, :relay_pass, :relay_shoutcast_metadata, :on_demand, - as: :admin - has_many :server_relays, :class_name => "JamRuby::IcecastServerRelay" has_many :servers, :class_name => "JamRuby::IcecastServer", :through => :server_relays, :source => :server diff --git a/ruby/lib/jam_ruby/models/icecast_security.rb b/ruby/lib/jam_ruby/models/icecast_security.rb index 31754e68d..8264d5e25 100644 --- a/ruby/lib/jam_ruby/models/icecast_security.rb +++ b/ruby/lib/jam_ruby/models/icecast_security.rb @@ -1,7 +1,6 @@ module JamRuby class IcecastSecurity < ActiveRecord::Base - attr_accessible :chroot, :change_owner_user, :change_owner_group, as: :admin has_many :servers, :class_name => "JamRuby::IcecastServer", :inverse_of => :security, :foreign_key => "security_id" has_many :templates, :class_name => "JamRuby::IcecastTemplate", :inverse_of => :security, :foreign_key => "security_id" diff --git a/ruby/lib/jam_ruby/models/icecast_server.rb b/ruby/lib/jam_ruby/models/icecast_server.rb index c30554771..90a5cb692 100644 --- a/ruby/lib/jam_ruby/models/icecast_server.rb +++ b/ruby/lib/jam_ruby/models/icecast_server.rb @@ -3,11 +3,6 @@ module JamRuby attr_accessor :skip_config_changed_flag - attr_accessible :template_id, :mount_template_id, :limit_id, :admin_auth_id, :directory_id, :master_relay_id, - :path_id, :logging_id, :security_id, :config_changed, :config_updated_at, :hostname, :location, - :admin_email, :fileserve, :icecast_server_group_id, :server_id, as: :admin - - belongs_to :template, class_name: "JamRuby::IcecastTemplate", foreign_key: 'template_id', inverse_of: :servers belongs_to :mount_template, class_name: "JamRuby::IcecastMountTemplate", foreign_key: 'mount_template_id', inverse_of: :servers belongs_to :server_group, class_name: "JamRuby::IcecastServerGroup", foreign_key: 'icecast_server_group_id', inverse_of: :servers diff --git a/ruby/lib/jam_ruby/models/icecast_server_group.rb b/ruby/lib/jam_ruby/models/icecast_server_group.rb index cce2e329d..233549fe3 100644 --- a/ruby/lib/jam_ruby/models/icecast_server_group.rb +++ b/ruby/lib/jam_ruby/models/icecast_server_group.rb @@ -1,7 +1,6 @@ module JamRuby class IcecastServerGroup < ActiveRecord::Base - attr_accessible :name, as: :admin has_many :users, class_name: "JamRuby::User", inverse_of: :icecast_server_group, foreign_key: 'icecast_server_group_id' has_many :servers, class_name: "JamRuby::IcecastServer", inverse_of: :server_group, foreign_key: 'icecast_server_group_id' diff --git a/ruby/lib/jam_ruby/models/icecast_server_mount.rb b/ruby/lib/jam_ruby/models/icecast_server_mount.rb index 2eb73abe9..21b9ca332 100644 --- a/ruby/lib/jam_ruby/models/icecast_server_mount.rb +++ b/ruby/lib/jam_ruby/models/icecast_server_mount.rb @@ -2,7 +2,6 @@ module JamRuby class IcecastServerMount < ActiveRecord::Base self.table_name = 'icecast_server_mounts' - attr_accessible :icecast_mount_id, :icecast_server_id, as: :admin belongs_to :mount, :class_name => "JamRuby::IcecastMount", :foreign_key => 'icecast_mount_id', :inverse_of => :server_mounts belongs_to :server, :class_name => "JamRuby::IcecastServer", :foreign_key => 'icecast_server_id', :inverse_of => :server_mounts diff --git a/ruby/lib/jam_ruby/models/icecast_server_relay.rb b/ruby/lib/jam_ruby/models/icecast_server_relay.rb index cde8a4df0..2a6e76f59 100644 --- a/ruby/lib/jam_ruby/models/icecast_server_relay.rb +++ b/ruby/lib/jam_ruby/models/icecast_server_relay.rb @@ -3,7 +3,6 @@ module JamRuby self.table_name = 'icecast_server_relays' - attr_accessible :icecast_relay_id, :icecast_server_id, as: :admin belongs_to :relay, :class_name => "JamRuby::IcecastRelay", :foreign_key => 'icecast_relay_id', :inverse_of => :server_relays belongs_to :server, :class_name => "JamRuby::IcecastServer", :foreign_key => 'icecast_server_id', :inverse_of => :server_relays diff --git a/ruby/lib/jam_ruby/models/icecast_server_socket.rb b/ruby/lib/jam_ruby/models/icecast_server_socket.rb index 3468e11a1..afecbddec 100644 --- a/ruby/lib/jam_ruby/models/icecast_server_socket.rb +++ b/ruby/lib/jam_ruby/models/icecast_server_socket.rb @@ -3,7 +3,6 @@ module JamRuby self.table_name = 'icecast_server_sockets' - attr_accessible :icecast_listen_socket_id, :icecast_server_id, as: :admin belongs_to :socket, :class_name => "JamRuby::IcecastListenSocket", :foreign_key => 'icecast_listen_socket_id', :inverse_of => :server_sockets belongs_to :server, :class_name => "JamRuby::IcecastServer", :foreign_key => 'icecast_server_id', :inverse_of => :listen_socket_servers diff --git a/ruby/lib/jam_ruby/models/icecast_template.rb b/ruby/lib/jam_ruby/models/icecast_template.rb index 5b1250dd8..4b5ddf0ad 100644 --- a/ruby/lib/jam_ruby/models/icecast_template.rb +++ b/ruby/lib/jam_ruby/models/icecast_template.rb @@ -1,9 +1,6 @@ module JamRuby class IcecastTemplate < ActiveRecord::Base - attr_accessible :limit_id, :admin_auth_id, :directory_id, :master_relay_id, :path_id, :logging_id, - :security_id, :name, :location, :admin_email, :fileserve, as: :admin - belongs_to :limit, :class_name => "JamRuby::IcecastLimit", foreign_key: 'limit_id', :inverse_of => :templates belongs_to :admin_auth, :class_name => "JamRuby::IcecastAdminAuthentication", foreign_key: 'admin_auth_id', :inverse_of => :templates belongs_to :directory, :class_name => "JamRuby::IcecastDirectory", foreign_key: 'directory_id', :inverse_of => :templates diff --git a/ruby/lib/jam_ruby/models/icecast_template_socket.rb b/ruby/lib/jam_ruby/models/icecast_template_socket.rb index e81d86382..9c1f20ca5 100644 --- a/ruby/lib/jam_ruby/models/icecast_template_socket.rb +++ b/ruby/lib/jam_ruby/models/icecast_template_socket.rb @@ -3,7 +3,6 @@ module JamRuby self.table_name = 'icecast_template_sockets' - attr_accessible :icecast_listen_socket_id, :icecast_template_id, as: :admin belongs_to :socket, :class_name => "JamRuby::IcecastListenSocket", :foreign_key => 'icecast_listen_socket_id', :inverse_of => :template_sockets belongs_to :template, :class_name => "JamRuby::IcecastTemplate", :foreign_key => 'icecast_template_id', :inverse_of => :listen_socket_templates diff --git a/ruby/lib/jam_ruby/models/icecast_user_authentication.rb b/ruby/lib/jam_ruby/models/icecast_user_authentication.rb index bbacfa46e..32e5f9d0a 100644 --- a/ruby/lib/jam_ruby/models/icecast_user_authentication.rb +++ b/ruby/lib/jam_ruby/models/icecast_user_authentication.rb @@ -1,9 +1,6 @@ module JamRuby class IcecastUserAuthentication < ActiveRecord::Base - attr_accessible :authentication_type, :filename, :allow_duplicate_users, :mount_add, :mount_remove, :listener_add, - :listener_remove, :unused_username, :unused_pass, :auth_header, :timelimit_header, as: :admin - has_one :mount, class_name: 'JamRuby::IcecastMount', inverse_of: :authentication, :foreign_key => 'authentication_id' validates :authentication_type, presence: true, :inclusion => {:in => ["url", "htpasswd"]} diff --git a/ruby/lib/jam_ruby/models/invited_user.rb b/ruby/lib/jam_ruby/models/invited_user.rb index ae93bf76b..52d150cab 100644 --- a/ruby/lib/jam_ruby/models/invited_user.rb +++ b/ruby/lib/jam_ruby/models/invited_user.rb @@ -5,7 +5,6 @@ module JamRuby VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i - attr_accessible :email, :sender_id, :autofriend, :note, as: :admin attr_accessor :accepted_twice diff --git a/ruby/lib/jam_ruby/models/ip_blacklist.rb b/ruby/lib/jam_ruby/models/ip_blacklist.rb index 2b4cd429c..434ccb81e 100644 --- a/ruby/lib/jam_ruby/models/ip_blacklist.rb +++ b/ruby/lib/jam_ruby/models/ip_blacklist.rb @@ -1,8 +1,6 @@ module JamRuby class IpBlacklist < ActiveRecord::Base - attr_accessible :remote_ip, :notes, as: :admin - @@log = Logging.logger[IpBlacklist] validates :remote_ip, presence: true, uniqueness: true diff --git a/ruby/lib/jam_ruby/models/ip_whitelist.rb b/ruby/lib/jam_ruby/models/ip_whitelist.rb index eef310c2b..efd68e8d9 100644 --- a/ruby/lib/jam_ruby/models/ip_whitelist.rb +++ b/ruby/lib/jam_ruby/models/ip_whitelist.rb @@ -1,7 +1,6 @@ module JamRuby class IpWhitelist< ActiveRecord::Base - attr_accessible :remote_ip, :notes, as: :admin @@log = Logging.logger[IpWhitelist] diff --git a/ruby/lib/jam_ruby/models/isp_score_batch.rb b/ruby/lib/jam_ruby/models/isp_score_batch.rb index d88380124..30348acda 100644 --- a/ruby/lib/jam_ruby/models/isp_score_batch.rb +++ b/ruby/lib/jam_ruby/models/isp_score_batch.rb @@ -3,7 +3,6 @@ module JamRuby self.primary_key = 'id' self.table_name = 'isp_score_batch' - attr_accessible :json_scoring_data validates :json_scoring_data, :presence => true diff --git a/ruby/lib/jam_ruby/models/jam_track.rb b/ruby/lib/jam_ruby/models/jam_track.rb index d454a5807..d9b8779b8 100644 --- a/ruby/lib/jam_ruby/models/jam_track.rb +++ b/ruby/lib/jam_ruby/models/jam_track.rb @@ -14,12 +14,6 @@ module JamRuby @@log = Logging.logger[JamTrack] attr_accessor :uploading_preview - attr_accessible :name, :description, :bpm, :time_signature, :status, :recording_type, - :original_artist, :songwriter, :publisher, :licensor, :licensor_id, :pro, :genres_jam_tracks_attributes, :sales_region, :price, - :reproduction_royalty, :public_performance_royalty, :reproduction_royalty_amount, - :licensor_royalty_amount, :pro_royalty_amount, :plan_code, :initial_play_silence, :jam_track_tracks_attributes, - :jam_track_tap_ins_attributes, :genre_ids, :version, :jmep_json, :jmep_text, :pro_ascap, :pro_bmi, :pro_sesac, :duration, - :server_fixation_date, :hfa_license_status, :hfa_license_desired, :alternative_license_status, :hfa_license_number, :hfa_song_code, :album_title, :year, :allow_free, as: :admin validates :name, presence: true, length: {maximum: 200} validates :plan_code, presence: true, uniqueness: true, length: {maximum: 50 } diff --git a/ruby/lib/jam_ruby/models/jam_track_file.rb b/ruby/lib/jam_ruby/models/jam_track_file.rb index e31a95ba2..c6bf15c56 100644 --- a/ruby/lib/jam_ruby/models/jam_track_file.rb +++ b/ruby/lib/jam_ruby/models/jam_track_file.rb @@ -11,8 +11,6 @@ module JamRuby before_destroy :delete_s3_files - attr_accessible :jam_track_id, :file_type, :filename, as: :admin - attr_accessible :url, :md5, :length, as: :admin attr_accessor :original_audio_s3_path, :skip_uploader, :preview_generate_error diff --git a/ruby/lib/jam_ruby/models/jam_track_hfa_request.rb b/ruby/lib/jam_ruby/models/jam_track_hfa_request.rb index 73bf6de54..6b73b666e 100644 --- a/ruby/lib/jam_ruby/models/jam_track_hfa_request.rb +++ b/ruby/lib/jam_ruby/models/jam_track_hfa_request.rb @@ -5,7 +5,6 @@ module JamRuby @@log = Logging.logger[JamTrackHfaRequest] - attr_accessible :name, as: :admin validates :name, presence: true, length: {maximum: 200} diff --git a/ruby/lib/jam_ruby/models/jam_track_hfa_request_id.rb b/ruby/lib/jam_ruby/models/jam_track_hfa_request_id.rb index 8dab5fb5c..b827da6a4 100644 --- a/ruby/lib/jam_ruby/models/jam_track_hfa_request_id.rb +++ b/ruby/lib/jam_ruby/models/jam_track_hfa_request_id.rb @@ -4,7 +4,6 @@ module JamRuby @@log = Logging.logger[JamTrackHfaRequestId] - attr_accessible :name, as: :admin belongs_to :jam_track, class_name: "JamRuby::JamTrack" belongs_to :jam_track_hfa_request, class_name: "JamRuby::JamTrackHfaRequest" diff --git a/ruby/lib/jam_ruby/models/jam_track_licensor.rb b/ruby/lib/jam_ruby/models/jam_track_licensor.rb index 776418159..9a0ca8e53 100644 --- a/ruby/lib/jam_ruby/models/jam_track_licensor.rb +++ b/ruby/lib/jam_ruby/models/jam_track_licensor.rb @@ -3,9 +3,6 @@ module JamRuby table_name = 'jam_track_licensors' - attr_accessible :name, :description, :attention, :address_line_1, :address_line_2, - :city, :state, :zip_code, :contact, :email, :phone, :slug, as: :admin - validates :name, presence: true, uniqueness: true, length: {maximum: 200} validates :description, length: {maximum: 1000} validates :attention, length: {maximum: 200} diff --git a/ruby/lib/jam_ruby/models/jam_track_right.rb b/ruby/lib/jam_ruby/models/jam_track_right.rb index e02399663..8d8b0fc7a 100644 --- a/ruby/lib/jam_ruby/models/jam_track_right.rb +++ b/ruby/lib/jam_ruby/models/jam_track_right.rb @@ -6,9 +6,6 @@ module JamRuby @@log = Logging.logger[JamTrackRight] - attr_accessible :user, :jam_track, :user_id, :jam_track_id, :download_count - attr_accessible :user_id, :jam_track_id, :can_download, as: :admin - attr_accessible :url_48, :md5_48, :length_48, :url_44, :md5_44, :length_44 belongs_to :user, class_name: "JamRuby::User" # the owner, or purchaser of the jam_track belongs_to :jam_track, class_name: "JamRuby::JamTrack" belongs_to :last_mixdown, class_name: 'JamRuby::JamTrackMixdown', foreign_key: 'last_mixdown_id', inverse_of: :jam_track_right diff --git a/ruby/lib/jam_ruby/models/jam_track_tap_in.rb b/ruby/lib/jam_ruby/models/jam_track_tap_in.rb index fa0e63eda..70ae014f3 100644 --- a/ruby/lib/jam_ruby/models/jam_track_tap_in.rb +++ b/ruby/lib/jam_ruby/models/jam_track_tap_in.rb @@ -1,7 +1,6 @@ module JamRuby class JamTrackTapIn < ActiveRecord::Base - attr_accessible :jam_track_id, :offset_time, :offset_time_raw, :bpm, :tap_in_count, as: :admin validates :offset_time, presence: true, numericality: {only_integer: true}, length: {in: 1..1000} validates :jam_track, presence: true diff --git a/ruby/lib/jam_ruby/models/jam_track_track.rb b/ruby/lib/jam_ruby/models/jam_track_track.rb index 77938d0c3..7a21ce19e 100644 --- a/ruby/lib/jam_ruby/models/jam_track_track.rb +++ b/ruby/lib/jam_ruby/models/jam_track_track.rb @@ -16,8 +16,6 @@ module JamRuby #mount_uploader :url_48, JamTrackTrackUploader #mount_uploader :url_44, JamTrackTrackUploader - attr_accessible :jam_track_id, :track_type, :instrument, :instrument_id, :position, :part, as: :admin - attr_accessible :url_44, :url_48, :md5_44, :md5_48, :length_44, :length_48, :preview_start_time_raw, as: :admin attr_accessor :original_audio_s3_path, :skip_uploader, :preview_generate_error, :wav_file, :tmp_duration, :skip_inst_part_uniq diff --git a/ruby/lib/jam_ruby/models/jamblaster.rb b/ruby/lib/jam_ruby/models/jamblaster.rb index 4ef1e34ae..40f83cf70 100644 --- a/ruby/lib/jam_ruby/models/jamblaster.rb +++ b/ruby/lib/jam_ruby/models/jamblaster.rb @@ -1,7 +1,6 @@ module JamRuby class Jamblaster < ActiveRecord::Base - attr_accessible :user_id, :serial_no, :client_id, :user_ids, as: :admin belongs_to :user, class_name: 'JamRuby::User' diff --git a/ruby/lib/jam_ruby/models/json_store.rb b/ruby/lib/jam_ruby/models/json_store.rb index 08c459cee..9b331ddab 100644 --- a/ruby/lib/jam_ruby/models/json_store.rb +++ b/ruby/lib/jam_ruby/models/json_store.rb @@ -12,7 +12,6 @@ module JamRuby @json = nil end - attr_accessible :user_id belongs_to :user, class_name: "JamRuby::User" diff --git a/ruby/lib/jam_ruby/models/live_stream.rb b/ruby/lib/jam_ruby/models/live_stream.rb index 7ec4d1470..842b883f0 100644 --- a/ruby/lib/jam_ruby/models/live_stream.rb +++ b/ruby/lib/jam_ruby/models/live_stream.rb @@ -1,6 +1,5 @@ class JamRuby::LiveStream < ActiveRecord::Base - attr_accessible :user_id, :band_id, :starts_at, :ends_at, :img_url, :slug, :title, :description, :listed, :allow_in, :white_label_player, :youtube_code, :eventbriteid, :event_type, :social_description, :event_brite_registration_url, as: :admin #belongs_to :user, class_name: 'JamRuby::User' #belongs_to :band, class_name: 'JamRuby::Band' diff --git a/ruby/lib/jam_ruby/models/mix.rb b/ruby/lib/jam_ruby/models/mix.rb index 410df427f..4af550f24 100644 --- a/ruby/lib/jam_ruby/models/mix.rb +++ b/ruby/lib/jam_ruby/models/mix.rb @@ -10,19 +10,18 @@ module JamRuby self.primary_key = 'id' - attr_accessible :ogg_url, :should_retry, as: :admin attr_accessor :is_skip_mount_uploader attr_writer :current_user belongs_to :recording, :class_name => "JamRuby::Recording", :inverse_of => :mixes, :foreign_key => 'recording_id' - validates :download_count, presence: true - validate :verify_download_count + before_destroy :delete_s3_files - skip_callback :save, :before, :store_picture!, if: :is_skip_mount_uploader - - mount_uploader :ogg_url, MixUploader + # skip_callback :save, :before, :store_picture!, if: :is_skip_mount_uploader + def too_many_upload_failures? + upload_failures >= APP_CONFIG.max_track_upload_failures + end def verify_download_count if (self.download_count < 0 || self.download_count > APP_CONFIG.max_audio_downloads) && !@current_user.admin diff --git a/ruby/lib/jam_ruby/models/mobile_recording_upload.rb b/ruby/lib/jam_ruby/models/mobile_recording_upload.rb index 259236b18..7e14b1817 100644 --- a/ruby/lib/jam_ruby/models/mobile_recording_upload.rb +++ b/ruby/lib/jam_ruby/models/mobile_recording_upload.rb @@ -7,7 +7,6 @@ module JamRuby RECORDING_FILE_DIR = "mobile_recording_uploads" - attr_accessible :file_url, :size, :file_name belongs_to :mobile_recording, class_name: "JamRuby::MobileRecording", diff --git a/ruby/lib/jam_ruby/models/music_notation.rb b/ruby/lib/jam_ruby/models/music_notation.rb index 21406b384..ab8bf3a66 100644 --- a/ruby/lib/jam_ruby/models/music_notation.rb +++ b/ruby/lib/jam_ruby/models/music_notation.rb @@ -10,7 +10,6 @@ module JamRuby ATTACHMENT_TYPES = [TYPE_NOTATION, TYPE_AUDIO] self.primary_key = 'id' - attr_accessible :file_url, :size, :file_name belongs_to :user, :class_name => "JamRuby::User", foreign_key: :user_id belongs_to :music_session, :class_name => "JamRuby::MusicSession", foreign_key: :music_session_id diff --git a/ruby/lib/jam_ruby/models/music_session_perf_data.rb b/ruby/lib/jam_ruby/models/music_session_perf_data.rb index accdcb681..71638dfd4 100644 --- a/ruby/lib/jam_ruby/models/music_session_perf_data.rb +++ b/ruby/lib/jam_ruby/models/music_session_perf_data.rb @@ -5,7 +5,6 @@ module JamRuby self.primary_key = 'id' - attr_accessible :uri belongs_to(:music_session, :class_name => "JamRuby::MusicSession", diff --git a/ruby/lib/jam_ruby/models/music_session_user_history.rb b/ruby/lib/jam_ruby/models/music_session_user_history.rb index 66d782f6f..f65922a69 100644 --- a/ruby/lib/jam_ruby/models/music_session_user_history.rb +++ b/ruby/lib/jam_ruby/models/music_session_user_history.rb @@ -7,7 +7,6 @@ module JamRuby default_scope { order('user_id ASC') } - attr_accessible :max_concurrent_connections, :session_removed_at, :rating validates_inclusion_of :rating, :in => -1..1, :allow_nil => true belongs_to :user, :class_name => "JamRuby::User", :foreign_key => :user_id, :inverse_of => :music_session_user_histories diff --git a/ruby/lib/jam_ruby/models/news.rb b/ruby/lib/jam_ruby/models/news.rb index 0d126ad38..2658f4e3e 100644 --- a/ruby/lib/jam_ruby/models/news.rb +++ b/ruby/lib/jam_ruby/models/news.rb @@ -4,7 +4,6 @@ module JamRuby self.table_name = 'news' - attr_accessible :title, :body, :position, as: :admin default_scope { order('position') } validates :title, presence: true validates :body, presence: true diff --git a/ruby/lib/jam_ruby/models/online_presence.rb b/ruby/lib/jam_ruby/models/online_presence.rb index ed4f498bd..174eb3fd4 100644 --- a/ruby/lib/jam_ruby/models/online_presence.rb +++ b/ruby/lib/jam_ruby/models/online_presence.rb @@ -3,7 +3,6 @@ module JamRuby PERMISSION_MSG = "You do not have permission to perform this operation." - attr_accessible :player_id, :service_type, :username belongs_to :player, polymorphic: true validates :service_type, presence:true, length: {maximum: 100} diff --git a/ruby/lib/jam_ruby/models/performance_sample.rb b/ruby/lib/jam_ruby/models/performance_sample.rb index 38ed618bb..11844cdd4 100644 --- a/ruby/lib/jam_ruby/models/performance_sample.rb +++ b/ruby/lib/jam_ruby/models/performance_sample.rb @@ -3,7 +3,6 @@ module JamRuby PERMISSION_MSG = "You do not have permission to perform this operation." - attr_accessible :player_id, :service_type, :claimed_recording_id, :service_id, :url, :description belongs_to :player, polymorphic: true belongs_to :claimed_recording, :class_name => "JamRuby::ClaimedRecording", :foreign_key => "claimed_recording_id" diff --git a/ruby/lib/jam_ruby/models/posa_card_purchase.rb b/ruby/lib/jam_ruby/models/posa_card_purchase.rb index 4a5356188..6a4d186ff 100644 --- a/ruby/lib/jam_ruby/models/posa_card_purchase.rb +++ b/ruby/lib/jam_ruby/models/posa_card_purchase.rb @@ -4,7 +4,6 @@ module JamRuby @@log = Logging.logger[PosaCardPurchase] - attr_accessible :user, :posa_card_type def name posa_card_type.sale_display diff --git a/ruby/lib/jam_ruby/models/promotional.rb b/ruby/lib/jam_ruby/models/promotional.rb index bb17e45d9..c66bbe5c6 100644 --- a/ruby/lib/jam_ruby/models/promotional.rb +++ b/ruby/lib/jam_ruby/models/promotional.rb @@ -3,7 +3,6 @@ class JamRuby::Promotional < ActiveRecord::Base default_scope { order('aasm_state ASC, position ASC, updated_at DESC') } - attr_accessible :position, :aasm_state include AASM HIDDEN_STATE = :hidden @@ -45,7 +44,6 @@ class JamRuby::Promotional < ActiveRecord::Base end class JamRuby::PromoBuzz < JamRuby::Promotional - attr_accessible :image, :text_short, :text_long, :position, :aasm_state, :key def self.create_with_params(params) obj = self.new @@ -81,7 +79,6 @@ end class JamRuby::PromoLatest < JamRuby::Promotional belongs_to :latest, :polymorphic => true - attr_accessible :latest def music_session self.latest if self.latest.is_a? MusicSession diff --git a/ruby/lib/jam_ruby/models/quick_mix.rb b/ruby/lib/jam_ruby/models/quick_mix.rb index 09098cad2..968ffef42 100644 --- a/ruby/lib/jam_ruby/models/quick_mix.rb +++ b/ruby/lib/jam_ruby/models/quick_mix.rb @@ -4,7 +4,6 @@ module JamRuby MAX_MIX_TIME = 7200 # 2 hours - attr_accessible :ogg_url, :should_retry, as: :admin attr_accessor :marking_complete, :is_skip_mount_uploader attr_writer :current_user @@ -20,7 +19,7 @@ module JamRuby before_destroy :delete_s3_files - skip_callback :save, :before, :store_picture!, if: :is_skip_mount_uploader + # skip_callback :save, :before, :store_picture!, if: :is_skip_mount_uploader def too_many_upload_failures? upload_failures >= APP_CONFIG.max_track_upload_failures diff --git a/ruby/lib/jam_ruby/models/recorded_track.rb b/ruby/lib/jam_ruby/models/recorded_track.rb index 7370de36c..5eac4e362 100644 --- a/ruby/lib/jam_ruby/models/recorded_track.rb +++ b/ruby/lib/jam_ruby/models/recorded_track.rb @@ -15,7 +15,6 @@ module JamRuby attr_accessor :marking_complete attr_writer :is_skip_mount_uploader - attr_accessible :discard, :user, :user_id, :instrument_id, :sound, :client_id, :track_id, :client_track_id, :url, as: :admin attr_writer :current_user @@ -44,7 +43,7 @@ module JamRuby validate :verify_download_count before_save :sanitize_active_admin - skip_callback :save, :before, :store_picture!, if: :is_skip_mount_uploader? + # skip_callback :save, :before, :store_url!, if: :is_skip_mount_uploader? before_validation do # this should be an activeadmin only path, because it's using the mount_uploader (whereas the client does something completely different) diff --git a/ruby/lib/jam_ruby/models/recording.rb b/ruby/lib/jam_ruby/models/recording.rb index 7a29f29a0..20dda6ecd 100644 --- a/ruby/lib/jam_ruby/models/recording.rb +++ b/ruby/lib/jam_ruby/models/recording.rb @@ -3,7 +3,6 @@ module JamRuby @@log = Logging.logger[Recording] - attr_accessible :owner, :owner_id, :band, :band_id, :recorded_tracks_attributes, :mixes_attributes, :claimed_recordings_attributes, :name, :description, :genre, :is_public, :duration, :jam_track_id, as: :admin has_many :users, :through => :recorded_tracks, :class_name => "JamRuby::User" has_many :claimed_recordings, :class_name => "JamRuby::ClaimedRecording", :inverse_of => :recording, :foreign_key => 'recording_id', :dependent => :destroy diff --git a/ruby/lib/jam_ruby/models/recurly_transaction_web_hook.rb b/ruby/lib/jam_ruby/models/recurly_transaction_web_hook.rb index ca1bd4cb7..334ed5972 100644 --- a/ruby/lib/jam_ruby/models/recurly_transaction_web_hook.rb +++ b/ruby/lib/jam_ruby/models/recurly_transaction_web_hook.rb @@ -1,7 +1,6 @@ module JamRuby class RecurlyTransactionWebHook < ActiveRecord::Base - attr_accessible :admin_description, :jam_track_id, as: :admin belongs_to :user, class_name: 'JamRuby::User' belongs_to :sale_line_item, class_name: 'JamRuby::SaleLineItem', foreign_key: 'subscription_id', primary_key: 'recurly_subscription_uuid', inverse_of: :recurly_transactions diff --git a/ruby/lib/jam_ruby/models/retailer.rb b/ruby/lib/jam_ruby/models/retailer.rb index 3ad3abe2f..5346969f5 100644 --- a/ruby/lib/jam_ruby/models/retailer.rb +++ b/ruby/lib/jam_ruby/models/retailer.rb @@ -7,10 +7,9 @@ module JamRuby html_sanitize strict: [:name] attr_accessor :updating_avatar, :password, :should_validate_password - attr_accessible :original_fpfile, :cropped_fpfile, :cropped_large_fpfile, :cropped_s3_path, :cropped_large_s3_path, :photo_url, :large_photo_url, :crop_selection belongs_to :posa_cards, class_name: 'JamRuby::PosaCard' - belongs_to :user, class_name: ::JamRuby::User, inverse_of: :owned_retailer + belongs_to :user, class_name: "JamRuby::User", inverse_of: :owned_retailer belongs_to :affiliate_partner, class_name: "JamRuby::AffiliatePartner" has_many :teachers, class_name: "JamRuby::Teacher" has_many :retailer_invitations, class_name: 'JamRuby::RetailerInvitation' diff --git a/ruby/lib/jam_ruby/models/retailer_invitation.rb b/ruby/lib/jam_ruby/models/retailer_invitation.rb index dad1f18f2..4dd3d912d 100644 --- a/ruby/lib/jam_ruby/models/retailer_invitation.rb +++ b/ruby/lib/jam_ruby/models/retailer_invitation.rb @@ -5,8 +5,8 @@ module JamRuby html_sanitize strict: [:note] - belongs_to :user, class_name: ::JamRuby::User - belongs_to :retailer, class_name: ::JamRuby::Retailer + belongs_to :user, class_name: "JamRuby::User" + belongs_to :retailer, class_name: "JamRuby::Retailer" validates :retailer, presence: true validates :email, email: true diff --git a/ruby/lib/jam_ruby/models/review.rb b/ruby/lib/jam_ruby/models/review.rb index 7e7e8bd6d..8b3190a70 100644 --- a/ruby/lib/jam_ruby/models/review.rb +++ b/ruby/lib/jam_ruby/models/review.rb @@ -3,7 +3,6 @@ module JamRuby include HtmlSanitize html_sanitize strict: [:description] - attr_accessible :target, :rating, :description, :user, :user_id, :target_id, :target_type belongs_to :target, polymorphic: true belongs_to :user, foreign_key: 'user_id', class_name: "JamRuby::User" belongs_to :deleted_by_user, foreign_key: 'deleted_by_user_id', class_name: "JamRuby::User" diff --git a/ruby/lib/jam_ruby/models/review_summary.rb b/ruby/lib/jam_ruby/models/review_summary.rb index b0aef4711..43d06ddb8 100644 --- a/ruby/lib/jam_ruby/models/review_summary.rb +++ b/ruby/lib/jam_ruby/models/review_summary.rb @@ -1,6 +1,5 @@ module JamRuby class ReviewSummary < ActiveRecord::Base - attr_accessible :target, :target_id, :target_type, :avg_rating, :wilson_score, :review_count belongs_to :target, polymorphic: true validates :avg_rating, presence:true, numericality: true diff --git a/ruby/lib/jam_ruby/models/school.rb b/ruby/lib/jam_ruby/models/school.rb index 86b5b9e2c..57db8bdf1 100644 --- a/ruby/lib/jam_ruby/models/school.rb +++ b/ruby/lib/jam_ruby/models/school.rb @@ -13,9 +13,8 @@ module JamRuby SCHEDULING_COMMS = [ SCHEDULING_COMM_SCHOOL, SCHEDULING_COMM_TEACHER ] attr_accessor :updating_avatar - attr_accessible :original_fpfile, :cropped_fpfile, :cropped_large_fpfile, :cropped_s3_path, :cropped_large_s3_path, :photo_url, :large_photo_url, :crop_selection - belongs_to :user, class_name: ::JamRuby::User, inverse_of: :owned_school + belongs_to :user, class_name: "JamRuby::User", inverse_of: :owned_school belongs_to :affiliate_partner, class_name: "JamRuby::AffiliatePartner" has_many :students, class_name: "JamRuby::User" has_many :teachers, class_name: "JamRuby::Teacher" diff --git a/ruby/lib/jam_ruby/models/school_invitation.rb b/ruby/lib/jam_ruby/models/school_invitation.rb index b243cdb8f..5143ca572 100644 --- a/ruby/lib/jam_ruby/models/school_invitation.rb +++ b/ruby/lib/jam_ruby/models/school_invitation.rb @@ -5,8 +5,8 @@ module JamRuby html_sanitize strict: [:note] - belongs_to :user, class_name: ::JamRuby::User - belongs_to :school, class_name: ::JamRuby::School + belongs_to :user, class_name: "JamRuby::User" + belongs_to :school, class_name: "JamRuby::School" validates :school, presence: true validates :email, email: true diff --git a/ruby/lib/jam_ruby/models/score.rb b/ruby/lib/jam_ruby/models/score.rb index 96a0c6b4c..2c4319060 100644 --- a/ruby/lib/jam_ruby/models/score.rb +++ b/ruby/lib/jam_ruby/models/score.rb @@ -7,7 +7,6 @@ module JamRuby self.table_name = 'scores' - attr_accessible :alocidispid, :anodeid, :aaddr, :auserid, :alatencytestid, :blocidispid, :bnodeid, :baddr, :buserid, :blatencytestid, :score, :score_dt, :scorer, :scoring_data default_scope { order('score_dt desc') } diff --git a/ruby/lib/jam_ruby/models/shopping_cart.rb b/ruby/lib/jam_ruby/models/shopping_cart.rb index 035e4f559..976ef4bd9 100644 --- a/ruby/lib/jam_ruby/models/shopping_cart.rb +++ b/ruby/lib/jam_ruby/models/shopping_cart.rb @@ -15,7 +15,6 @@ module JamRuby JAMTRACK_DOWNLOAD = 'download' JAMTRACK_VARIANTS = ['full', 'stream', 'download'] - attr_accessible :quantity, :cart_type, :product_info attr_accessor :skip_mix_check diff --git a/ruby/lib/jam_ruby/models/teacher.rb b/ruby/lib/jam_ruby/models/teacher.rb index 648a9c079..9c8007420 100644 --- a/ruby/lib/jam_ruby/models/teacher.rb +++ b/ruby/lib/jam_ruby/models/teacher.rb @@ -3,7 +3,6 @@ module JamRuby include HtmlSanitize html_sanitize strict: [:biography, :website] attr_accessor :validate_introduction, :validate_basics, :validate_pricing - attr_accessible :genres, :teacher_experiences, :experiences_teaching, :experiences_education, :experiences_award has_many :genres, :class_name => "JamRuby::Genre", :through => :teachers_genres # , :order => "description" has_many :teachers_genres, :class_name => "JamRuby::TeacherGenre" has_many :instruments, :class_name => "JamRuby::Instrument", through: :teachers_instruments # , :order => "description" diff --git a/ruby/lib/jam_ruby/models/teacher_experience.rb b/ruby/lib/jam_ruby/models/teacher_experience.rb index 7289daa3b..94d868096 100644 --- a/ruby/lib/jam_ruby/models/teacher_experience.rb +++ b/ruby/lib/jam_ruby/models/teacher_experience.rb @@ -3,7 +3,6 @@ module JamRuby include HtmlSanitize html_sanitize strict: [:name, :organization] belongs_to :teacher, :class_name => "JamRuby::Teacher" - attr_accessible :name, :experience_type, :organization, :start_year, :end_year scope :teaching, -> { where(experience_type: 'teaching')} scope :education, -> { where(experience_type: 'education') } diff --git a/ruby/lib/jam_ruby/models/teacher_intent.rb b/ruby/lib/jam_ruby/models/teacher_intent.rb index 333cf5afe..cf796fa81 100644 --- a/ruby/lib/jam_ruby/models/teacher_intent.rb +++ b/ruby/lib/jam_ruby/models/teacher_intent.rb @@ -1,8 +1,8 @@ module JamRuby class TeacherIntent < ActiveRecord::Base - belongs_to :user, class_name: ::JamRuby::User - belongs_to :teacher, class_name: ::JamRuby::Teacher + belongs_to :user, class_name: "JamRuby::User" + belongs_to :teacher, class_name: "JamRuby::Teacher" validates :user, presence: true validates :teacher, presence: true diff --git a/ruby/lib/jam_ruby/models/test_drive_package.rb b/ruby/lib/jam_ruby/models/test_drive_package.rb index 850ca6057..b75c5f530 100644 --- a/ruby/lib/jam_ruby/models/test_drive_package.rb +++ b/ruby/lib/jam_ruby/models/test_drive_package.rb @@ -4,7 +4,6 @@ module JamRuby @@log = Logging.logger[TestDrivePackage] - attr_accessible :name, :description, :package_type, :test_drive_package_teachers_attributes, :test_drive_package_teachers, as: :admin has_many :test_drive_package_teachers, class_name: "JamRuby::TestDrivePackageTeacher" diff --git a/ruby/lib/jam_ruby/models/test_drive_package_teacher.rb b/ruby/lib/jam_ruby/models/test_drive_package_teacher.rb index 2b0208189..56fa4886b 100644 --- a/ruby/lib/jam_ruby/models/test_drive_package_teacher.rb +++ b/ruby/lib/jam_ruby/models/test_drive_package_teacher.rb @@ -5,7 +5,6 @@ module JamRuby @@log = Logging.logger[TestDrivePackageTeacher] attr_writer :short_bio_temp - attr_accessible :user_id, :test_drive_package_id, :short_bio, :short_bio_temp, as: :admin belongs_to :test_drive_package, class_name: "JamRuby::TestDrivePackage" belongs_to :user, class_name: "JamRuby::User" diff --git a/ruby/lib/jam_ruby/models/text_message.rb b/ruby/lib/jam_ruby/models/text_message.rb index 6b4096eea..59e4a947d 100644 --- a/ruby/lib/jam_ruby/models/text_message.rb +++ b/ruby/lib/jam_ruby/models/text_message.rb @@ -7,7 +7,6 @@ module JamRuby default_scope { order('created_at DESC') } - attr_accessible :target_user_id, :source_user_id, :message belongs_to :target_user, :class_name => "JamRuby::User", :foreign_key => "target_user_id" belongs_to :source_user, :class_name => "JamRuby::User", :foreign_key => "source_user_id" diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index d7a3f74b8..51f5c6dcf 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -75,9 +75,6 @@ module JamRuby after_save :update_teacher_pct - attr_accessible :first_name, :last_name, :email, :city, :password, :password_confirmation, :state, :country, :birth_date, :subscribe_email, :terms_of_service, :original_fpfile, :cropped_fpfile, :cropped_large_fpfile, :cropped_s3_path, :cropped_large_s3_path, :photo_url, :large_photo_url, :crop_selection, :used_current_month, :used_month_play_time, - :v2_photo_url, :v2_photo_uploaded - # updating_password corresponds to a lost_password attr_accessor :test_drive_packaging, :validate_instruments, :updating_password, :updating_email, :updated_email, :update_email_confirmation_url, :administratively_created, :current_password, :setting_password, :confirm_current_password, :updating_avatar, :updating_progression_field, :mods_json, :expecting_gift_card, :purchase_required, :user_type belongs_to :icecast_server_group, class_name: "JamRuby::IcecastServerGroup", inverse_of: :users, foreign_key: 'icecast_server_group_id' diff --git a/ruby/lib/jam_ruby/models/user_authorization.rb b/ruby/lib/jam_ruby/models/user_authorization.rb index 28853954b..bd362ea79 100644 --- a/ruby/lib/jam_ruby/models/user_authorization.rb +++ b/ruby/lib/jam_ruby/models/user_authorization.rb @@ -1,7 +1,6 @@ module JamRuby class UserAuthorization < ActiveRecord::Base - attr_accessible :provider, :uid, :token, :token_expiration, :secret, :user, :refresh_token self.table_name = "user_authorizations" diff --git a/ruby/lib/jam_ruby/models/user_blacklist.rb b/ruby/lib/jam_ruby/models/user_blacklist.rb index f9285e627..b1852a718 100644 --- a/ruby/lib/jam_ruby/models/user_blacklist.rb +++ b/ruby/lib/jam_ruby/models/user_blacklist.rb @@ -1,7 +1,6 @@ module JamRuby class UserBlacklist < ActiveRecord::Base - attr_accessible :user_id, :notes, as: :admin @@log = Logging.logger[UserBlacklist] belongs_to :user, :class_name => "JamRuby::User" diff --git a/ruby/lib/jam_ruby/models/user_match_email_sending.rb b/ruby/lib/jam_ruby/models/user_match_email_sending.rb index c25a7bf32..09f01162a 100644 --- a/ruby/lib/jam_ruby/models/user_match_email_sending.rb +++ b/ruby/lib/jam_ruby/models/user_match_email_sending.rb @@ -1,7 +1,7 @@ module JamRuby class UserMatchEmailSending < ActiveRecord::Base - serialize :sent_user_ids, Array + serialize :sent_user_ids, type: Array, coder: YAML def sent_user_ids=(ids) ids = ids.split(',') if ids.is_a?(String) diff --git a/ruby/lib/jam_ruby/models/user_whitelist.rb b/ruby/lib/jam_ruby/models/user_whitelist.rb index 7ed8183f6..4b4a99fcc 100644 --- a/ruby/lib/jam_ruby/models/user_whitelist.rb +++ b/ruby/lib/jam_ruby/models/user_whitelist.rb @@ -1,7 +1,6 @@ module JamRuby class UserWhitelist < ActiveRecord::Base - attr_accessible :user_id, :notes, as: :admin @@log = Logging.logger[UserWhitelist] belongs_to :user, :class_name => "JamRuby::User" diff --git a/ruby/lib/jam_ruby/tasks/db/migrate.rake b/ruby/lib/jam_ruby/tasks/db/migrate.rake index e92cd1c34..8ecfb1943 100644 --- a/ruby/lib/jam_ruby/tasks/db/migrate.rake +++ b/ruby/lib/jam_ruby/tasks/db/migrate.rake @@ -27,7 +27,7 @@ namespace :db do ActiveRecord::Base.establish_connection(db_config) migrate_dir = JamRuby::RakeUtil.migrations_path - ActiveRecord::Migrator.migrate(migrate_dir, version) + ActiveRecord::MigrationContext.new(migrate_dir).migrate(version) puts "#{ENV['RAILS_ENV']} database migrated." end @@ -36,7 +36,7 @@ namespace :db do steps = (ARGV[1] || "1").to_i ActiveRecord::Base.establish_connection(db_config) migrate_dir = JamRuby::RakeUtil.migrations_path - ActiveRecord::Migrator.rollback(migrate_dir, steps) + ActiveRecord::MigrationContext.new(migrate_dir).rollback(steps) puts "#{ENV['RAILS_ENV']} database migrated." end diff --git a/ruby/lib/jam_ruby/test_support.rb b/ruby/lib/jam_ruby/test_support.rb index 7fe5e8a26..913fcce54 100644 --- a/ruby/lib/jam_ruby/test_support.rb +++ b/ruby/lib/jam_ruby/test_support.rb @@ -7,7 +7,7 @@ module JamRuby #drop create and execute db migrations def self.recreate_database ENV['RAILS_ENV'] = 'test' - Rake.application.init + Rake.application.init('rake', []) Rake.application.load_rakefile begin Rake::Task['db:jam_ruby:drop'].invoke diff --git a/ruby/spec/factories.rb b/ruby/spec/factories.rb index 6673056b8..a7492b4b6 100644 --- a/ruby/spec/factories.rb +++ b/ruby/spec/factories.rb @@ -1,103 +1,103 @@ require 'faker' -FactoryGirl.define do +FactoryBot.define do factory :user, :class => JamRuby::User do transient do - specific_instruments nil + specific_instruments { nil } end 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 - city "Apex" - state "NC" - country "US" - musician true - terms_of_service true - last_jam_audio_latency 5 - reuse_card true - has_redeemable_jamtrack true - gifted_jamtracks 0 - remaining_free_lessons 1 - remaining_test_drives 0 - stored_credit_card false + password { "foobar" } + password_confirmation { "foobar" } + email_confirmed { true } + city { "Apex" } + state { "NC" } + country { "US" } + musician { true } + terms_of_service { true } + last_jam_audio_latency { 5 } + reuse_card { true } + has_redeemable_jamtrack { true } + gifted_jamtracks { 0 } + remaining_free_lessons { 1 } + remaining_test_drives { 0 } + stored_credit_card { false } #u.association :musician_instrument, factory: :musician_instrument, user: u before(:create) do |user, evaluator| if evaluator.specific_instruments evaluator.specific_instruments.each do |instrument| - user.musician_instruments << FactoryGirl.build(:musician_instrument, player: user, instrument: instrument) + user.musician_instruments << FactoryBot.build(:musician_instrument, player: user, instrument: instrument) end else - user.musician_instruments << FactoryGirl.build(:musician_instrument, player: user) + user.musician_instruments << FactoryBot.build(:musician_instrument, player: user) end end factory :fan do - musician false + musician { false } end factory :admin do - admin true + admin { true } end factory :austin_user do - first_name 'Austin' + first_name { 'Austin' } sequence(:last_name) { |n| "#{n}" } - state 'TX' - city 'Austin' + state { 'TX' } + city { 'Austin' } last_jam_locidispid { austin_geoip[:locidispid] } last_jam_addr { austin_ip } end factory :dallas_user do - first_name 'Dallas' + first_name { 'Dallas' } sequence(:last_name) { |n| "#{n}" } - state 'TX' - city 'Dallas' + state { 'TX' } + city { 'Dallas' } last_jam_locidispid { dallas_geoip[:locidispid] } last_jam_addr { dallas_ip } end factory :houston_user do - first_name 'Houston' + first_name { 'Houston' } sequence(:last_name) { |n| "#{n}" } - state 'TX' - city 'Houston' + state { 'TX' } + city { 'Houston' } last_jam_locidispid { houston_geoip[:locidispid] } last_jam_addr { houston_ip } end factory :miami_user do - first_name 'Miami' + first_name { 'Miami' } sequence(:last_name) { |n| "#{n}" } - state 'FL' - city 'Miami' + state { 'FL' } + city { 'Miami' } last_jam_locidispid { miami_geoip[:locidispid] } last_jam_addr { miami_ip } end factory :seattle_user do - first_name 'Seattle' + first_name { 'Seattle' } sequence(:last_name) { |n| "#{n}" } - state 'WA' - city 'Seattle' + state { 'WA' } + city { 'Seattle' } last_jam_locidispid { seattle_geoip[:locidispid] } last_jam_addr { seattle_ip } end factory :single_user_session do after(:create) do |user, evaluator| - active_music_session = FactoryGirl.create(:active_music_session, :creator => user) - connection = FactoryGirl.create(:connection, :user => user, :music_session => active_music_session) + active_music_session = FactoryBot.create(:active_music_session, :creator => user) + connection = FactoryBot.create(:connection, :user => user, :music_session => active_music_session) end end factory :teacher_user do after(:create) do |user, evaluator| - teacher = FactoryGirl.create(:teacher, user: user, price_per_lesson_60_cents: 3000, price_per_month_60_cents: 3000) + teacher = FactoryBot.create(:teacher, user: user, price_per_lesson_60_cents: 3000, price_per_month_60_cents: 3000) user.is_a_teacher = true user.save! end @@ -106,15 +106,15 @@ FactoryGirl.define do factory :teacher, :class => JamRuby::Teacher do association :user, factory: :user - price_per_lesson_60_cents 3000 - price_per_month_60_cents 3000 - short_bio 'abc def uueue doc neck' + price_per_lesson_60_cents { 3000 } + price_per_month_60_cents { 3000 } + short_bio { 'abc def uueue doc neck' } end factory :musician_instrument, :class => JamRuby::MusicianInstrument do instrument { JamRuby::Instrument.find('electric guitar') } - proficiency_level 1 - priority 0 + proficiency_level { 1 } + priority { 0 } end @@ -123,16 +123,16 @@ 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 - language 'eng' + 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 } + language { 'eng' } end @@ -140,7 +140,7 @@ FactoryGirl.define do if evaluator.music_session session.id = evaluator.music_session.id else - 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, language: evaluator.language) session.id = music_session.id @@ -149,7 +149,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 :active_music_session_with_mount do @@ -160,41 +160,41 @@ FactoryGirl.define do factory :music_session, :class => JamRuby::MusicSession do ignore do - student nil + student { nil } end 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' - timezone 'UTC,Etc/UTC' - legal_policy 'standard' - recurring_mode 'once' - genre JamRuby::Genre.first + fan_chat { true } + fan_access { true } + approval_required { false } + musician_access { true } + legal_terms { true } + language { 'eng' } + timezone { 'UTC,Etc/UTC' } + legal_policy { 'standard' } + recurring_mode { 'once' } + genre { JamRuby::Genre.first } association :creator, :factory => :user - open_rsvps true - scheduled_start Time.now - scheduled_duration 3600 + open_rsvps { true } + scheduled_start { Time.now } + scheduled_duration { 3600 } factory :recurring_music_session_weekly do - recurring_mode 'weekly' + recurring_mode { 'weekly' } end after(:create) do |music_session| - FactoryGirl.create(:chosen_rsvp_slot, user: music_session.creator, music_session: music_session) + FactoryBot.create(:chosen_rsvp_slot, user: music_session.creator, music_session: music_session) end end factory :music_session_user_history, :class => JamRuby::MusicSessionUserHistory do transient do - history nil - user nil + history { nil } + user { nil } end - instruments 'guitar' + instruments { 'guitar' } music_session_id { history.id } user_id { user.id } sequence(:client_id) { |n| "Connection #{n}" } @@ -202,16 +202,16 @@ FactoryGirl.define do 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' + ip_address { "1.1.1.1" } + as_musician { true } + addr { 0 } + locidispid { 0 } + client_type { 'client' } + gateway { 'gateway1' } last_jam_audio_latency { user.last_jam_audio_latency if user } sequence(:channel_id) { |n| "Channel#{n}" } association :user, factory: :user - scoring_timeout Time.now + scoring_timeout { Time.now } end factory :invitation, :class => JamRuby::Invitation do @@ -232,10 +232,10 @@ FactoryGirl.define do factory :band, :class => JamRuby::Band do sequence(:name) { |n| "Band" } - biography "My Biography" - city "Apex" - state "NC" - country "US" + biography { "My Biography" } + city { "Apex" } + state { "NC" } + country { "US" } before(:create) { |band| band.genres << Genre.first } @@ -256,34 +256,34 @@ FactoryGirl.define do end factory :join_request, :class => JamRuby::JoinRequest do - text 'let me in to the session!' + text { 'let me in to the session!' } end factory :track, :class => JamRuby::Track do - sound "mono" + sound { "mono" } sequence(:client_track_id) { |n| "client_track_id#{n}" } sequence(:client_resource_id) { |n| "resource_id#{n}" } end factory :backing_track, :class => JamRuby::BackingTrack do sequence(:client_track_id) { |n| "client_track_id#{n}" } - filename 'foo.mp3' + filename { 'foo.mp3' } end factory :video_source, :class => JamRuby::VideoSource do - #client_video_source_id "test_source_id" + #client_video_source_id { "test_source_id" } sequence(:client_video_source_id) { |n| "client_video_source_id#{n}" } end factory :recorded_track, :class => JamRuby::RecordedTrack do - instrument JamRuby::Instrument.find('acoustic guitar') - sound 'stereo' + instrument { JamRuby::Instrument.find('acoustic guitar') } + 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 @@ -294,17 +294,17 @@ FactoryGirl.define do sequence(:client_track_id) { |n| "client_track_id-#{n}" } sequence(:filename) { |n| "filename-{#n}" } sequence(:url) { |n| "/recordings/blah/#{n}" } - md5 'abc' - length 1 - fully_uploaded true + md5 { 'abc' } + length { 1 } + fully_uploaded { true } association :user, factory: :user association :recording, factory: :recording end factory :recorded_video, :class => JamRuby::RecordedVideo do sequence(:client_video_source_id) { |n| "client_video_source_id-#{n}" } - fully_uploaded true - length 1 + fully_uploaded { true } + length { 1 } association :user, factory: :user association :recording, factory: :recording end @@ -327,7 +327,7 @@ FactoryGirl.define do factory :recording_with_track do before(:create) { |recording| - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: recording.owner) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: recording.owner) } end end @@ -335,12 +335,12 @@ 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, evaluator| - claimed_recording.recording = FactoryGirl.create(:recording_with_track, owner: claimed_recording.user) unless evaluator.recording + claimed_recording.recording = FactoryBot.create(:recording_with_track, owner: claimed_recording.user) unless evaluator.recording } @@ -348,67 +348,67 @@ FactoryGirl.define do factory :mix, :class => JamRuby::Mix do transient do - autowire true + autowire { true } end - 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, evaluator| if evaluator.autowire - 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 } end factory :quick_mix, :class => JamRuby::QuickMix do transient do - autowire true + autowire { true } end - started_at nil - completed_at nil - ogg_md5 nil - ogg_length 0 - ogg_url nil - mp3_md5 nil - mp3_length 0 - mp3_url nil - completed false + started_at { nil } + completed_at { nil } + ogg_md5 { nil } + ogg_length { 0 } + ogg_url { nil } + mp3_md5 { nil } + mp3_length { 0 } + mp3_url { nil } + completed { false } before(:create) { |mix, evaluator| if evaluator.autowire - user = FactoryGirl.create(:user) + user = FactoryBot.create(:user) mix.user = user - mix.recording = FactoryGirl.create(:recording_with_track, owner: user) - mix.recording.claimed_recordings << FactoryGirl.create(:claimed_recording, user: user, recording: mix.recording) + mix.recording = FactoryBot.create(:recording_with_track, owner: user) + mix.recording.claimed_recordings << FactoryBot.create(:claimed_recording, user: user, recording: mix.recording) end } factory :quick_mix_completed do - started_at 1.minute.ago - completed_at Time.now - ogg_md5 'a' - ogg_length 1 - ogg_url 'recordings/ogg' - mp3_md5 'a' - mp3_length 1 - mp3_url 'recordings/mp3' - completed true + started_at { 1.minute.ago } + completed_at { Time.now } + ogg_md5 { 'a' } + ogg_length { 1 } + ogg_url { 'recordings/ogg' } + mp3_md5 { 'a' } + mp3_length { 1 } + mp3_url { 'recordings/mp3' } + completed { true } end end factory :invited_user, :class => JamRuby::InvitedUser do sequence(:email) { |n| "user#{n}@someservice.com" } - autofriend false + autofriend { false } end factory :music_session_perf_data, :class => JamRuby::MusicSessionPerfData do @@ -420,77 +420,77 @@ FactoryGirl.define do factory :promo_buzz, :class => JamRuby::PromoBuzz do - text_short Faker::Lorem.characters(10) - text_long Faker::Lorem.paragraphs(3).join("\n") + text_short { Faker::Lorem.characters(number: 10) } + text_long { Faker::Lorem.paragraphs(3).join("\n") } end factory :icecast_limit, :class => JamRuby::IcecastLimit do - clients 5 - sources 1 - queue_size 102400 - client_timeout 30 - header_timeout 15 - source_timeout 10 - burst_size 65536 + clients { 5 } + sources { 1 } + queue_size { 102400 } + client_timeout { 30 } + header_timeout { 15 } + source_timeout { 10 } + burst_size { 65536 } end factory :icecast_admin_authentication, :class => JamRuby::IcecastAdminAuthentication do - source_pass Faker::Lorem.characters(10) - admin_user Faker::Lorem.characters(10) - admin_pass Faker::Lorem.characters(10) - relay_user Faker::Lorem.characters(10) - relay_pass Faker::Lorem.characters(10) + source_pass { Faker::Lorem.characters(number: 10) } + admin_user { Faker::Lorem.characters(number: 10) } + admin_pass { Faker::Lorem.characters(number: 10) } + relay_user { Faker::Lorem.characters(number: 10) } + relay_pass { Faker::Lorem.characters(number: 10) } end factory :icecast_directory, :class => JamRuby::IcecastDirectory do - yp_url_timeout 15 - yp_url Faker::Lorem.characters(10) + yp_url_timeout { 15 } + yp_url { Faker::Lorem.characters(number: 10) } end factory :icecast_master_server_relay, :class => JamRuby::IcecastMasterServerRelay do - master_server Faker::Lorem.characters(10) - master_server_port 8000 - master_update_interval 120 - master_username Faker::Lorem.characters(10) - master_pass Faker::Lorem.characters(10) - relays_on_demand 1 + master_server { Faker::Lorem.characters(number: 10) } + master_server_port { 8000 } + master_update_interval { 120 } + master_username { Faker::Lorem.characters(number: 10) } + master_pass { Faker::Lorem.characters(number: 10) } + relays_on_demand { 1 } end factory :icecast_path, :class => JamRuby::IcecastPath do - base_dir Faker::Lorem.characters(10) - log_dir Faker::Lorem.characters(10) - pid_file Faker::Lorem.characters(10) - web_root Faker::Lorem.characters(10) - admin_root Faker::Lorem.characters(10) + base_dir { Faker::Lorem.characters(number: 10) } + log_dir { Faker::Lorem.characters(number: 10) } + pid_file { Faker::Lorem.characters(number: 10) } + web_root { Faker::Lorem.characters(number: 10) } + admin_root { Faker::Lorem.characters(number: 10) } end factory :icecast_logging, :class => JamRuby::IcecastLogging do - access_log Faker::Lorem.characters(10) - error_log Faker::Lorem.characters(10) - log_level 3 - log_archive nil - log_size 10000 + access_log { Faker::Lorem.characters(number: 10) } + error_log { Faker::Lorem.characters(number: 10) } + log_level { 3 } + log_archive { nil } + log_size { 10000 } end factory :icecast_security, :class => JamRuby::IcecastSecurity do - chroot 0 + chroot { 0 } end factory :icecast_mount, :class => JamRuby::IcecastMount do sequence(:name) { |n| "/mount_#{n}" } - source_username Faker::Lorem.characters(10) - source_pass Faker::Lorem.characters(10) - max_listeners 100 - max_listener_duration 3600 - fallback_mount Faker::Lorem.characters(10) - fallback_override 1 - fallback_when_full 1 - is_public -1 - stream_name Faker::Lorem.characters(10) - stream_description Faker::Lorem.characters(10) - stream_url Faker::Lorem.characters(10) - genre Faker::Lorem.characters(10) - hidden 0 + source_username { Faker::Lorem.characters(number: 10) } + source_pass { Faker::Lorem.characters(number: 10) } + max_listeners { 100 } + max_listener_duration { 3600 } + fallback_mount { Faker::Lorem.characters(number: 10) } + fallback_override { 1 } + fallback_when_full { 1 } + is_public { -1 } + stream_name { Faker::Lorem.characters(number: 10) } + stream_description { Faker::Lorem.characters(number: 10) } + stream_url { Faker::Lorem.characters(number: 10) } + genre { Faker::Lorem.characters(number: 10) } + hidden { 0 } association :server, factory: :icecast_server_with_overrides factory :icecast_mount_with_auth do @@ -507,36 +507,36 @@ FactoryGirl.define do end factory :icecast_source_change, :class => JamRuby::IcecastSourceChange do - source_direction true - success true + source_direction { true } + success { true } sequence(:client_id) { |n| "client_id#{n}" } - change_type JamRuby::IcecastSourceChange::CHANGE_TYPE_CLIENT + change_type { JamRuby::IcecastSourceChange::CHANGE_TYPE_CLIENT } association :user, :factory => :user association :mount, :factory => :iceast_mount_with_music_session end factory :icecast_listen_socket, :class => JamRuby::IcecastListenSocket do - port 8000 + port { 8000 } end factory :icecast_relay, :class => JamRuby::IcecastRelay do - port 8000 - mount Faker::Lorem.characters(10) - server Faker::Lorem.characters(10) - on_demand 1 + port { 8000 } + mount { Faker::Lorem.characters(number: 10) } + server { Faker::Lorem.characters(number: 10) } + on_demand { 1 } end factory :icecast_user_authentication, :class => JamRuby::IcecastUserAuthentication do - authentication_type 'url' - unused_username Faker::Lorem.characters(10) - unused_pass Faker::Lorem.characters(10) - mount_add Faker::Lorem.characters(10) - mount_remove Faker::Lorem.characters(10) - listener_add Faker::Lorem.characters(10) - listener_remove Faker::Lorem.characters(10) - auth_header 'icecast-auth-user: 1' - timelimit_header 'icecast-auth-timelimit:' + authentication_type { 'url' } + unused_username { Faker::Lorem.characters(number: 10) } + unused_pass { Faker::Lorem.characters(number: 10) } + mount_add { Faker::Lorem.characters(number: 10) } + mount_remove { Faker::Lorem.characters(number: 10) } + listener_add { Faker::Lorem.characters(number: 10) } + listener_remove { Faker::Lorem.characters(number: 10) } + auth_header { 'icecast-auth-user: 1' } + timelimit_header { 'icecast-auth-timelimit:' } end factory :icecast_server, :class => JamRuby::IcecastServer do @@ -555,7 +555,7 @@ FactoryGirl.define do association :security, :factory => :icecast_security before(:create) do |server| - server.listen_sockets << FactoryGirl.build(:icecast_listen_socket) + server.listen_sockets << FactoryBot.build(:icecast_listen_socket) end end end @@ -563,19 +563,19 @@ FactoryGirl.define do factory :icecast_mount_template, :class => JamRuby::IcecastMountTemplate do sequence(:name) { |n| "name-#{n}" } - source_username Faker::Lorem.characters(10) - source_pass Faker::Lorem.characters(10) - max_listeners 100 - max_listener_duration 3600 - fallback_mount Faker::Lorem.characters(10) - fallback_override 1 - fallback_when_full 1 - is_public -1 - stream_name Faker::Lorem.characters(10) - stream_description Faker::Lorem.characters(10) - stream_url Faker::Lorem.characters(10) - genre Faker::Lorem.characters(10) - hidden 0 + source_username { Faker::Lorem.characters(number: 10) } + source_pass { Faker::Lorem.characters(number: 10) } + max_listeners { 100 } + max_listener_duration { 3600 } + fallback_mount { Faker::Lorem.characters(number: 10) } + fallback_override { 1 } + fallback_when_full { 1 } + is_public { -1 } + stream_name { Faker::Lorem.characters(number: 10) } + stream_description { Faker::Lorem.characters(number: 10) } + stream_url { Faker::Lorem.characters(number: 10) } + genre { Faker::Lorem.characters(number: 10) } + hidden { 0 } association :authentication, :factory => :icecast_user_authentication end @@ -592,7 +592,7 @@ FactoryGirl.define do association :security, :factory => :icecast_security before(:create) do |template| - template.listen_sockets << FactoryGirl.build(:icecast_listen_socket) + template.listen_sockets << FactoryBot.build(:icecast_listen_socket) end end end @@ -601,11 +601,11 @@ FactoryGirl.define do sequence(:lookup_id) { |n| "lookup-#{n}" } sequence(:first_name) { |n| "first-#{n}" } sequence(:last_name) { |n| "last-#{n}" } - gender 'M' + gender { 'M' } sequence(:email) { |n| "jammin-#{n}@jamkazam.com" } sequence(:uid) { |n| "uid-#{n}" } sequence(:token) { |n| "token-#{n}" } - token_expires_at Time.now + token_expires_at { Time.now } end @@ -629,17 +629,17 @@ FactoryGirl.define do factory :event, :class => JamRuby::Event do sequence(:slug) { |n| "slug-#{n}" } - title 'event title' - description 'event description' + title { 'event title' } + description { 'event description' } end factory :event_session, :class => JamRuby::EventSession do end factory :email_batch, :class => JamRuby::EmailBatch do - subject Faker::Lorem.sentence - body "#{JamRuby::EmailBatch::VAR_FIRST_NAME} " + Faker::Lorem.paragraphs(3).join("\n") - test_emails 4.times.collect { Faker::Internet.safe_email }.join(',') + subject { Faker::Lorem.sentence } + body { "#{JamRuby::EmailBatch::VAR_FIRST_NAME} " + Faker::Lorem.paragraphs(3).join("\n") } + test_emails { 4.times.collect { Faker::Internet.safe_email }.join(',') } end factory :email_batch_new_musician, :class => JamRuby::EmailBatchNewMusician do @@ -654,51 +654,51 @@ FactoryGirl.define do factory :notification, :class => JamRuby::Notification do factory :notification_text_message do - description 'TEXT_MESSAGE' - message Faker::Lorem.characters(10) + description { 'TEXT_MESSAGE' } + message { Faker::Lorem.characters(number: 10) } end 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 } end factory :rsvp_slot, :class => JamRuby::RsvpSlot do - proficiency_level "beginner" + proficiency_level { "beginner" } instrument { Instrument.find('electric guitar') } factory :chosen_rsvp_slot do transient do - user nil + user { nil } end after(:create) do |rsvp_slot, evaluator| - rsvp_request = FactoryGirl.create(:rsvp_request, user: evaluator.user) - rsvp_request_rsvp_slot = FactoryGirl.create(:rsvp_request_rsvp_slot, chosen: true, rsvp_request: rsvp_request, rsvp_slot: rsvp_slot) + rsvp_request = FactoryBot.create(:rsvp_request, user: evaluator.user) + rsvp_request_rsvp_slot = FactoryBot.create(:rsvp_request_rsvp_slot, chosen: true, rsvp_request: rsvp_request, rsvp_slot: rsvp_slot) end end end factory :rsvp_request, class: JamRuby::RsvpRequest do - canceled false - cancel_all false + canceled { false } + cancel_all { false } association :user, :factory => :user # creates *number* slots for a new rsvp_request (the case were you are too lazy / don't care to set up slots) factory :rsvp_request_for_multiple_slots do transient do - #music_session nil - number 1 - #chosen nil + #music_session { nil } + number { 1 } + #chosen { nil } end after(:create) { |rsvp_request, evaluator| evaluator.number.times do |i| - slot = FactoryGirl.create(:rsvp_slot, music_session: evaluator.music_session, instrument: Instrument.order(:id).limit(1).offset(i).first, proficiency_level: 1) - FactoryGirl.create(:rsvp_request_rsvp_slot, chosen: evaluator.chosen, rsvp_request: rsvp_request, rsvp_slot: slot) + slot = FactoryBot.create(:rsvp_slot, music_session: evaluator.music_session, instrument: Instrument.order(:id).limit(1).offset(i).first, proficiency_level: 1) + FactoryBot.create(:rsvp_request_rsvp_slot, chosen: evaluator.chosen, rsvp_request: rsvp_request, rsvp_slot: slot) end } end @@ -706,39 +706,39 @@ FactoryGirl.define do # creates a rsvp_request for the specified slots (helps when you already have a slot(s), and need to request to them) factory :rsvp_request_for_slots do transient do - slots nil - chosen nil + slots { nil } + chosen { nil } end after(:create) { |rsvp_request, evaluator| evaluator.slots.each do |slot| - FactoryGirl.create(:rsvp_request_rsvp_slot, chosen: evaluator.chosen, rsvp_request: rsvp_request, rsvp_slot: slot) + FactoryBot.create(:rsvp_request_rsvp_slot, chosen: evaluator.chosen, rsvp_request: rsvp_request, rsvp_slot: slot) end } end end factory :rsvp_request_rsvp_slot, :class => JamRuby::RsvpRequestRsvpSlot do - chosen false + chosen { false } end 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 factory :max_mind_release, :class => JamRuby::MaxMindRelease do - released_at Time.now.to_date + released_at { Time.now.to_date } end factory :jam_track_licensor, :class => JamRuby::JamTrackLicensor do @@ -759,14 +759,14 @@ FactoryGirl.define do association :user, factory: :user association :jam_track, factory: :jam_track sequence(:name) { |n| "mixdown-#{n}" } - settings '{"speed":5}' + settings { '{"speed":5}' } end factory :jam_track_mixdown_package, :class => JamRuby::JamTrackMixdownPackage do - file_type JamRuby::JamTrackMixdownPackage::FILE_TYPE_OGG - sample_rate 48 - signing false - signed false + file_type { JamRuby::JamTrackMixdownPackage::FILE_TYPE_OGG } + sample_rate { 48 } + signing { false } + signed { false } association :jam_track_mixdown, factory: :jam_track_mixdown end @@ -776,127 +776,127 @@ 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}" } - sales_region 'United States' - price 1.99 - download_price 2.99 - reproduction_royalty true - public_performance_royalty true - reproduction_royalty_amount 0.999 - licensor_royalty_amount 0.999 + sales_region { 'United States' } + price { 1.99 } + download_price { 2.99 } + reproduction_royalty { true } + public_performance_royalty { true } + reproduction_royalty_amount { 0.999 } + licensor_royalty_amount { 0.999 } sequence(:plan_code) { |n| "jamtrack-#{n}" } - genres [JamRuby::Genre.first] + genres { [JamRuby::Genre.first] } association :licensor, factory: :jam_track_licensor factory :jam_track_with_tracks do after(:create) do |jam_track, evaluator| - FactoryGirl.create(:jam_track_track, jam_track: jam_track) + FactoryBot.create(:jam_track_track, jam_track: jam_track) end end 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 factory :jam_track_right, :class => JamRuby::JamTrackRight do association :jam_track, factory: :jam_track association :user, factory: :user - signing_44 false - signing_48 false + signing_44 { false } + signing_48 { false } end factory :download_tracker, :class => JamRuby::DownloadTracker do - remote_ip '1.1.1.1' - paid false + remote_ip { '1.1.1.1' } + paid { false } association :user, factory: :user association :jam_track, factory: :jam_track end factory :sale, :class => JamRuby::Sale do - order_total 0 + order_total { 0 } association :user, factory: user end factory :recurly_transaction_web_hook, :class => JamRuby::RecurlyTransactionWebHook do - transaction_type JamRuby::RecurlyTransactionWebHook::SUCCESSFUL_PAYMENT + transaction_type { JamRuby::RecurlyTransactionWebHook::SUCCESSFUL_PAYMENT } sequence(:recurly_transaction_id) { |n| "recurly-transaction-id-#{n}" } sequence(:subscription_id) { |n| "subscription-id-#{n}" } sequence(:invoice_id) { |n| "invoice-id-#{n}" } sequence(:invoice_number) { |n| 1000 + n } - invoice_number_prefix nil - action 'purchase' - status 'success' - transaction_at Time.now - amount_in_cents 199 - reference 100000 - message 'meh' + invoice_number_prefix { nil } + action { 'purchase' } + status { 'success' } + transaction_at { Time.now } + amount_in_cents { 199 } + reference { 100000 } + message { 'meh' } association :user, factory: :user factory :recurly_transaction_web_hook_failed do - transaction_type JamRuby::RecurlyTransactionWebHook::FAILED_PAYMENT + transaction_type { JamRuby::RecurlyTransactionWebHook::FAILED_PAYMENT } end end factory :broadcast_notification, :class => JamRuby::BroadcastNotification do - title Faker::Lorem.sentence[0...50] - message Faker::Lorem.paragraph[0...200] - button_label Faker::Lorem.words(2).join(' ')[0...14] - frequency 3 + title { Faker::Lorem.sentence[0...50] } + message { Faker::Lorem.paragraph[0...200] } + button_label { Faker::Lorem.words(2).join(' ')[0...14] } + frequency { 3 } end factory :affiliate_partner, class: 'JamRuby::AffiliatePartner' do sequence(:partner_name) { |n| "partner-#{n}" } - entity_type 'Individual' - signed_at Time.now + entity_type { 'Individual' } + signed_at { Time.now } association :partner_user, factory: :user end factory :affiliate_quarterly_payment, class: 'JamRuby::AffiliateQuarterlyPayment' do - year 2015 - quarter 0 + year { 2015 } + quarter { 0 } association :affiliate_partner, factory: :affiliate_partner end factory :affiliate_monthly_payment, class: 'JamRuby::AffiliateMonthlyPayment' do - year 2015 - month 0 + year { 2015 } + month { 0 } association :affiliate_partner, factory: :affiliate_partner end factory :affiliate_referral_visit, class: 'JamRuby::AffiliateReferralVisit' do - ip_address '1.1.1.1' + ip_address { '1.1.1.1' } association :affiliate_partner, factory: :affiliate_partner end factory :affiliate_legalese, class: 'JamRuby::AffiliateLegalese' do - legalese Faker::Lorem.paragraphs(6).join("\n\n") + legalese { Faker::Lorem.paragraphs(6).join("\n\n") } end factory :affiliate_distribution, class: 'JamRuby::AffiliateDistribution' do association :affiliate_referral, factory: :affiliate_partner - affiliate_referral_fee_in_cents 15 + affiliate_referral_fee_in_cents { 15 } end factory :gift_card, class: 'JamRuby::GiftCard' do sequence(:code) { n.to_s } - card_type JamRuby::GiftCardType::JAM_TRACKS_5 + card_type { JamRuby::GiftCardType::JAM_TRACKS_5 } end factory :gift_card_type, class: 'JamRuby::GiftCardType' do - card_type JamRuby::GiftCardType::JAM_TRACKS_5 + card_type { JamRuby::GiftCardType::JAM_TRACKS_5 } end factory :gift_card_purchase, class: 'JamRuby::GiftCardPurchase' do @@ -906,38 +906,38 @@ FactoryGirl.define do factory :posa_card, class: 'JamRuby::PosaCard' do sequence(:code) { |n| n.to_s } - card_type JamRuby::PosaCard::JAM_TRACKS_5 - credits 5 - requires_purchase false - purchased true + card_type { JamRuby::PosaCard::JAM_TRACKS_5 } + credits { 5 } + requires_purchase { false } + purchased { true } factory :posa_card_lesson_2 do - card_type JamRuby::PosaCard::JAM_CLASS_2 - credits 2 + card_type { JamRuby::PosaCard::JAM_CLASS_2 } + credits { 2 } lesson_package_type { JamRuby::LessonPackageType.test_drive_2 } - is_lesson true + is_lesson { true } end factory :posa_card_lesson_4 do - card_type JamRuby::PosaCard::JAM_CLASS_4 - credits 4 + card_type { JamRuby::PosaCard::JAM_CLASS_4 } + credits { 4 } lesson_package_type { JamRuby::LessonPackageType.test_drive_4 } - is_lesson true + is_lesson { true } end factory :amazon_test_drive_free_2 do - card_type JamRuby::PosaCard::JAM_CLASS_2 - credits 2 + card_type { JamRuby::PosaCard::JAM_CLASS_2 } + credits { 2 } lesson_package_type { JamRuby::LessonPackageType.amazon_test_drive_free_2 } - is_lesson true - is_test false - purchased true - preactivate true + is_lesson { true } + is_test { false } + purchased { true } + preactivate { true } end end factory :posa_card_type, class: 'JamRuby::PosaCardType' do - card_type JamRuby::PosaCardType::JAM_TRACKS_5 + card_type { JamRuby::PosaCardType::JAM_TRACKS_5 } end factory :posa_card_purchase, class: 'JamRuby::PosaCardPurchase' do @@ -964,117 +964,117 @@ FactoryGirl.define do factory :school, class: 'JamRuby::School' do association :user, factory: :user sequence(:name) { |n| "Dat Music School #{n}" } - enabled true - scheduling_communication 'teacher' + enabled { true } + scheduling_communication { 'teacher' } end factory :school_invitation, class: 'JamRuby::SchoolInvitation' do association :school, factory: :school - note "hey come in in" - as_teacher true + note { "hey come in in" } + as_teacher { true } sequence(:email) { |n| "school_person#{n}@example.com" } sequence(:first_name) { |n| "FirstName" } sequence(:last_name) { |n| "LastName" } - accepted false + accepted { false } end factory :retailer, class: 'JamRuby::Retailer' do association :user, factory: :user sequence(:name) { |n| "Dat Music Retailer" } sequence(:slug) { |n| "retailer-#{n}" } - enabled true + enabled { true } end factory :retailer_invitation, class: 'JamRuby::RetailerInvitation' do association :retailer, factory: :retailer - note "hey come in in" + note { "hey come in in" } sequence(:email) { |n| "retail_person#{n}@example.com" } sequence(:first_name) { |n| "FirstName" } sequence(:last_name) { |n| "LastName" } - accepted false + accepted { false } end factory :lesson_booking_slot, class: 'JamRuby::LessonBookingSlot' do factory :lesson_booking_slot_single do - slot_type 'single' + slot_type { 'single' } preferred_day { Date.today + 3 } - day_of_week nil - hour 12 - minute 30 - timezone 'UTC' + day_of_week { nil } + hour { 12 } + minute { 30 } + timezone { 'UTC' } end factory :lesson_booking_slot_recurring do - slot_type 'recurring' - preferred_day nil - day_of_week 0 - hour 12 - minute 30 - timezone 'UTC' + slot_type { 'recurring' } + preferred_day { nil } + day_of_week { 0 } + hour { 12 } + minute { 30 } + timezone { 'UTC' } end end factory :lesson_booking, class: 'JamRuby::LessonBooking' do association :user, factory: :user association :teacher, factory: :teacher_user - card_presumed_ok false - sent_notices false - recurring false - lesson_length 30 - lesson_type JamRuby::LessonBooking::LESSON_TYPE_FREE - payment_style JamRuby::LessonBooking::PAYMENT_STYLE_ELSEWHERE - description "Oh my goodness!" - status JamRuby::LessonBooking::STATUS_REQUESTED + card_presumed_ok { false } + sent_notices { false } + recurring { false } + lesson_length { 30 } + lesson_type { JamRuby::LessonBooking::LESSON_TYPE_FREE } + payment_style { JamRuby::LessonBooking::PAYMENT_STYLE_ELSEWHERE } + description { "Oh my goodness!" } + status { JamRuby::LessonBooking::STATUS_REQUESTED } before(:create) do |lesson_booking, evaluator| - lesson_booking.lesson_booking_slots = [FactoryGirl.build(:lesson_booking_slot_single, lesson_booking: lesson_booking), - FactoryGirl.build(:lesson_booking_slot_single, lesson_booking: lesson_booking)] + lesson_booking.lesson_booking_slots = [FactoryBot.build(:lesson_booking_slot_single, lesson_booking: lesson_booking), + FactoryBot.build(:lesson_booking_slot_single, lesson_booking: lesson_booking)] end - #lesson_booking_slots [FactoryGirl.build(:lesson_booking_slot_single), FactoryGirl.build(:lesson_booking_slot_single)] + #lesson_booking_slots [FactoryBot.build(:lesson_booking_slot_single), FactoryBot.build(:lesson_booking_slot_single)] end factory :lesson_package_purchase, class: "JamRuby::LessonPackagePurchase" do lesson_package_type { JamRuby::LessonPackageType.single } association :user, factory: :user association :teacher, factory: :teacher_user - price 30.00 + price { 30.00 } factory :test_drive_purchase do lesson_package_type { JamRuby::LessonPackageType.test_drive_4 } association :lesson_booking, factory: :lesson_booking - price 49.99 + price { 49.99 } end end factory :lesson_session, class: 'JamRuby::LessonSession' do ignore do - student nil + student { nil } end - music_session { FactoryGirl.create(:music_session, creator: student) } - lesson_booking { FactoryGirl.create(:lesson_booking, user: student, teacher: teacher) } + music_session { FactoryBot.create(:music_session, creator: student) } + lesson_booking { FactoryBot.create(:lesson_booking, user: student, teacher: teacher) } association :teacher, factory: :teacher_user - lesson_type JamRuby::LessonSession::LESSON_TYPE_SINGLE - duration 30 - booked_price 49.99 - status JamRuby::LessonSession::STATUS_REQUESTED - #teacher_complete true - #student_complete true + lesson_type { JamRuby::LessonSession::LESSON_TYPE_SINGLE } + duration { 30 } + booked_price { 49.99 } + status { JamRuby::LessonSession::STATUS_REQUESTED } + #teacher_complete { true } + #student_complete { true } end factory :charge, class: 'JamRuby::Charge' do - type 'JamRuby::Charge' - amount_in_cents 1000 + type { 'JamRuby::Charge' } + amount_in_cents { 1000 } end factory :teacher_payment_charge, parent: :charge, class: 'JamRuby::TeacherPaymentCharge' do - type 'JamRuby::TeacherPaymentCharge' + type { 'JamRuby::TeacherPaymentCharge' } association :user, factory: :user end factory :lesson_payment_charge, parent: :charge, class: 'JamRuby::LessonPaymentCharge' do - type 'JamRuby::LessonPaymentCharge' + type { 'JamRuby::LessonPaymentCharge' } association :user, factory: :user end @@ -1082,25 +1082,25 @@ FactoryGirl.define do factory :teacher_payment, class: 'JamRuby::TeacherPayment' do association :teacher, factory: :teacher_user association :teacher_payment_charge, factory: :teacher_payment_charge - amount_in_cents 1000 - fee_in_cents 0 + amount_in_cents { 1000 } + fee_in_cents { 0 } end # you gotta pass either lesson_session or lesson_package_purchase for this to make sense factory :teacher_distribution, class: 'JamRuby::TeacherDistribution' do association :teacher, factory: :teacher_user association :teacher_payment, factory: :teacher_payment - ready false - amount_in_cents 1000 + ready { false } + amount_in_cents { 1000 } end factory :ip_blacklist, class: "JamRuby::IpBlacklist" do - remote_ip '1.1.1.1' + remote_ip { '1.1.1.1' } end factory :ip_whitelist, class: "JamRuby::IpWhitelist" do - remote_ip '1.1.1.1' + remote_ip { '1.1.1.1' } end factory :user_blacklist, class: "JamRuby::UserBlacklist" do @@ -1118,9 +1118,9 @@ FactoryGirl.define do factory :music_notation, class: "JamRuby::MusicNotation" do attachment_type { JamRuby::MusicNotation::TYPE_NOTATION } association :user, factory: :user - file_url 'abc' - size 100 - file_name 'some_file.jpg' + file_url { 'abc' } + size { 100 } + file_name { 'some_file.jpg' } end factory :test_drive_package, class: "JamRuby::TestDrivePackage" do @@ -1128,28 +1128,28 @@ FactoryGirl.define do sequence(:name) { |n| "package-#{n}" } trait :one_pack do - package_type 1 + package_type { 1 } after(:create) do |package, evaluator| 1.times.each do - FactoryGirl.create(:test_drive_package_teachers, test_drive_package: package) + FactoryBot.create(:test_drive_package_teachers, test_drive_package: package) end end end trait :two_pack do - package_type 2 + package_type { 2 } after(:create) do |package, evaluator| 2.times.each do - FactoryGirl.create(:test_drive_package_teachers, test_drive_package: package) + FactoryBot.create(:test_drive_package_teachers, test_drive_package: package) end end end trait :four_pack do - package_type 4 + package_type { 4 } after(:create) do |package, evaluator| 4.times.each do - FactoryGirl.create(:test_drive_package_teachers, test_drive_package: package) + FactoryBot.create(:test_drive_package_teachers, test_drive_package: package) end end end @@ -1178,8 +1178,8 @@ FactoryGirl.define do factory :user_asset, class: "JamRuby::UserAsset" do association :user, factory: :user - asset_type "image" - filename "image.jpg" + asset_type { "image" } + filename { "image.jpg" } end end diff --git a/ruby/spec/jam_ruby/calendar_manager_spec.rb b/ruby/spec/jam_ruby/calendar_manager_spec.rb index 34023e86f..f0b1efc98 100644 --- a/ruby/spec/jam_ruby/calendar_manager_spec.rb +++ b/ruby/spec/jam_ruby/calendar_manager_spec.rb @@ -5,7 +5,7 @@ describe CalendarManager do CALENDAR_NAME="Test Cal" before :all do - @genre1 = FactoryGirl.create(:genre) + @genre1 = FactoryBot.create(:genre) @calendar_manager = JamRuby::CalendarManager.new # Time resolution is seconds: @@ -19,8 +19,8 @@ describe CalendarManager do describe "with music sessions" do before :all do - @creator = FactoryGirl.create(:user) - @music_session = FactoryGirl.create(:music_session, :creator => @creator, :description => CALENDAR_NAME, :genre => @genre1, :scheduled_start=>@start, :scheduled_duration=>3600) + @creator = FactoryBot.create(:user) + @music_session = FactoryBot.create(:music_session, :creator => @creator, :description => CALENDAR_NAME, :genre => @genre1, :scheduled_start=>@start, :scheduled_duration=>3600) @music_session.reload end @@ -44,7 +44,7 @@ describe CalendarManager do describe "with manual calendars" do before :all do - @creator = FactoryGirl.create(:user) + @creator = FactoryBot.create(:user) @creator.calendars<CALENDAR_NAME, :description=>"This is a test", :start_at=>(@start), :end_at=>@stop, :trigger_delete=>false, :target_uid=>"2112"}) end diff --git a/ruby/spec/jam_ruby/connection_manager_spec.rb b/ruby/spec/jam_ruby/connection_manager_spec.rb index 69efd374e..00cb97b41 100644 --- a/ruby/spec/jam_ruby/connection_manager_spec.rb +++ b/ruby/spec/jam_ruby/connection_manager_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -# these tests avoid the use of ActiveRecord and FactoryGirl to do blackbox, non test-instrumented tests +# these tests avoid the use of ActiveRecord and FactoryBot to do blackbox, non test-instrumented tests describe ConnectionManager, no_transaction: true do TRACKS = [{"instrument_id" => "electric guitar", "sound" => "mono", "client_track_id" => "some_client_track_id"}] @@ -50,7 +50,7 @@ describe ConnectionManager, no_transaction: true do client_id = "client_id9" user_id = create_user("test", "user9", "user9@jamkazam.com") - music_session = FactoryGirl.create(:active_music_session, user_id: user_id) + music_session = FactoryBot.create(:active_music_session, user_id: user_id) music_session_id = music_session.id user = User.find(user_id) @@ -72,7 +72,7 @@ describe ConnectionManager, no_transaction: true do client_id = "client_id1" user_id = create_user("test", "user1", "user1@jamkazam.com") user = User.find(user_id) - user.musician_instruments << FactoryGirl.build(:musician_instrument, player: user) + user.musician_instruments << FactoryBot.build(:musician_instrument, player: user) user.save! user = nil @@ -84,7 +84,7 @@ describe ConnectionManager, no_transaction: true do client_id = "client_id2" #user_id = create_user("test", "user2", "user2@jamkazam.com") - user = FactoryGirl.create(:user) + user = FactoryBot.create(:user) count = @connman.create_connection(user.id, client_id, channel_id, "1.1.1.1", 'client', STALE_TIME, EXPIRE_TIME, REACHABLE, GATEWAY, false) @@ -113,7 +113,7 @@ describe ConnectionManager, no_transaction: true do client_id = "client_id3" #user_id = create_user("test", "user2", "user2@jamkazam.com") - user = FactoryGirl.create(:user) + user = FactoryBot.create(:user) count = @connman.create_connection(user.id, client_id, channel_id, "1.1.1.1", 'client', STALE_TIME, EXPIRE_TIME, REACHABLE, GATEWAY, false) @@ -150,7 +150,7 @@ describe ConnectionManager, no_transaction: true do client_id = "client_id3" #user_id = create_user("test", "user2", "user2@jamkazam.com") - user = FactoryGirl.create(:user) + user = FactoryBot.create(:user) count = @connman.create_connection(user.id, client_id, channel_id, "1.1.1.1", 'client', STALE_TIME, EXPIRE_TIME, false, GATEWAY, false) @@ -342,7 +342,7 @@ describe ConnectionManager, no_transaction: true do client_id = "client_id9" user_id = create_user("test", "user9", "user9@jamkazam.com") - music_session = FactoryGirl.create(:active_music_session, user_id: user_id) + music_session = FactoryBot.create(:active_music_session, user_id: user_id) music_session_id = music_session.id user = User.find(user_id) @@ -368,7 +368,7 @@ describe ConnectionManager, no_transaction: true do client_id = "client_id10" user_id = create_user("test", "user10", "user10@jamkazam.com") - music_session = FactoryGirl.create(:active_music_session, user_id: user_id) + music_session = FactoryBot.create(:active_music_session, user_id: user_id) music_session_id = music_session.id user = User.find(user_id) @@ -386,7 +386,7 @@ describe ConnectionManager, no_transaction: true do @connman.create_connection(user_id, client_id, channel_id, "1.1.1.1", 'client', STALE_TIME, EXPIRE_TIME, REACHABLE, GATEWAY, false) @connman.create_connection(user_id2, client_id2, channel_id, "1.1.1.1", 'client', STALE_TIME, EXPIRE_TIME, REACHABLE, GATEWAY, false) - music_session = FactoryGirl.create(:active_music_session, user_id: user_id) + music_session = FactoryBot.create(:active_music_session, user_id: user_id) music_session_id = music_session.id user = User.find(user_id) @@ -405,7 +405,7 @@ describe ConnectionManager, no_transaction: true do user_id = create_user("test", "user10.2", "user10.2@jamkazam.com") @connman.create_connection(user_id, client_id, channel_id, "1.1.1.1", 'client', STALE_TIME, EXPIRE_TIME, REACHABLE, GATEWAY, false) - music_session = FactoryGirl.create(:active_music_session, user_id: user_id) + music_session = FactoryBot.create(:active_music_session, user_id: user_id) user = User.find(user_id) connection = @connman.join_music_session(user, client_id, music_session, 'blarg', TRACKS, 10) @@ -422,7 +422,7 @@ describe ConnectionManager, no_transaction: true do @connman.create_connection(musician_id, musician_client_id, channel_id, "1.1.1.1", 'client', STALE_TIME, EXPIRE_TIME, REACHABLE, GATEWAY, false) @connman.create_connection(fan_id, fan_client_id, channel_id, "1.1.1.1", 'client', STALE_TIME, EXPIRE_TIME, REACHABLE, GATEWAY, false) - music_session = FactoryGirl.create(:active_music_session, :fan_access => false, user_id: musician_id) + music_session = FactoryBot.create(:active_music_session, :fan_access => false, user_id: musician_id) music_session_id = music_session.id user = User.find(musician_id) @@ -440,7 +440,7 @@ describe ConnectionManager, no_transaction: true do client_id = "client_id20" user_id = create_user("test", "user20", "user20@jamkazam.com") user_id2 = create_user("test", "user21", "user21@jamkazam.com") - music_session = FactoryGirl.create(:active_music_session, user_id: user_id) + music_session = FactoryBot.create(:active_music_session, user_id: user_id) music_session_id = music_session.id user = User.find(user_id2) @@ -466,7 +466,7 @@ describe ConnectionManager, no_transaction: true do client_id = "client_id11.1" user_id = create_user("test", "user11.1", "user11.1@jamkazam.com") user_id2 = create_user("test", "user11.2", "user11.2@jamkazam.com") - music_session = FactoryGirl.create(:active_music_session, :approval_required => true, user_id: user_id) + music_session = FactoryBot.create(:active_music_session, :approval_required => true, user_id: user_id) music_session_id = music_session.id user = User.find(user_id2) @@ -493,7 +493,7 @@ describe ConnectionManager, no_transaction: true do client_id = "client_id13" user_id = create_user("test", "user13", "user13@jamkazam.com") - music_session = FactoryGirl.create(:active_music_session, user_id: user_id) + music_session = FactoryBot.create(:active_music_session, user_id: user_id) music_session_id = music_session.id user = User.find(user_id) @@ -508,7 +508,7 @@ describe ConnectionManager, no_transaction: true do client_id = "client_id14" user_id = create_user("test", "user14", "user14@jamkazam.com") - music_session = FactoryGirl.create(:active_music_session, user_id: user_id) + music_session = FactoryBot.create(:active_music_session, user_id: user_id) music_session_id = music_session.id user = User.find(user_id) @@ -556,11 +556,11 @@ describe ConnectionManager, no_transaction: true do client_id1 = Faker::Number.number(20) @connman.create_connection(user_id, client_id1, channel_id, "1.1.1.1", 'client', STALE_TIME, EXPIRE_TIME, REACHABLE, GATEWAY, false) - music_session1 = FactoryGirl.create(:active_music_session, :user_id => user_id) + music_session1 = FactoryBot.create(:active_music_session, :user_id => user_id) connection1 = @connman.join_music_session(user, client_id1, music_session1, true, TRACKS, 10) connection1.errors.size.should == 0 - music_session2 = FactoryGirl.create(:active_music_session, :user_id => user_id) + music_session2 = FactoryBot.create(:active_music_session, :user_id => user_id) connection2 = @connman.join_music_session(user, client_id1, music_session2, true, TRACKS, 10) connection2.errors.size.should == 1 diff --git a/ruby/spec/jam_ruby/flows/monthly_recurring_lesson_spec.rb b/ruby/spec/jam_ruby/flows/monthly_recurring_lesson_spec.rb index 388b9fdc4..790c50567 100644 --- a/ruby/spec/jam_ruby/flows/monthly_recurring_lesson_spec.rb +++ b/ruby/spec/jam_ruby/flows/monthly_recurring_lesson_spec.rb @@ -2,19 +2,19 @@ require 'spec_helper' describe "Monthly Recurring Lesson Flow" do - let(:user) { FactoryGirl.create(:user, remaining_test_drives: 0) } + let(:user) { FactoryBot.create(:user, remaining_test_drives: 0) } - let(:teacher_user) { FactoryGirl.create(:teacher_user) } + let(:teacher_user) { FactoryBot.create(:teacher_user) } let(:teacher) { teacher_user.teacher } - let(:lesson_booking_slot_single1) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_single2) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_recurring1) { FactoryGirl.build(:lesson_booking_slot_recurring) } - let(:lesson_booking_slot_recurring2) { FactoryGirl.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_single1) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_single2) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_recurring1) { FactoryBot.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_recurring2) { FactoryBot.build(:lesson_booking_slot_recurring) } let(:valid_single_slots) { [lesson_booking_slot_single1, lesson_booking_slot_single2] } let(:valid_recurring_slots) { [lesson_booking_slot_recurring1, lesson_booking_slot_recurring2] } - let(:affiliate_partner) { FactoryGirl.create(:affiliate_partner) } - let(:affiliate_partner2) { FactoryGirl.create(:affiliate_partner, lesson_rate: 0.30) } - let(:school) {FactoryGirl.create(:school)} + let(:affiliate_partner) { FactoryBot.create(:affiliate_partner) } + let(:affiliate_partner2) { FactoryBot.create(:affiliate_partner, lesson_rate: 0.30) } + let(:school) {FactoryBot.create(:school)} @@ -72,7 +72,7 @@ describe "Monthly Recurring Lesson Flow" do booking.status.should eql LessonBooking::STATUS_REQUESTED ######### Teacher counters with new slot - teacher_countered_slot = FactoryGirl.build(:lesson_booking_slot_recurring, hour: 14, update_all: true) + teacher_countered_slot = FactoryBot.build(:lesson_booking_slot_recurring, hour: 14, update_all: true) UserMailer.deliveries.clear lesson_session.counter({proposer: teacher_user, slot: teacher_countered_slot, message: 'Does this work?'}) booking.reload @@ -97,7 +97,7 @@ describe "Monthly Recurring Lesson Flow" do notification.description.should eql NotificationTypes::LESSON_MESSAGE ######### Student counters with new slot - student_countered_slot = FactoryGirl.build(:lesson_booking_slot_recurring, hour: 16, update_all: true) + student_countered_slot = FactoryBot.build(:lesson_booking_slot_recurring, hour: 16, update_all: true) UserMailer.deliveries.clear lesson_session.counter({proposer: user, slot: student_countered_slot, message: 'Does this work better?'}) lesson_session.errors.any?.should be false @@ -153,7 +153,7 @@ describe "Monthly Recurring Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -219,7 +219,7 @@ describe "Monthly Recurring Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -345,7 +345,7 @@ describe "Monthly Recurring Lesson Flow" do booking.status.should eql LessonBooking::STATUS_REQUESTED ######### Teacher counters with new slot - teacher_countered_slot = FactoryGirl.build(:lesson_booking_slot_recurring, hour: 14, update_all: true) + teacher_countered_slot = FactoryBot.build(:lesson_booking_slot_recurring, hour: 14, update_all: true) UserMailer.deliveries.clear lesson_session.counter({proposer: teacher_user, slot: teacher_countered_slot, message: 'Does this work?'}) booking.reload @@ -370,7 +370,7 @@ describe "Monthly Recurring Lesson Flow" do notification.description.should eql NotificationTypes::LESSON_MESSAGE ######### Student counters with new slot - student_countered_slot = FactoryGirl.build(:lesson_booking_slot_recurring, hour: 16, update_all: true) + student_countered_slot = FactoryBot.build(:lesson_booking_slot_recurring, hour: 16, update_all: true) UserMailer.deliveries.clear lesson_session.counter({proposer: user, slot: student_countered_slot, message: 'Does this work better?'}) lesson_session.errors.any?.should be false @@ -426,7 +426,7 @@ describe "Monthly Recurring Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -507,7 +507,7 @@ describe "Monthly Recurring Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -572,7 +572,7 @@ describe "Monthly Recurring Lesson Flow" do booking.status.should eql LessonBooking::STATUS_REQUESTED ######### Teacher counters with new slot - teacher_countered_slot = FactoryGirl.build(:lesson_booking_slot_recurring, hour: 14, update_all: true) + teacher_countered_slot = FactoryBot.build(:lesson_booking_slot_recurring, hour: 14, update_all: true) UserMailer.deliveries.clear lesson_session.counter({proposer: teacher_user, slot: teacher_countered_slot, message: 'Does this work?'}) lesson_session.errors.any?.should be_false @@ -598,7 +598,7 @@ describe "Monthly Recurring Lesson Flow" do notification.description.should eql NotificationTypes::LESSON_MESSAGE ######### Student counters with new slot - student_countered_slot = FactoryGirl.build(:lesson_booking_slot_recurring, hour: 16, update_all: true) + student_countered_slot = FactoryBot.build(:lesson_booking_slot_recurring, hour: 16, update_all: true) UserMailer.deliveries.clear lesson_session.counter({proposer: user, slot: student_countered_slot, message: 'Does this work better?'}) lesson_session.errors.any?.should be false @@ -654,7 +654,7 @@ describe "Monthly Recurring Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -690,7 +690,7 @@ describe "Monthly Recurring Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! diff --git a/ruby/spec/jam_ruby/flows/normal_lesson_spec.rb b/ruby/spec/jam_ruby/flows/normal_lesson_spec.rb index 9a519063c..a8914f3c1 100644 --- a/ruby/spec/jam_ruby/flows/normal_lesson_spec.rb +++ b/ruby/spec/jam_ruby/flows/normal_lesson_spec.rb @@ -3,20 +3,20 @@ require 'spec_helper' describe "Normal Lesson Flow" do - let(:user) { FactoryGirl.create(:user, remaining_test_drives: 0) } + let(:user) { FactoryBot.create(:user, remaining_test_drives: 0) } - let(:teacher_user) { FactoryGirl.create(:teacher_user) } + let(:teacher_user) { FactoryBot.create(:teacher_user) } let(:teacher) { teacher_user.teacher } - let(:lesson_booking_slot_single1) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_single2) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_recurring1) { FactoryGirl.build(:lesson_booking_slot_recurring) } - let(:lesson_booking_slot_recurring2) { FactoryGirl.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_single1) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_single2) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_recurring1) { FactoryBot.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_recurring2) { FactoryBot.build(:lesson_booking_slot_recurring) } let(:valid_single_slots) { [lesson_booking_slot_single1, lesson_booking_slot_single2] } let(:valid_recurring_slots) { [lesson_booking_slot_recurring1, lesson_booking_slot_recurring2] } - let(:affiliate_partner) { FactoryGirl.create(:affiliate_partner) } - let(:affiliate_partner2) { FactoryGirl.create(:affiliate_partner, lesson_rate: 0.30) } - let(:school) {FactoryGirl.create(:school)} - let(:retailer) {FactoryGirl.create(:retailer)} + let(:affiliate_partner) { FactoryBot.create(:affiliate_partner) } + let(:affiliate_partner2) { FactoryBot.create(:affiliate_partner, lesson_rate: 0.30) } + let(:school) {FactoryBot.create(:school)} + let(:retailer) {FactoryBot.create(:retailer)} after {Timecop.return} @@ -95,7 +95,7 @@ describe "Normal Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -310,7 +310,7 @@ describe "Normal Lesson Flow" do booking.status.should eql LessonBooking::STATUS_REQUESTED ######### Teacher counters with new slot - teacher_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 14) + teacher_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 14) UserMailer.deliveries.clear lesson_session.counter({proposer: teacher_user, slot: teacher_countered_slot, message: 'Does this work?'}) booking.reload @@ -335,7 +335,7 @@ describe "Normal Lesson Flow" do notification.description.should eql NotificationTypes::LESSON_MESSAGE ######### Student counters with new slot - student_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 16) + student_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 16) UserMailer.deliveries.clear lesson_session.counter({proposer: user, slot: student_countered_slot, message: 'Does this work better?'}) lesson_session.errors.any?.should be false @@ -386,7 +386,7 @@ describe "Normal Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -510,7 +510,7 @@ describe "Normal Lesson Flow" do booking.status.should eql LessonBooking::STATUS_REQUESTED ######### Teacher counters with new slot - teacher_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 14) + teacher_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 14) UserMailer.deliveries.clear lesson_session.counter({proposer: teacher_user, slot: teacher_countered_slot, message: 'Does this work?'}) booking.reload @@ -535,7 +535,7 @@ describe "Normal Lesson Flow" do notification.description.should eql NotificationTypes::LESSON_MESSAGE ######### Student counters with new slot - student_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 16) + student_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 16) UserMailer.deliveries.clear lesson_session.counter({proposer: user, slot: student_countered_slot, message: 'Does this work better?'}) lesson_session.errors.any?.should be false @@ -586,7 +586,7 @@ describe "Normal Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -713,7 +713,7 @@ describe "Normal Lesson Flow" do booking.status.should eql LessonBooking::STATUS_REQUESTED ######### Teacher counters with new slot - teacher_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 14) + teacher_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 14) UserMailer.deliveries.clear lesson_session.counter({proposer: teacher_user, slot: teacher_countered_slot, message: 'Does this work?'}) booking.reload @@ -738,7 +738,7 @@ describe "Normal Lesson Flow" do notification.description.should eql NotificationTypes::LESSON_MESSAGE ######### Student counters with new slot - student_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 16) + student_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 16) UserMailer.deliveries.clear lesson_session.counter({proposer: user, slot: student_countered_slot, message: 'Does this work better?'}) lesson_session.errors.any?.should be false @@ -789,7 +789,7 @@ describe "Normal Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -916,7 +916,7 @@ describe "Normal Lesson Flow" do booking.status.should eql LessonBooking::STATUS_REQUESTED ######### Teacher counters with new slot - teacher_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 14) + teacher_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 14) UserMailer.deliveries.clear lesson_session.counter({proposer: teacher_user, slot: teacher_countered_slot, message: 'Does this work?'}) booking.reload @@ -941,7 +941,7 @@ describe "Normal Lesson Flow" do notification.description.should eql NotificationTypes::LESSON_MESSAGE ######### Student counters with new slot - student_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 16) + student_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 16) UserMailer.deliveries.clear lesson_session.counter({proposer: user, slot: student_countered_slot, message: 'Does this work better?'}) lesson_session.errors.any?.should be false @@ -992,7 +992,7 @@ describe "Normal Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -1137,7 +1137,7 @@ describe "Normal Lesson Flow" do booking.status.should eql LessonBooking::STATUS_REQUESTED ######### Teacher counters with new slot - teacher_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 14) + teacher_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 14) UserMailer.deliveries.clear lesson_session.counter({proposer: teacher_user, slot: teacher_countered_slot, message: 'Does this work?'}) booking.reload @@ -1162,7 +1162,7 @@ describe "Normal Lesson Flow" do notification.description.should eql NotificationTypes::LESSON_MESSAGE ######### Student counters with new slot - student_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 16) + student_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 16) UserMailer.deliveries.clear lesson_session.counter({proposer: user, slot: student_countered_slot, message: 'Does this work better?'}) lesson_session.errors.any?.should be false @@ -1213,7 +1213,7 @@ describe "Normal Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! diff --git a/ruby/spec/jam_ruby/flows/recurring_lesson_spec.rb b/ruby/spec/jam_ruby/flows/recurring_lesson_spec.rb index 0b3c683eb..d998a12b2 100644 --- a/ruby/spec/jam_ruby/flows/recurring_lesson_spec.rb +++ b/ruby/spec/jam_ruby/flows/recurring_lesson_spec.rb @@ -3,14 +3,14 @@ require 'spec_helper' describe "Recurring Lesson Flow" do - let(:user) { FactoryGirl.create(:user, remaining_test_drives: 0) } + let(:user) { FactoryBot.create(:user, remaining_test_drives: 0) } - let(:teacher_user) { FactoryGirl.create(:teacher_user) } + let(:teacher_user) { FactoryBot.create(:teacher_user) } let(:teacher) { teacher_user.teacher } - let(:lesson_booking_slot_single1) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_single2) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_recurring1) { FactoryGirl.build(:lesson_booking_slot_recurring, day_of_week: 2.days.from_now.wday) } - let(:lesson_booking_slot_recurring2) { FactoryGirl.build(:lesson_booking_slot_recurring, day_of_week: 3.days.from_now.wday) } + let(:lesson_booking_slot_single1) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_single2) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_recurring1) { FactoryBot.build(:lesson_booking_slot_recurring, day_of_week: 2.days.from_now.wday) } + let(:lesson_booking_slot_recurring2) { FactoryBot.build(:lesson_booking_slot_recurring, day_of_week: 3.days.from_now.wday) } let(:valid_single_slots) { [lesson_booking_slot_single1, lesson_booking_slot_single2] } let(:valid_recurring_slots) { [lesson_booking_slot_recurring1, lesson_booking_slot_recurring2] } @@ -56,7 +56,7 @@ describe "Recurring Lesson Flow" do booking.status.should eql LessonBooking::STATUS_REQUESTED ######### Teacher counters with new slot - teacher_countered_slot = FactoryGirl.build(:lesson_booking_slot_recurring, hour: 14, update_all: true) + teacher_countered_slot = FactoryBot.build(:lesson_booking_slot_recurring, hour: 14, update_all: true) UserMailer.deliveries.clear booking.counter_slot.should be_nil lesson_session1.counter({proposer: teacher_user, slot: teacher_countered_slot, message: 'Does this work?'}) @@ -83,7 +83,7 @@ describe "Recurring Lesson Flow" do #notification.message.should eql "Instructor has proposed a different time for your lesson." ######### Student counters with new slot - student_countered_slot = FactoryGirl.build(:lesson_booking_slot_recurring, hour: 16, update_all: true, day_of_week: 2.days.from_now.wday) + student_countered_slot = FactoryBot.build(:lesson_booking_slot_recurring, hour: 16, update_all: true, day_of_week: 2.days.from_now.wday) UserMailer.deliveries.clear lesson_session1.counter({proposer: user, slot: student_countered_slot, message: 'Does this work better?'}) lesson_session1.errors.any?.should be false @@ -148,7 +148,7 @@ describe "Recurring Lesson Flow" do # teacher & student get into session start = lesson_session1.scheduled_start end_time = lesson_session1.scheduled_start + (60 * lesson_session1.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session1.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session1.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session1.music_session.session_removed_at = end_time lesson_session1.music_session.save! diff --git a/ruby/spec/jam_ruby/flows/testdrive_lesson_spec.rb b/ruby/spec/jam_ruby/flows/testdrive_lesson_spec.rb index 0b8bb8035..82a16de48 100644 --- a/ruby/spec/jam_ruby/flows/testdrive_lesson_spec.rb +++ b/ruby/spec/jam_ruby/flows/testdrive_lesson_spec.rb @@ -4,22 +4,22 @@ require 'spec_helper' describe "TestDrive Lesson Flow" do - let(:user) { FactoryGirl.create(:user, remaining_test_drives: 0) } + let(:user) { FactoryBot.create(:user, remaining_test_drives: 0) } - let(:teacher_user) { FactoryGirl.create(:teacher_user) } - let(:teacher_user2) { FactoryGirl.create(:teacher_user) } + let(:teacher_user) { FactoryBot.create(:teacher_user) } + let(:teacher_user2) { FactoryBot.create(:teacher_user) } let(:teacher) { teacher_user.teacher } - let(:lesson_booking_slot_single1) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_single2) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_recurring1) { FactoryGirl.build(:lesson_booking_slot_recurring) } - let(:lesson_booking_slot_recurring2) { FactoryGirl.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_single1) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_single2) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_recurring1) { FactoryBot.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_recurring2) { FactoryBot.build(:lesson_booking_slot_recurring) } let(:valid_single_slots) { [lesson_booking_slot_single1, lesson_booking_slot_single2] } let(:valid_recurring_slots) { [lesson_booking_slot_recurring1, lesson_booking_slot_recurring2] } - let(:affiliate_partner) { FactoryGirl.create(:affiliate_partner) } - let(:affiliate_partner2) { FactoryGirl.create(:affiliate_partner, lesson_rate: 0.30) } - let(:school) { FactoryGirl.create(:school) } - let(:card_lessons) {FactoryGirl.create(:posa_card_lesson_4)} - let(:retailer) {FactoryGirl.create(:retailer)} + let(:affiliate_partner) { FactoryBot.create(:affiliate_partner) } + let(:affiliate_partner2) { FactoryBot.create(:affiliate_partner, lesson_rate: 0.30) } + let(:school) { FactoryBot.create(:school) } + let(:card_lessons) {FactoryBot.create(:posa_card_lesson_4)} + let(:retailer) {FactoryBot.create(:retailer)} before { teacher.stripe_account_id = stripe_account1_id @@ -93,7 +93,7 @@ describe "TestDrive Lesson Flow" do booking.status.should eql LessonBooking::STATUS_REQUESTED ######### Teacher counters with new slot - teacher_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 14) + teacher_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 14) UserMailer.deliveries.clear lesson_session.counter({proposer: teacher_user, slot: teacher_countered_slot, message: 'Does this work?'}) booking.reload @@ -118,7 +118,7 @@ describe "TestDrive Lesson Flow" do notification.description.should eql NotificationTypes::LESSON_MESSAGE ######### Student counters with new slot - student_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 16) + student_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 16) UserMailer.deliveries.clear lesson_session.counter({proposer: user, slot: student_countered_slot, message: 'Does this work better?'}) lesson_session.errors.any?.should be false @@ -170,7 +170,7 @@ describe "TestDrive Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -298,7 +298,7 @@ describe "TestDrive Lesson Flow" do booking.status.should eql LessonBooking::STATUS_REQUESTED ######### Teacher counters with new slot - teacher_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 14) + teacher_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 14) UserMailer.deliveries.clear lesson_session.counter({proposer: teacher_user, slot: teacher_countered_slot, message: 'Does this work?'}) booking.reload @@ -323,7 +323,7 @@ describe "TestDrive Lesson Flow" do notification.description.should eql NotificationTypes::LESSON_MESSAGE ######### Student counters with new slot - student_countered_slot = FactoryGirl.build(:lesson_booking_slot_single, hour: 16) + student_countered_slot = FactoryBot.build(:lesson_booking_slot_single, hour: 16) UserMailer.deliveries.clear lesson_session.counter({proposer: user, slot: student_countered_slot, message: 'Does this work better?'}) lesson_session.errors.any?.should be false @@ -375,7 +375,7 @@ describe "TestDrive Lesson Flow" do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -464,8 +464,8 @@ describe "TestDrive Lesson Flow" do it "cancels with no credit card" do slots = [] - slots << FactoryGirl.build(:lesson_booking_slot_single) - slots << FactoryGirl.build(:lesson_booking_slot_single) + slots << FactoryBot.build(:lesson_booking_slot_single) + slots << FactoryBot.build(:lesson_booking_slot_single) booking = LessonBooking.book_test_drive(user, teacher_user, slots, "Hey I've heard of you before.") diff --git a/ruby/spec/jam_ruby/jam_track_importer_spec.rb b/ruby/spec/jam_ruby/jam_track_importer_spec.rb index c578b98f0..d9f023d3b 100644 --- a/ruby/spec/jam_ruby/jam_track_importer_spec.rb +++ b/ruby/spec/jam_ruby/jam_track_importer_spec.rb @@ -49,7 +49,7 @@ describe JamTrackImporter do end describe "sort_tracks" do - let(:jam_track) { FactoryGirl.create(:jam_track) } + let(:jam_track) { FactoryBot.create(:jam_track) } let(:importer) { JamTrackImporter.new() } let(:vocal) {Instrument.find('voice')} let(:drums) {Instrument.find('drums')} @@ -62,40 +62,40 @@ describe JamTrackImporter do it "the big sort" do # specified in https://jamkazam.atlassian.net/browse/VRFS-3296 - vocal_lead = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Lead') - vocal_lead_female = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Lead Female') - vocal_lead_male = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Lead Male') - vocal_backing = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Backing') - vocal_random = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Random') - drums_drums = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'Drums') - drums_percussion = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'Percussion') - drums_random_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'A') - drums_random_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'C') - bass_guitar_bass = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: bass_guitar, part: 'Bass') - bass_guitar_random_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: bass_guitar, part: 'some bass') - bass_guitar_random_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: bass_guitar, part: 'zome bass') - piano_piano = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: piano, part: 'Piano') - keyboard_synth_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Synth 1') - keyboard_synth_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Synth 2') - keyboard_pads = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Pads') - keyboard_random_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'A') - keyboard_random_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Z') - acoust_guitar_lead = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Lead') - acoust_guitar_lead_x = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Lead X') - acoust_guitar_solo_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Solo 1') - acoust_guitar_solo_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Solo 2') - acoust_guitar_rhythm = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Rhythm') - acoust_guitar_random_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'A') - acoust_guitar_random_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Z') - elect_guitar_lead = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Lead') - elect_guitar_lead_x = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Lead X') - elect_guitar_solo_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Solo 1') - elect_guitar_solo_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Solo 2') - elect_guitar_rhythm = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Rhythm') - elect_guitar_random_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'A') - elect_guitar_random_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Z') - other_1 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: other, part: 'Other 1') - other_2 = FactoryGirl.build(:jam_track_track, jam_track: jam_track, instrument: other, part: 'Other 2') + vocal_lead = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Lead') + vocal_lead_female = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Lead Female') + vocal_lead_male = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Lead Male') + vocal_backing = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Backing') + vocal_random = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: vocal, part: 'Random') + drums_drums = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'Drums') + drums_percussion = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'Percussion') + drums_random_1 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'A') + drums_random_2 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: drums, part: 'C') + bass_guitar_bass = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: bass_guitar, part: 'Bass') + bass_guitar_random_1 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: bass_guitar, part: 'some bass') + bass_guitar_random_2 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: bass_guitar, part: 'zome bass') + piano_piano = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: piano, part: 'Piano') + keyboard_synth_1 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Synth 1') + keyboard_synth_2 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Synth 2') + keyboard_pads = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Pads') + keyboard_random_1 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'A') + keyboard_random_2 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: keyboard, part: 'Z') + acoust_guitar_lead = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Lead') + acoust_guitar_lead_x = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Lead X') + acoust_guitar_solo_1 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Solo 1') + acoust_guitar_solo_2 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Solo 2') + acoust_guitar_rhythm = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Rhythm') + acoust_guitar_random_1 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'A') + acoust_guitar_random_2 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: acoustic_guitar, part: 'Z') + elect_guitar_lead = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Lead') + elect_guitar_lead_x = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Lead X') + elect_guitar_solo_1 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Solo 1') + elect_guitar_solo_2 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Solo 2') + elect_guitar_rhythm = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Rhythm') + elect_guitar_random_1 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'A') + elect_guitar_random_2 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: electric_guitar, part: 'Z') + other_1 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: other, part: 'Other 1') + other_2 = FactoryBot.build(:jam_track_track, jam_track: jam_track, instrument: other, part: 'Other 2') expected = [ vocal_lead, diff --git a/ruby/spec/jam_ruby/lib/elasticsearch_spec.rb b/ruby/spec/jam_ruby/lib/elasticsearch_spec.rb index d39471e7a..cadc42d79 100644 --- a/ruby/spec/jam_ruby/lib/elasticsearch_spec.rb +++ b/ruby/spec/jam_ruby/lib/elasticsearch_spec.rb @@ -474,14 +474,14 @@ string = %{ } describe "Elasticsearch"do - let(:me) { FactoryGirl.create(:user, email: 'estest@jamkazam.com') } - let(:user1) { FactoryGirl.create(:user) } - let(:connection1) { FactoryGirl.create(:connection, :user => user1) } - let(:user2) { FactoryGirl.create(:user) } - let(:connection2) { FactoryGirl.create(:connection, :user => user2) } - let(:user3) { FactoryGirl.create(:user) } - let(:connection3) { FactoryGirl.create(:connection, :user => user3) } - let(:music_session) { FactoryGirl.create(:music_session) } + let(:me) { FactoryBot.create(:user, email: 'estest@jamkazam.com') } + let(:user1) { FactoryBot.create(:user) } + let(:connection1) { FactoryBot.create(:connection, :user => user1) } + let(:user2) { FactoryBot.create(:user) } + let(:connection2) { FactoryBot.create(:connection, :user => user2) } + let(:user3) { FactoryBot.create(:user) } + let(:connection3) { FactoryBot.create(:connection, :user => user3) } + let(:music_session) { FactoryBot.create(:music_session) } it "should save to index" do diff --git a/ruby/spec/jam_ruby/lib/email_new_musician_match_spec.rb b/ruby/spec/jam_ruby/lib/email_new_musician_match_spec.rb index 5ce5de145..941053dd3 100644 --- a/ruby/spec/jam_ruby/lib/email_new_musician_match_spec.rb +++ b/ruby/spec/jam_ruby/lib/email_new_musician_match_spec.rb @@ -1,16 +1,16 @@ require 'spec_helper' describe EmailNewMusicianMatch do - let(:user1) { FactoryGirl.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } - let(:user2) { FactoryGirl.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } - let(:user3) { FactoryGirl.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } - let(:user4) { FactoryGirl.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } - let(:user5) { FactoryGirl.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } - let(:user6) { FactoryGirl.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } - let(:user7) { FactoryGirl.create(:user, subscribe_email: false, user_match_email_sent_at: 7.days.ago) } - let(:user8) { FactoryGirl.create(:user, subscribe_email: false, subscribe_email_for_user_match: false, user_match_email_sent_at: 7.days.ago) } - let(:user9) { FactoryGirl.create(:user, email: 'seth@jamkazam.com', subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } #a priority user - let(:user10) { FactoryGirl.create(:user, email: 'david@jamkazam.com', subscribe_email: false) } #a priority user. but not included as he has marked not to receive email notifications + let(:user1) { FactoryBot.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } + let(:user2) { FactoryBot.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } + let(:user3) { FactoryBot.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } + let(:user4) { FactoryBot.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } + let(:user5) { FactoryBot.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } + let(:user6) { FactoryBot.create(:user, subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } + let(:user7) { FactoryBot.create(:user, subscribe_email: false, user_match_email_sent_at: 7.days.ago) } + let(:user8) { FactoryBot.create(:user, subscribe_email: false, subscribe_email_for_user_match: false, user_match_email_sent_at: 7.days.ago) } + let(:user9) { FactoryBot.create(:user, email: 'seth@jamkazam.com', subscribe_email: true, subscribe_email_for_user_match: true, user_match_email_sent_at: 7.days.ago) } #a priority user + let(:user10) { FactoryBot.create(:user, email: 'david@jamkazam.com', subscribe_email: false) } #a priority user. but not included as he has marked not to receive email notifications let(:search_result){ [[user1, user2, user3, user4, user5], [user6, user7, user8, user9, user10] ] } diff --git a/ruby/spec/jam_ruby/lib/musician_filter_spec.rb b/ruby/spec/jam_ruby/lib/musician_filter_spec.rb index 5dfdc71b7..239be9821 100644 --- a/ruby/spec/jam_ruby/lib/musician_filter_spec.rb +++ b/ruby/spec/jam_ruby/lib/musician_filter_spec.rb @@ -3,17 +3,17 @@ require 'webmock/rspec' describe MusicianFilter do let(:latency_data_uri) { /\S+\/search_users/ } - let(:user) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } let(:remote_ip) { "127.0.0.1" } - let(:user1) { FactoryGirl.create(:user) } - let(:user2) { FactoryGirl.create(:user) } - let(:user3) { FactoryGirl.create(:user) } - let(:user4) { FactoryGirl.create(:user) } - let(:user5) { FactoryGirl.create(:user) } - let(:user6) { FactoryGirl.create(:user) } - let(:user7) { FactoryGirl.create(:user) } - let(:user8) { FactoryGirl.create(:user) } + let(:user1) { FactoryBot.create(:user) } + let(:user2) { FactoryBot.create(:user) } + let(:user3) { FactoryBot.create(:user) } + let(:user4) { FactoryBot.create(:user) } + let(:user5) { FactoryBot.create(:user) } + let(:user6) { FactoryBot.create(:user) } + let(:user7) { FactoryBot.create(:user) } + let(:user8) { FactoryBot.create(:user) } let(:response_body) { mock_latency_response([ { user: user1, ars_total_latency: 1.0, ars_internet_latency: 0.4, audio_latency: 0.6 }, #GOOD diff --git a/ruby/spec/jam_ruby/lib/trail_expires_reminder_spec.rb b/ruby/spec/jam_ruby/lib/trail_expires_reminder_spec.rb index 27d395606..ed68ac22a 100644 --- a/ruby/spec/jam_ruby/lib/trail_expires_reminder_spec.rb +++ b/ruby/spec/jam_ruby/lib/trail_expires_reminder_spec.rb @@ -1,9 +1,9 @@ require "spec_helper" describe TrialExpiresReminder do - let(:user1) { FactoryGirl.create(:user) } - let(:user2) { FactoryGirl.create(:user) } - let(:user3) { FactoryGirl.create(:user) } + let(:user1) { FactoryBot.create(:user) } + let(:user2) { FactoryBot.create(:user) } + let(:user3) { FactoryBot.create(:user) } before(:each) do ActionMailer::Base.delivery_method = :test diff --git a/ruby/spec/jam_ruby/models/active_music_session_spec.rb b/ruby/spec/jam_ruby/models/active_music_session_spec.rb index 29d9d32ca..db790b633 100644 --- a/ruby/spec/jam_ruby/models/active_music_session_spec.rb +++ b/ruby/spec/jam_ruby/models/active_music_session_spec.rb @@ -12,10 +12,10 @@ describe ActiveMusicSession do describe "participant_create" do - let(:user) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } it "fails gracefully when no connection" do - music_session = FactoryGirl.create(:active_music_session, :creator => user, :musician_access => false) + music_session = FactoryBot.create(:active_music_session, :creator => user, :musician_access => false) begin ActiveMusicSession.participant_create(user, music_session.id, "junk", true, nil, 5) @@ -28,31 +28,31 @@ describe ActiveMusicSession do end it "succeeds no active music session" do - music_session = FactoryGirl.create(:music_session, :creator => user, :musician_access => false) - conn = FactoryGirl.create(:connection, :user => user) + music_session = FactoryBot.create(:music_session, :creator => user, :musician_access => false) + conn = FactoryBot.create(:connection, :user => user) connection = ActiveMusicSession.participant_create(user, music_session.id, conn.client_id, true, nil, 5) connection.errors.any?.should be false ActiveMusicSession.find(music_session.id) end it "fails gracefully when invalid music session Id" do - music_session = FactoryGirl.create(:active_music_session, :creator => user, :musician_access => false) - conn = FactoryGirl.create(:connection, :user => user) + music_session = FactoryBot.create(:active_music_session, :creator => user, :musician_access => false) + conn = FactoryBot.create(:connection, :user => user) expect { ActiveMusicSession.participant_create(user, 'bad music session ID', conn.client_id, true, nil, 5) }.to raise_error(ActiveRecord::RecordNotFound) end it "pulls out of other session" do - music_session1 = FactoryGirl.create(:active_music_session, :creator => user, :musician_access => false) - music_session2 = FactoryGirl.create(:active_music_session, :creator => user, :musician_access => false) - conn = FactoryGirl.create(:connection, :user => user, music_session: music_session2) + music_session1 = FactoryBot.create(:active_music_session, :creator => user, :musician_access => false) + music_session2 = FactoryBot.create(:active_music_session, :creator => user, :musician_access => false) + conn = FactoryBot.create(:connection, :user => user, music_session: music_session2) connection = ActiveMusicSession.participant_create(user, music_session1.id, conn.client_id, true, nil, 5) connection.should eql conn connection.errors.any?.should be true end it "user-less connection bails appropriately" do - music_session1 = FactoryGirl.create(:active_music_session, :creator => user, :musician_access => false) - conn = FactoryGirl.create(:connection) + music_session1 = FactoryBot.create(:active_music_session, :creator => user, :musician_access => false) + conn = FactoryBot.create(:connection) ActiveRecord::Base.connection.execute("update connections set user_id = NULL where connections.id = '#{conn.id}'") expect { ActiveMusicSession.participant_create(user, music_session1.id, conn.client_id, true, nil, 5) }.to raise_error(JamRuby::JamPermissionError) end @@ -60,13 +60,13 @@ describe ActiveMusicSession do it 'can grant access to valid user' do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session - user3 = FactoryGirl.create(:user) # not in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session + user3 = FactoryBot.create(:user) # not in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1, :musician_access => false) - FactoryGirl.create(:connection, :user => user1, :music_session => music_session) - FactoryGirl.create(:connection, :user => user2, :music_session => music_session) + music_session = FactoryBot.create(:active_music_session, :creator => user1, :musician_access => false) + FactoryBot.create(:connection, :user => user1, :music_session => music_session) + FactoryBot.create(:connection, :user => user2, :music_session => music_session) music_session.access?(user1).should == true @@ -76,11 +76,11 @@ describe ActiveMusicSession do it 'anyone can join a open music session' do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session - user3 = FactoryGirl.create(:user) # not in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session + user3 = FactoryBot.create(:user) # not in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1, :musician_access => true) + music_session = FactoryBot.create(:active_music_session, :creator => user1, :musician_access => true) music_session.can_join?(user1, true).should == true music_session.can_join?(user2, true).should == true @@ -88,21 +88,21 @@ describe ActiveMusicSession do end it 'no one but invited people can join closed music session' do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session - user3 = FactoryGirl.create(:user) # not in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session + user3 = FactoryBot.create(:user) # not in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1, :musician_access => false) - FactoryGirl.create(:connection, :user => user1, :music_session => music_session) + music_session = FactoryBot.create(:active_music_session, :creator => user1, :musician_access => false) + FactoryBot.create(:connection, :user => user1, :music_session => music_session) music_session.can_join?(user1, true).should == true music_session.can_join?(user2, true).should == false music_session.can_join?(user3, true).should == false # invite user 2 - FactoryGirl.create(:friendship, :user => user1, :friend => user2) - FactoryGirl.create(:friendship, :user => user2, :friend => user1) - FactoryGirl.create(:invitation, :sender => user1, :receiver => user2, :music_session => music_session.music_session) + FactoryBot.create(:friendship, :user => user1, :friend => user2) + FactoryBot.create(:friendship, :user => user2, :friend => user1) + FactoryBot.create(:invitation, :sender => user1, :receiver => user2, :music_session => music_session.music_session) music_session.can_join?(user1, true).should == true music_session.can_join?(user2, true).should == true @@ -110,21 +110,21 @@ describe ActiveMusicSession do end it 'no one but invited people can see closed music session' do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session - user3 = FactoryGirl.create(:user) # not in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session + user3 = FactoryBot.create(:user) # not in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1, :musician_access => false, :fan_access => false) - FactoryGirl.create(:connection, :user => user1, :music_session => music_session) + music_session = FactoryBot.create(:active_music_session, :creator => user1, :musician_access => false, :fan_access => false) + FactoryBot.create(:connection, :user => user1, :music_session => music_session) music_session.can_see?(user1).should == true music_session.can_see?(user2).should == false music_session.can_see?(user3).should == false # invite user 2 - FactoryGirl.create(:friendship, :user => user1, :friend => user2) - FactoryGirl.create(:friendship, :user => user2, :friend => user1) - FactoryGirl.create(:invitation, :sender => user1, :receiver => user2, :music_session => music_session.music_session) + FactoryBot.create(:friendship, :user => user1, :friend => user2) + FactoryBot.create(:friendship, :user => user2, :friend => user1) + FactoryBot.create(:invitation, :sender => user1, :receiver => user2, :music_session => music_session.music_session) music_session.can_see?(user1).should == true music_session.can_see?(user2).should == true @@ -133,16 +133,16 @@ describe ActiveMusicSession do describe "index" do it "orders two sessions by created_at starting with most recent" do - creator = FactoryGirl.create(:user) - creator2 = FactoryGirl.create(:user) + creator = FactoryBot.create(:user) + creator2 = FactoryBot.create(:user) - earlier_session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Earlier Session") - FactoryGirl.create(:connection, :user => creator, :music_session => earlier_session) + earlier_session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Earlier Session") + FactoryBot.create(:connection, :user => creator, :music_session => earlier_session) - later_session = FactoryGirl.create(:active_music_session, :creator => creator2, :description => "Later Session") - FactoryGirl.create(:connection, :user => creator2, :music_session => later_session) + later_session = FactoryBot.create(:active_music_session, :creator => creator2, :description => "Later Session") + FactoryBot.create(:connection, :user => creator2, :music_session => later_session) - user = FactoryGirl.create(:user) + user = FactoryBot.create(:user) #ActiveRecord::Base.logger = Logger.new(STDOUT) music_sessions = ActiveMusicSession.index(user) @@ -151,18 +151,18 @@ describe ActiveMusicSession do end it "orders sessions with inviteds first, even if created first" do - creator1 = FactoryGirl.create(:user) - creator2 = FactoryGirl.create(:user) + creator1 = FactoryBot.create(:user) + creator2 = FactoryBot.create(:user) - earlier_session = FactoryGirl.create(:active_music_session, :creator => creator1, :description => "Earlier Session") - FactoryGirl.create(:connection, :user => creator1, :music_session => earlier_session) - later_session = FactoryGirl.create(:active_music_session, :creator => creator2, :description => "Later Session") - FactoryGirl.create(:connection, :user => creator2, :music_session => later_session) - user = FactoryGirl.create(:user) - FactoryGirl.create(:connection, :user => creator1, :music_session => earlier_session) - FactoryGirl.create(:friendship, :user => creator1, :friend => user) - FactoryGirl.create(:friendship, :user => user, :friend => creator1) - FactoryGirl.create(:invitation, :sender => creator1, :receiver => user, :music_session => earlier_session.music_session) + earlier_session = FactoryBot.create(:active_music_session, :creator => creator1, :description => "Earlier Session") + FactoryBot.create(:connection, :user => creator1, :music_session => earlier_session) + later_session = FactoryBot.create(:active_music_session, :creator => creator2, :description => "Later Session") + FactoryBot.create(:connection, :user => creator2, :music_session => later_session) + user = FactoryBot.create(:user) + FactoryBot.create(:connection, :user => creator1, :music_session => earlier_session) + FactoryBot.create(:friendship, :user => creator1, :friend => user) + FactoryBot.create(:friendship, :user => user, :friend => creator1) + FactoryBot.create(:invitation, :sender => creator1, :receiver => user, :music_session => earlier_session.music_session) music_sessions = ActiveMusicSession.index(user) music_sessions.length.should == 2 @@ -172,18 +172,18 @@ describe ActiveMusicSession do it "orders sessions with friends in the session first, even if created first" do - creator1 = FactoryGirl.create(:user) - creator2 = FactoryGirl.create(:user) - earlier_session = FactoryGirl.create(:active_music_session, :creator => creator1, :description => "Earlier Session") - FactoryGirl.create(:connection, :user => creator1, :music_session => earlier_session) - later_session = FactoryGirl.create(:active_music_session, :creator => creator2, :description => "Later Session") - FactoryGirl.create(:connection, :user => creator2, :music_session => later_session) + creator1 = FactoryBot.create(:user) + creator2 = FactoryBot.create(:user) + earlier_session = FactoryBot.create(:active_music_session, :creator => creator1, :description => "Earlier Session") + FactoryBot.create(:connection, :user => creator1, :music_session => earlier_session) + later_session = FactoryBot.create(:active_music_session, :creator => creator2, :description => "Later Session") + FactoryBot.create(:connection, :user => creator2, :music_session => later_session) - user = FactoryGirl.create(:user) - FactoryGirl.create(:friendship, :user => creator1, :friend => user) - FactoryGirl.create(:friendship, :user => user, :friend => creator1) - FactoryGirl.create(:connection, :user => creator1, :music_session => earlier_session) - FactoryGirl.create(:connection, :user => creator2, :music_session => earlier_session) + user = FactoryBot.create(:user) + FactoryBot.create(:friendship, :user => creator1, :friend => user) + FactoryBot.create(:friendship, :user => user, :friend => creator1) + FactoryBot.create(:connection, :user => creator1, :music_session => earlier_session) + FactoryBot.create(:connection, :user => creator2, :music_session => earlier_session) music_sessions = ActiveMusicSession.index(user) music_sessions.length.should == 2 @@ -191,65 +191,65 @@ describe ActiveMusicSession do end it "doesn't list a session if musician_access is set to false" do - creator = FactoryGirl.create(:user) - session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Session", :musician_access => false) - user = FactoryGirl.create(:user) + creator = FactoryBot.create(:user) + session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Session", :musician_access => false) + user = FactoryBot.create(:user) music_sessions = ActiveMusicSession.index(user) music_sessions.length.should == 0 end it "does list a session if musician_access is set to false but user was invited" do - creator = FactoryGirl.create(:user) - session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Session", :musician_access => false) - user = FactoryGirl.create(:user) - FactoryGirl.create(:connection, :user => creator, :music_session => session) - FactoryGirl.create(:friendship, :user => creator, :friend => user) - FactoryGirl.create(:friendship, :user => user, :friend => creator) - FactoryGirl.create(:invitation, :sender => creator, :receiver => user, :music_session => session.music_session) + creator = FactoryBot.create(:user) + session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Session", :musician_access => false) + user = FactoryBot.create(:user) + FactoryBot.create(:connection, :user => creator, :music_session => session) + FactoryBot.create(:friendship, :user => creator, :friend => user) + FactoryBot.create(:friendship, :user => user, :friend => creator) + FactoryBot.create(:invitation, :sender => creator, :receiver => user, :music_session => session.music_session) music_sessions = ActiveMusicSession.index(user) music_sessions.length.should == 1 end it "lists a session if the genre matches" do - creator = FactoryGirl.create(:user) - genre = FactoryGirl.create(:genre) - session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Session", :genre => genre) - FactoryGirl.create(:connection, :user => creator, :music_session => session) - user = FactoryGirl.create(:user) + creator = FactoryBot.create(:user) + genre = FactoryBot.create(:genre) + session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Session", :genre => genre) + FactoryBot.create(:connection, :user => creator, :music_session => session) + user = FactoryBot.create(:user) music_sessions = ActiveMusicSession.index(user, genres: [genre.id]) music_sessions.length.should == 1 end it "does not list a session if the genre fails to match" do - creator = FactoryGirl.create(:user) - genre1 = FactoryGirl.create(:genre) - genre2 = FactoryGirl.create(:genre) - session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Session", :genre => genre1) - user = FactoryGirl.create(:user) + creator = FactoryBot.create(:user) + genre1 = FactoryBot.create(:genre) + genre2 = FactoryBot.create(:genre) + session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Session", :genre => genre1) + user = FactoryBot.create(:user) music_sessions = ActiveMusicSession.index(user, genres: [genre2.id]) music_sessions.length.should == 0 end it "does not list a session if friends_only is set and no friends are in it" do - creator = FactoryGirl.create(:user) - session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Session") - user = FactoryGirl.create(:user) + creator = FactoryBot.create(:user) + session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Session") + user = FactoryBot.create(:user) music_sessions = ActiveMusicSession.index(user, friends_only: true) music_sessions.length.should == 0 end it "lists a session properly if a friend is in it" do - creator = FactoryGirl.create(:user) - session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Session") - user = FactoryGirl.create(:user) - FactoryGirl.create(:friendship, :user => creator, :friend => user) - FactoryGirl.create(:friendship, :user => user, :friend => creator) - FactoryGirl.create(:connection, :user => creator, :music_session => session) + creator = FactoryBot.create(:user) + session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Session") + user = FactoryBot.create(:user) + FactoryBot.create(:friendship, :user => creator, :friend => user) + FactoryBot.create(:friendship, :user => user, :friend => creator) + FactoryBot.create(:connection, :user => creator, :music_session => session) music_sessions = ActiveMusicSession.index(user) music_sessions.length.should == 1 @@ -265,8 +265,8 @@ describe ActiveMusicSession do # it's a design goal that there should be no sessions with 0 connections; # however, this bug continually crops up so the .index method will protect against this common bug - creator = FactoryGirl.create(:user) - session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Session") + creator = FactoryBot.create(:user) + session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Session") session.connections.delete_all # should leave a bogus, 0 participant session around music_sessions = ActiveMusicSession.index(creator) @@ -275,22 +275,22 @@ describe ActiveMusicSession do end it "does not list a session if my_bands_only is set and it's not my band" do - creator = FactoryGirl.create(:user) - session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Session") - user = FactoryGirl.create(:user) + creator = FactoryBot.create(:user) + session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Session") + user = FactoryBot.create(:user) music_sessions = ActiveMusicSession.index(user, friends_only: false, my_bands_only: true) music_sessions.length.should == 0 end it "lists a session properly if it's my band's session" do - band = FactoryGirl.create(:band) - creator = FactoryGirl.create(:user) - session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Session", :band => band) - FactoryGirl.create(:connection, :user => creator, :music_session => session) - user = FactoryGirl.create(:user) - FactoryGirl.create(:band_musician, :band => band, :user => creator) - FactoryGirl.create(:band_musician, :band => band, :user => user) + band = FactoryBot.create(:band) + creator = FactoryBot.create(:user) + session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Session", :band => band) + FactoryBot.create(:connection, :user => creator, :music_session => session) + user = FactoryBot.create(:user) + FactoryBot.create(:band_musician, :band => band, :user => creator) + FactoryBot.create(:band_musician, :band => band, :user => user) music_sessions = ActiveMusicSession.index(user) music_sessions.length.should == 1 @@ -304,11 +304,11 @@ describe ActiveMusicSession do describe "index(as_musician: false)" do let(:fan_access) { true } - let(:creator) { FactoryGirl.create(:user) } - let(:session) { FactoryGirl.create(:active_music_session, creator: creator, fan_access: fan_access) } - let(:connection) { FactoryGirl.create(:connection, user: creator, :music_session => session) } + let(:creator) { FactoryBot.create(:user) } + let(:session) { FactoryBot.create(:active_music_session, creator: creator, fan_access: fan_access) } + let(:connection) { FactoryBot.create(:connection, user: creator, :music_session => session) } - let(:user) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } describe "no mount" do @@ -324,8 +324,8 @@ describe ActiveMusicSession do end describe "with mount" do - let(:session_with_mount) { FactoryGirl.create(:active_music_session_with_mount) } - let(:connection_with_mount) { FactoryGirl.create(:connection, user: creator, :music_session => session_with_mount) } + let(:session_with_mount) { FactoryBot.create(:active_music_session_with_mount) } + let(:connection_with_mount) { FactoryBot.create(:connection, user: creator, :music_session => session_with_mount) } before(:each) { @@ -354,17 +354,17 @@ describe ActiveMusicSession do describe "nindex" do it "nindex orders two sessions by created_at starting with most recent" do - creator = FactoryGirl.create(:user) - creator2 = FactoryGirl.create(:user) + creator = FactoryBot.create(:user) + creator2 = FactoryBot.create(:user) - earlier_session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Earlier Session") - c1 = FactoryGirl.create(:connection, user: creator, music_session: earlier_session, addr: 0x01020304, locidispid: 1) + earlier_session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Earlier Session") + c1 = FactoryBot.create(:connection, user: creator, music_session: earlier_session, addr: 0x01020304, locidispid: 1) - later_session = FactoryGirl.create(:active_music_session, :creator => creator2, :description => "Later Session") - c2 = FactoryGirl.create(:connection, user: creator2, music_session: later_session, addr: 0x21020304, locidispid: 2) + later_session = FactoryBot.create(:active_music_session, :creator => creator2, :description => "Later Session") + c2 = FactoryBot.create(:connection, user: creator2, music_session: later_session, addr: 0x21020304, locidispid: 2) - user = FactoryGirl.create(:user) - c3 = FactoryGirl.create(:connection, user: user, locidispid: 3) + user = FactoryBot.create(:user) + c3 = FactoryBot.create(:connection, user: user, locidispid: 3) Score.createx(c1.locidispid, c1.client_id, c1.addr, c3.locidispid, c3.client_id, c3.addr, 20, nil); Score.createx(c2.locidispid, c2.client_id, c2.addr, c3.locidispid, c3.client_id, c3.addr, 30, nil); @@ -393,11 +393,11 @@ describe ActiveMusicSession do describe "public index", no_transaction: false do it "public_index" do - creator = FactoryGirl.create(:user) - creator2 = FactoryGirl.create(:user) - earlier_session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Earlier Session") - later_session = FactoryGirl.create(:active_music_session, :creator => creator2, :description => "Later Session") - user = FactoryGirl.create(:user) + creator = FactoryBot.create(:user) + creator2 = FactoryBot.create(:user) + earlier_session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Earlier Session") + later_session = FactoryBot.create(:active_music_session, :creator => creator2, :description => "Later Session") + user = FactoryBot.create(:user) earlier_session.music_session.musician_access = true earlier_session.music_session.save! @@ -412,11 +412,11 @@ describe ActiveMusicSession do describe "friend_active_index", no_transaction: false do it "does not crash" do - creator = FactoryGirl.create(:user) - creator2 = FactoryGirl.create(:user) - earlier_session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Earlier Session") - later_session = FactoryGirl.create(:active_music_session, :creator => creator2, :description => "Later Session") - user = FactoryGirl.create(:user) + creator = FactoryBot.create(:user) + creator2 = FactoryBot.create(:user) + earlier_session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Earlier Session") + later_session = FactoryBot.create(:active_music_session, :creator => creator2, :description => "Later Session") + user = FactoryBot.create(:user) earlier_session.music_session.musician_access = false earlier_session.music_session.save! @@ -428,20 +428,20 @@ describe ActiveMusicSession do end describe "parameters" do - let(:creator_1) { FactoryGirl.create(:user, last_jam_locidispid: 4, last_jam_audio_latency: 8) } - let(:creator_conn_1) { FactoryGirl.create(:connection, user: creator_1, ip_address: '4.4.4.4', locidispid: 4, addr: 4) } - let(:creator_2) { FactoryGirl.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 10) } - let(:creator_conn_2) { FactoryGirl.create(:connection, user: creator_2, ip_address: '4.4.4.4', locidispid: 1, addr: 1) } - let(:creator_3) { FactoryGirl.create(:user, last_jam_locidispid: 2, last_jam_audio_latency: 12) } - let(:creator_conn_3) { FactoryGirl.create(:connection, user: creator_3, ip_address: '5.5.5.5', locidispid: 2, addr: 2) } - let(:searcher_1) { FactoryGirl.create(:user, last_jam_locidispid: 5, last_jam_audio_latency: 6) } - let(:searcher_conn_1) { FactoryGirl.create(:connection, user: searcher_1, ip_address: '8.8.8.8', locidispid: 5, addr: 5) } - let(:searcher_2) { FactoryGirl.create(:user, last_jam_locidispid: 3, last_jam_audio_latency: 14) } - let(:searcher_conn_2) { FactoryGirl.create(:connection, user: searcher_2, ip_address: '9.9.9.9', locidispid: 3, addr: 3) } + let(:creator_1) { FactoryBot.create(:user, last_jam_locidispid: 4, last_jam_audio_latency: 8) } + let(:creator_conn_1) { FactoryBot.create(:connection, user: creator_1, ip_address: '4.4.4.4', locidispid: 4, addr: 4) } + let(:creator_2) { FactoryBot.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 10) } + let(:creator_conn_2) { FactoryBot.create(:connection, user: creator_2, ip_address: '4.4.4.4', locidispid: 1, addr: 1) } + let(:creator_3) { FactoryBot.create(:user, last_jam_locidispid: 2, last_jam_audio_latency: 12) } + let(:creator_conn_3) { FactoryBot.create(:connection, user: creator_3, ip_address: '5.5.5.5', locidispid: 2, addr: 2) } + let(:searcher_1) { FactoryBot.create(:user, last_jam_locidispid: 5, last_jam_audio_latency: 6) } + let(:searcher_conn_1) { FactoryBot.create(:connection, user: searcher_1, ip_address: '8.8.8.8', locidispid: 5, addr: 5) } + let(:searcher_2) { FactoryBot.create(:user, last_jam_locidispid: 3, last_jam_audio_latency: 14) } + let(:searcher_conn_2) { FactoryBot.create(:connection, user: searcher_2, ip_address: '9.9.9.9', locidispid: 3, addr: 3) } - let!(:music_session_1) { FactoryGirl.create(:active_music_session, :creator => creator_1, genre: Genre.find('african'), language: 'eng', description: "Bunny Jumps") } - let!(:music_session_2) { FactoryGirl.create(:active_music_session, :creator => creator_2, genre: Genre.find('ambient'), language: 'spa', description: "Play with us as we jam to beatles and bunnies") } + let!(:music_session_1) { FactoryBot.create(:active_music_session, :creator => creator_1, genre: Genre.find('african'), language: 'eng', description: "Bunny Jumps") } + let!(:music_session_2) { FactoryBot.create(:active_music_session, :creator => creator_2, genre: Genre.find('ambient'), language: 'spa', description: "Play with us as we jam to beatles and bunnies") } let(:tracks) { [{'sound' => 'mono', 'client_track_id' => 'abc', 'instrument_id' => 'piano'}] } @@ -451,7 +451,7 @@ describe ActiveMusicSession do music_sessions.length.should == 0 Friendship.save_using_models(searcher_1, creator_1) - FactoryGirl.create(:invitation, music_session: music_session_1.music_session, sender: creator_1, receiver: searcher_1) + FactoryBot.create(:invitation, music_session: music_session_1.music_session, sender: creator_1, receiver: searcher_1) music_sessions = ActiveMusicSession.friend_active_index(searcher_1, {}) music_sessions.length.should == 1 @@ -463,9 +463,9 @@ describe ActiveMusicSession do music_sessions = ActiveMusicSession.friend_active_index(searcher_1, {}) music_sessions.length.should == 0 - rsvp_slot = FactoryGirl.create(:rsvp_slot, music_session: music_session_1.music_session, instrument: Instrument.find('piano')) - rsvp_request = FactoryGirl.create(:rsvp_request, user: searcher_1, chosen: true, music_session: music_session_1.music_session) - rsvp_request_rsvp_slot = FactoryGirl.create(:rsvp_request_rsvp_slot, chosen: true, rsvp_request: rsvp_request, rsvp_slot: rsvp_slot) + rsvp_slot = FactoryBot.create(:rsvp_slot, music_session: music_session_1.music_session, instrument: Instrument.find('piano')) + rsvp_request = FactoryBot.create(:rsvp_request, user: searcher_1, chosen: true, music_session: music_session_1.music_session) + rsvp_request_rsvp_slot = FactoryBot.create(:rsvp_request_rsvp_slot, chosen: true, rsvp_request: rsvp_request, rsvp_slot: rsvp_slot) music_sessions = ActiveMusicSession.friend_active_index(searcher_1, {}) @@ -560,17 +560,17 @@ describe ActiveMusicSession do describe "ams_index", no_transaction: true do it "does not crash" do - creator = FactoryGirl.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 5) - creator2 = FactoryGirl.create(:user, last_jam_locidispid: 2, last_jam_audio_latency: 10) + creator = FactoryBot.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 5) + creator2 = FactoryBot.create(:user, last_jam_locidispid: 2, last_jam_audio_latency: 10) - earlier_session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Earlier Session") - c1 = FactoryGirl.create(:connection, user: creator, music_session: earlier_session, locidispid: 1, last_jam_audio_latency: 5) + earlier_session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Earlier Session") + c1 = FactoryBot.create(:connection, user: creator, music_session: earlier_session, locidispid: 1, last_jam_audio_latency: 5) - later_session = FactoryGirl.create(:active_music_session, :creator => creator2, :description => "Later Session") - c2 = FactoryGirl.create(:connection, user: creator2, music_session: later_session, locidispid: 2, last_jam_audio_latency: 10) + later_session = FactoryBot.create(:active_music_session, :creator => creator2, :description => "Later Session") + c2 = FactoryBot.create(:connection, user: creator2, music_session: later_session, locidispid: 2, last_jam_audio_latency: 10) - user = FactoryGirl.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 5) - c3 = FactoryGirl.create(:connection, user: user, locidispid: 1, last_jam_audio_latency: 5) + user = FactoryBot.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 5) + c3 = FactoryBot.create(:connection, user: user, locidispid: 1, last_jam_audio_latency: 5) Score.createx(c1.locidispid, c1.client_id, c1.addr, c3.locidispid, c3.client_id, c3.addr, 20, nil, nil, {auserid: creator.id, buserid: user.id}) Score.createx(c2.locidispid, c2.client_id, c2.addr, c3.locidispid, c3.client_id, c3.addr, 30, nil, nil, {auserid: creator2.id, buserid: user.id}) @@ -622,19 +622,19 @@ describe ActiveMusicSession do before { pending "Test instead ActiveMusicSession.public_index" } - let(:creator_1) { FactoryGirl.create(:user, last_jam_locidispid: 4, last_jam_audio_latency: 8) } - let(:creator_conn_1) { FactoryGirl.create(:connection, user: creator_1, ip_address: '4.4.4.4', locidispid: 4, addr: 4) } - let(:creator_2) { FactoryGirl.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 10) } - let(:creator_conn_2) { FactoryGirl.create(:connection, user: creator_2, ip_address: '4.4.4.4', locidispid: 1, addr: 1) } - let(:creator_3) { FactoryGirl.create(:user, last_jam_locidispid: 2, last_jam_audio_latency: 12) } - let(:creator_conn_3) { FactoryGirl.create(:connection, user: creator_3, ip_address: '5.5.5.5', locidispid: 2, addr: 2) } - let(:searcher_1) { FactoryGirl.create(:user, last_jam_locidispid: 5, last_jam_audio_latency: 6) } - let(:searcher_conn_1) { FactoryGirl.create(:connection, user: searcher_1, ip_address: '8.8.8.8', locidispid: 5, addr: 5) } - let(:searcher_2) { FactoryGirl.create(:user, last_jam_locidispid: 3, last_jam_audio_latency: 14) } - let(:searcher_conn_2) { FactoryGirl.create(:connection, user: searcher_2, ip_address: '9.9.9.9', locidispid: 3, addr: 3) } + let(:creator_1) { FactoryBot.create(:user, last_jam_locidispid: 4, last_jam_audio_latency: 8) } + let(:creator_conn_1) { FactoryBot.create(:connection, user: creator_1, ip_address: '4.4.4.4', locidispid: 4, addr: 4) } + let(:creator_2) { FactoryBot.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 10) } + let(:creator_conn_2) { FactoryBot.create(:connection, user: creator_2, ip_address: '4.4.4.4', locidispid: 1, addr: 1) } + let(:creator_3) { FactoryBot.create(:user, last_jam_locidispid: 2, last_jam_audio_latency: 12) } + let(:creator_conn_3) { FactoryBot.create(:connection, user: creator_3, ip_address: '5.5.5.5', locidispid: 2, addr: 2) } + let(:searcher_1) { FactoryBot.create(:user, last_jam_locidispid: 5, last_jam_audio_latency: 6) } + let(:searcher_conn_1) { FactoryBot.create(:connection, user: searcher_1, ip_address: '8.8.8.8', locidispid: 5, addr: 5) } + let(:searcher_2) { FactoryBot.create(:user, last_jam_locidispid: 3, last_jam_audio_latency: 14) } + let(:searcher_conn_2) { FactoryBot.create(:connection, user: searcher_2, ip_address: '9.9.9.9', locidispid: 3, addr: 3) } - let!(:music_session_1) { FactoryGirl.create(:active_music_session, :creator => creator_1, genre: Genre.find('african'), language: 'eng', description: "Bunny Jumps") } - let!(:music_session_2) { FactoryGirl.create(:active_music_session, :creator => creator_2, genre: Genre.find('ambient'), language: 'spa', description: "Play with us as we jam to beatles and bunnies") } + let!(:music_session_1) { FactoryBot.create(:active_music_session, :creator => creator_1, genre: Genre.find('african'), language: 'eng', description: "Bunny Jumps") } + let!(:music_session_2) { FactoryBot.create(:active_music_session, :creator => creator_2, genre: Genre.find('ambient'), language: 'spa', description: "Play with us as we jam to beatles and bunnies") } let(:good_network_score) { 20 } let(:fair_network_score) { 30 } @@ -821,36 +821,36 @@ describe ActiveMusicSession do it 'uninvited users cant join approval-required sessions without invitation' do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1, :musician_access => true, :approval_required => true) + music_session = FactoryBot.create(:active_music_session, :creator => user1, :musician_access => true, :approval_required => true) - connection1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session) - expect { FactoryGirl.create(:connection, :user => user2, :music_session => music_session, :joining_session => true) }.to raise_error(ActiveRecord::RecordInvalid) + connection1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session) + expect { FactoryBot.create(:connection, :user => user2, :music_session => music_session, :joining_session => true) }.to raise_error(ActiveRecord::RecordInvalid) end it "is_recording? returns false if not recording" do - user1 = FactoryGirl.create(:user) - music_session = FactoryGirl.build(:active_music_session, :creator => user1) + user1 = FactoryBot.create(:user) + music_session = FactoryBot.build(:active_music_session, :creator => user1) music_session.is_recording?.should be_false end describe "open_jam_track" do before(:each) do - @user1 = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user1) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @music_session = FactoryGirl.create(:active_music_session, :creator => @user1, :musician_access => true) + @user1 = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user1) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @music_session = FactoryBot.create(:active_music_session, :creator => @user1, :musician_access => true) # @music_session.connections << @connection @music_session.save! @connection.join_the_session(@music_session, true, nil, @user1, 10) - @jam_track = FactoryGirl.create(:jam_track) - @jam_track_right = FactoryGirl.create(:jam_track_right, jam_track: @jam_track, user: @user1) + @jam_track = FactoryBot.create(:jam_track) + @jam_track_right = FactoryBot.create(:jam_track_right, jam_track: @jam_track, user: @user1) end it "allow a jam track to be associated" do @@ -914,11 +914,11 @@ describe ActiveMusicSession do describe "recordings" do before(:each) do - @user1 = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user1) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @music_session = FactoryGirl.create(:active_music_session, :creator => @user1, :musician_access => true) + @user1 = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user1) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @music_session = FactoryBot.create(:active_music_session, :creator => @user1, :musician_access => true) # @music_session.connections << @connection @music_session.save! @connection.join_the_session(@music_session, true, nil, @user1, 10) @@ -932,7 +932,7 @@ describe ActiveMusicSession do describe "currently recording" do before(:each) do - @recording = FactoryGirl.create(:recording, :music_session => @music_session, :owner => @user1) + @recording = FactoryBot.create(:recording, :music_session => @music_session, :owner => @user1) end it "is_recording? returns true if recording" do @@ -974,7 +974,7 @@ describe ActiveMusicSession do end it "disallow a claimed recording to be started when already started by someone else" do - @user2 = FactoryGirl.create(:user) + @user2 = FactoryBot.create(:user) @music_session.claimed_recording_start(@user1, @claimed_recording) @music_session.errors.any?.should be_false @music_session.claimed_recording_start(@user2, @claimed_recording) @@ -983,7 +983,7 @@ describe ActiveMusicSession do end it "disallow a claimed recording to be started when already started by self" do - @user2 = FactoryGirl.create(:user) + @user2 = FactoryBot.create(:user) @claimed_recording2 = @recording.claim(@user1, "name", "description", Genre.first, true) @music_session.claimed_recording_start(@user1, @claimed_recording) @music_session.errors.any?.should be_false @@ -993,8 +993,8 @@ describe ActiveMusicSession do it "disallow a claimed recording to be started when jam track is open" do # open the jam track - @jam_track = FactoryGirl.create(:jam_track) - @jam_track_right = FactoryGirl.create(:jam_track_right, jam_track: @jam_track, user: @user1) + @jam_track = FactoryBot.create(:jam_track) + @jam_track_right = FactoryBot.create(:jam_track_right, jam_track: @jam_track, user: @user1) @music_session.open_jam_track(@user1, @jam_track) @music_session.errors.any?.should be_false @@ -1032,8 +1032,8 @@ describe ActiveMusicSession do describe "updates parent music_session" do it "updates needed fields" do - music_session = FactoryGirl.create(:music_session, scheduled_start: nil) - active_music_session = FactoryGirl.create(:active_music_session, music_session: music_session) + music_session = FactoryBot.create(:music_session, scheduled_start: nil) + active_music_session = FactoryBot.create(:active_music_session, music_session: music_session) music_session.reload active_music_session.reload music_session.scheduled_start.to_s.should == active_music_session.created_at.to_s @@ -1043,8 +1043,8 @@ describe ActiveMusicSession do it "ignore scheduled_start if already set" do yesterday = 1.days.ago - music_session = FactoryGirl.create(:music_session, scheduled_start: yesterday) - active_music_session = FactoryGirl.create(:active_music_session, music_session: music_session) + music_session = FactoryBot.create(:music_session, scheduled_start: yesterday) + active_music_session = FactoryBot.create(:active_music_session, music_session: music_session) music_session.reload music_session.scheduled_start.to_i.should == yesterday.utc.to_i end @@ -1052,11 +1052,11 @@ describe ActiveMusicSession do describe "get_connection_ids" do before(:each) do - @user1 = FactoryGirl.create(:user) - @user2 = FactoryGirl.create(:user) - @music_session = FactoryGirl.create(:active_music_session, :creator => @user1, :musician_access => true) - @connection1 = FactoryGirl.create(:connection, :user => @user1, :music_session => @music_session, :as_musician => true) - @connection2 = FactoryGirl.create(:connection, :user => @user2, :music_session => @music_session, :as_musician => false) + @user1 = FactoryBot.create(:user) + @user2 = FactoryBot.create(:user) + @music_session = FactoryBot.create(:active_music_session, :creator => @user1, :musician_access => true) + @connection1 = FactoryBot.create(:connection, :user => @user1, :music_session => @music_session, :as_musician => true) + @connection2 = FactoryBot.create(:connection, :user => @user2, :music_session => @music_session, :as_musician => false) end @@ -1082,9 +1082,9 @@ describe ActiveMusicSession do end describe "join_the_session" do - let(:creator_1) { FactoryGirl.create(:user, last_jam_locidispid: 4, last_jam_audio_latency: 8) } - let(:creator_conn_1) { FactoryGirl.create(:connection, user: creator_1, ip_address: '4.4.4.4', locidispid: 4, addr: 4) } - let!(:music_session_1) { FactoryGirl.create(:active_music_session, :creator => creator_1, genre: Genre.find('african'), language: 'eng', description: "Bunny Jumps") } + let(:creator_1) { FactoryBot.create(:user, last_jam_locidispid: 4, last_jam_audio_latency: 8) } + let(:creator_conn_1) { FactoryBot.create(:connection, user: creator_1, ip_address: '4.4.4.4', locidispid: 4, addr: 4) } + let!(:music_session_1) { FactoryBot.create(:active_music_session, :creator => creator_1, genre: Genre.find('african'), language: 'eng', description: "Bunny Jumps") } let(:tracks) { [{'sound' => 'mono', 'client_track_id' => 'abc', 'instrument_id' => 'piano'}] } let(:videos) { [{'client_video_source_id' => 'abc'}] } @@ -1116,11 +1116,11 @@ describe ActiveMusicSession do describe "open_backing_track" do before(:each) do - @user1 = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user1) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @music_session = FactoryGirl.create(:active_music_session, :creator => @user1, :musician_access => true) + @user1 = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user1) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @music_session = FactoryBot.create(:active_music_session, :creator => @user1, :musician_access => true) # @music_session.connections << @connection @music_session.save! @connection.join_the_session(@music_session, true, nil, @user1, 10) @@ -1185,8 +1185,8 @@ describe ActiveMusicSession do describe "play_time_remaining" do it "checks all" do - user = FactoryGirl.create(:user) - music_session = FactoryGirl.create(:active_music_session, :creator => user, :musician_access => false) + user = FactoryBot.create(:user) + music_session = FactoryBot.create(:active_music_session, :creator => user, :musician_access => false) user.subscription_plan_code = SubscriptionDefinitions::JAM_PLATINUM music_session.play_time_remaining(user).should be_nil @@ -1213,11 +1213,11 @@ describe ActiveMusicSession do describe "open_metronome" do before(:each) do - @user1 = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user1) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @music_session = FactoryGirl.create(:active_music_session, :creator => @user1, :musician_access => true) + @user1 = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user1) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @music_session = FactoryBot.create(:active_music_session, :creator => @user1, :musician_access => true) # @music_session.connections << @connection @music_session.save! @connection.join_the_session(@music_session, true, nil, @user1, 10) @@ -1277,7 +1277,7 @@ describe ActiveMusicSession do it "one" do - FactoryGirl.create(:active_music_session) + FactoryBot.create(:active_music_session) ActiveMusicSession.stats.should eq('count' => 1, 'jam_track_count' => 0, 'backing_track_count' => 0, @@ -1286,10 +1286,10 @@ describe ActiveMusicSession do end it "two" do - ams1 = FactoryGirl.create(:active_music_session, jam_track_initiator_id: '1') - ams2 = FactoryGirl.create(:active_music_session, jam_track_initiator_id: '2') - user1 = FactoryGirl.create(:user) - user2 = FactoryGirl.create(:user) + ams1 = FactoryBot.create(:active_music_session, jam_track_initiator_id: '1') + ams2 = FactoryBot.create(:active_music_session, jam_track_initiator_id: '2') + user1 = FactoryBot.create(:user) + user2 = FactoryBot.create(:user) ActiveMusicSession.stats.should eq('count' => 2, 'jam_track_count' => 2, 'backing_track_count' => 0, diff --git a/ruby/spec/jam_ruby/models/affiliate_distribution_spec.rb b/ruby/spec/jam_ruby/models/affiliate_distribution_spec.rb index b6a1e061a..0cb4bf5cb 100644 --- a/ruby/spec/jam_ruby/models/affiliate_distribution_spec.rb +++ b/ruby/spec/jam_ruby/models/affiliate_distribution_spec.rb @@ -1,13 +1,13 @@ require 'spec_helper' describe AffiliateDistribution do - let(:affiliate_partner){ FactoryGirl.create(:affiliate_partner) } - let(:affiliate_distribution1){ FactoryGirl.create(:affiliate_distribution, created_at: DateTime.new(2015, 1, 31), product_type: 'Subscription', product_code: 'jamsubsilver', affiliate_referral: affiliate_partner) } - let(:affiliate_distribution2){ FactoryGirl.create(:affiliate_distribution, created_at: DateTime.new(2015, 2, 1), product_type: 'Subscription', product_code: 'jamsubsilver', affiliate_referral: affiliate_partner) } - let(:affiliate_distribution3){ FactoryGirl.create(:affiliate_distribution, created_at: DateTime.new(2015, 2, 2), product_type: 'Subscription', product_code: 'jamsubgold', affiliate_referral: affiliate_partner) } - let(:affiliate_distribution4){ FactoryGirl.create(:affiliate_distribution, created_at: DateTime.new(2015, 2, 3), product_type: 'Subscription', product_code: 'jamsubgold', affiliate_referral: affiliate_partner) } - let(:affiliate_distribution5){ FactoryGirl.create(:affiliate_distribution, created_at: DateTime.new(2015, 2, 7), product_type: 'Subscription', product_code: 'jamsubplatinum', affiliate_referral: affiliate_partner) } - let(:affiliate_distribution6){ FactoryGirl.create(:affiliate_distribution, created_at: DateTime.new(2015, 3, 1), product_type: 'Subscription', product_code: 'jamsubsilver', affiliate_referral: affiliate_partner) } + let(:affiliate_partner){ FactoryBot.create(:affiliate_partner) } + let(:affiliate_distribution1){ FactoryBot.create(:affiliate_distribution, created_at: DateTime.new(2015, 1, 31), product_type: 'Subscription', product_code: 'jamsubsilver', affiliate_referral: affiliate_partner) } + let(:affiliate_distribution2){ FactoryBot.create(:affiliate_distribution, created_at: DateTime.new(2015, 2, 1), product_type: 'Subscription', product_code: 'jamsubsilver', affiliate_referral: affiliate_partner) } + let(:affiliate_distribution3){ FactoryBot.create(:affiliate_distribution, created_at: DateTime.new(2015, 2, 2), product_type: 'Subscription', product_code: 'jamsubgold', affiliate_referral: affiliate_partner) } + let(:affiliate_distribution4){ FactoryBot.create(:affiliate_distribution, created_at: DateTime.new(2015, 2, 3), product_type: 'Subscription', product_code: 'jamsubgold', affiliate_referral: affiliate_partner) } + let(:affiliate_distribution5){ FactoryBot.create(:affiliate_distribution, created_at: DateTime.new(2015, 2, 7), product_type: 'Subscription', product_code: 'jamsubplatinum', affiliate_referral: affiliate_partner) } + let(:affiliate_distribution6){ FactoryBot.create(:affiliate_distribution, created_at: DateTime.new(2015, 3, 1), product_type: 'Subscription', product_code: 'jamsubsilver', affiliate_referral: affiliate_partner) } it "gives subscription plans counts for a partner between start and end dates" do diff --git a/ruby/spec/jam_ruby/models/affiliate_monthly_payment_spec.rb b/ruby/spec/jam_ruby/models/affiliate_monthly_payment_spec.rb index 0579095f1..fb5fbe941 100644 --- a/ruby/spec/jam_ruby/models/affiliate_monthly_payment_spec.rb +++ b/ruby/spec/jam_ruby/models/affiliate_monthly_payment_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' describe AffiliateMonthlyPayment do - let(:partner) { FactoryGirl.create(:affiliate_partner) } + let(:partner) { FactoryBot.create(:affiliate_partner) } it ".index orders DESC" do - monthly1 = FactoryGirl.create(:affiliate_monthly_payment, closed: true, month: 2, year: 2015, affiliate_partner: partner) - monthly2 = FactoryGirl.create(:affiliate_monthly_payment, closed: true, month: 3, year: 2015, affiliate_partner: partner) - monthly3 = FactoryGirl.create(:affiliate_monthly_payment, closed: true, month: 4, year: 2015, affiliate_partner: partner) - monthly4 = FactoryGirl.create(:affiliate_monthly_payment, closed: true, month: 1, year: 2016, affiliate_partner: partner) + monthly1 = FactoryBot.create(:affiliate_monthly_payment, closed: true, month: 2, year: 2015, affiliate_partner: partner) + monthly2 = FactoryBot.create(:affiliate_monthly_payment, closed: true, month: 3, year: 2015, affiliate_partner: partner) + monthly3 = FactoryBot.create(:affiliate_monthly_payment, closed: true, month: 4, year: 2015, affiliate_partner: partner) + monthly4 = FactoryBot.create(:affiliate_monthly_payment, closed: true, month: 1, year: 2016, affiliate_partner: partner) monthly_payments = AffiliateMonthlyPayment.index(partner.partner_user, {})[0] expect(monthly_payments.map(&:year)).to eq [2016, 2015, 2015, 2015] diff --git a/ruby/spec/jam_ruby/models/affiliate_partner_spec.rb b/ruby/spec/jam_ruby/models/affiliate_partner_spec.rb index 3917ef76c..1d8ea0435 100644 --- a/ruby/spec/jam_ruby/models/affiliate_partner_spec.rb +++ b/ruby/spec/jam_ruby/models/affiliate_partner_spec.rb @@ -2,10 +2,10 @@ require 'spec_helper' describe AffiliatePartner do - let!(:user) { FactoryGirl.create(:user) } - let(:partner) { FactoryGirl.create(:affiliate_partner) } - let!(:legalese) { FactoryGirl.create(:affiliate_legalese) } - let(:jam_track) {FactoryGirl.create(:jam_track) } + let!(:user) { FactoryBot.create(:user) } + let(:partner) { FactoryBot.create(:affiliate_partner) } + let!(:legalese) { FactoryBot.create(:affiliate_legalese) } + let(:jam_track) {FactoryBot.create(:jam_track) } describe "unpaid" do it "succeeds with no data" do @@ -13,31 +13,31 @@ describe AffiliatePartner do end it "finds one unpaid partner" do - quarter = FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner: partner, closed:true, paid:false, due_amount_in_cents: AffiliatePartner::PAY_THRESHOLD) + quarter = FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner: partner, closed:true, paid:false, due_amount_in_cents: AffiliatePartner::PAY_THRESHOLD) AffiliatePartner.unpaid.should eq([partner]) end it "finds one unpaid partner with two quarters that exceed threshold" do # this $5 quarter is not enough to make the threshold - quarter = FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner: partner, year:2016, closed:true, paid:false, due_amount_in_cents: AffiliatePartner::PAY_THRESHOLD / 2) + quarter = FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner: partner, year:2016, closed:true, paid:false, due_amount_in_cents: AffiliatePartner::PAY_THRESHOLD / 2) AffiliatePartner.unpaid.should eq([]) # this should get the user over the hump - quarter = FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner: partner, year:2015, closed:true, paid:false, due_amount_in_cents: AffiliatePartner::PAY_THRESHOLD / 2) + quarter = FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner: partner, year:2015, closed:true, paid:false, due_amount_in_cents: AffiliatePartner::PAY_THRESHOLD / 2) AffiliatePartner.unpaid.should eq([partner]) end it "does not find paid or closed quarters" do - quarter = FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner: partner, year:2016, closed:true, paid:true, due_amount_in_cents: AffiliatePartner::PAY_THRESHOLD) + quarter = FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner: partner, year:2016, closed:true, paid:true, due_amount_in_cents: AffiliatePartner::PAY_THRESHOLD) AffiliatePartner.unpaid.should eq([]) - quarter = FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner: partner, year:2015, closed:false, paid:true, due_amount_in_cents: AffiliatePartner::PAY_THRESHOLD) + quarter = FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner: partner, year:2015, closed:false, paid:true, due_amount_in_cents: AffiliatePartner::PAY_THRESHOLD) AffiliatePartner.unpaid.should eq([]) end end it "user-partner association" do - user_partner = FactoryGirl.create(:user, affiliate_partner: partner) + user_partner = FactoryBot.create(:user, affiliate_partner: partner) user_partner.affiliate_partner.should_not be_nil user_partner.affiliate_partner.present?.should be_true end @@ -45,7 +45,7 @@ describe AffiliatePartner do it 'has user referrals' do pending "bug in rails counter-cache" expect(partner.referral_user_count).to eq(0) - uu = FactoryGirl.create(:user) + uu = FactoryBot.create(:user) uu.affiliate_referral = partner uu.save partner.reload @@ -56,12 +56,12 @@ describe AffiliatePartner do end it 'groups referrals properly' do - FactoryGirl.create(:user, :created_at => Time.now - 7.days, :affiliate_referral_id => partner.id) - FactoryGirl.create(:user, :created_at => Time.now - 7.days, :affiliate_referral_id => partner.id) - FactoryGirl.create(:user, :created_at => Time.now - 6.days, :affiliate_referral_id => partner.id) - FactoryGirl.create(:user, :created_at => Time.now - 6.days, :affiliate_referral_id => partner.id) - FactoryGirl.create(:user, :created_at => Time.now - 3.days, :affiliate_referral_id => partner.id) - recent = FactoryGirl.create(:user, :created_at => Time.now - 2.days, :affiliate_referral_id => partner.id) + FactoryBot.create(:user, :created_at => Time.now - 7.days, :affiliate_referral_id => partner.id) + FactoryBot.create(:user, :created_at => Time.now - 7.days, :affiliate_referral_id => partner.id) + FactoryBot.create(:user, :created_at => Time.now - 6.days, :affiliate_referral_id => partner.id) + FactoryBot.create(:user, :created_at => Time.now - 6.days, :affiliate_referral_id => partner.id) + FactoryBot.create(:user, :created_at => Time.now - 3.days, :affiliate_referral_id => partner.id) + recent = FactoryBot.create(:user, :created_at => Time.now - 2.days, :affiliate_referral_id => partner.id) partner.reload expect(partner.referral_user_count).to eq(6) @@ -161,12 +161,12 @@ describe AffiliatePartner do end describe "tally_up" do - let(:partner1) {FactoryGirl.create(:affiliate_partner)} - let(:partner2) {FactoryGirl.create(:affiliate_partner)} - #let(:partner3) {FactoryGirl.create(:affiliate_partner)} - let(:payment1) {FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner: partner1)} - let(:user_partner1) { FactoryGirl.create(:user, affiliate_referral: partner1)} - let(:user_partner2) { FactoryGirl.create(:user, affiliate_referral: partner2)} + let(:partner1) {FactoryBot.create(:affiliate_partner)} + let(:partner2) {FactoryBot.create(:affiliate_partner)} + #let(:partner3) {FactoryBot.create(:affiliate_partner)} + let(:payment1) {FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner: partner1)} + let(:user_partner1) { FactoryBot.create(:user, affiliate_referral: partner1)} + let(:user_partner2) { FactoryBot.create(:user, affiliate_referral: partner2)} let(:sale) {Sale.create_jam_track_sale(user_partner1)} @@ -257,13 +257,13 @@ describe AffiliatePartner do end it "updates referral_user_count" do - FactoryGirl.create(:user, affiliate_referral: partner1) + FactoryBot.create(:user, affiliate_referral: partner1) AffiliatePartner.tally_partner_totals partner1.reload partner1.referral_user_count.should eq(1) partner1.cumulative_earnings_in_cents.should eq(0) - FactoryGirl.create(:user, affiliate_referral: partner2) + FactoryBot.create(:user, affiliate_referral: partner2) AffiliatePartner.tally_partner_totals partner1.reload partner1.referral_user_count.should eq(1) @@ -272,7 +272,7 @@ describe AffiliatePartner do partner2.referral_user_count.should eq(1) partner2.cumulative_earnings_in_cents.should eq(0) - FactoryGirl.create(:user, affiliate_referral: partner2) + FactoryBot.create(:user, affiliate_referral: partner2) AffiliatePartner.tally_partner_totals partner1.reload partner1.referral_user_count.should eq(1) @@ -283,13 +283,13 @@ describe AffiliatePartner do end it "updates cumulative_earnings_in_cents" do - FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner:partner1, year:2015, quarter:0, due_amount_in_cents: 0, closed:true, paid:true) + FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner:partner1, year:2015, quarter:0, due_amount_in_cents: 0, closed:true, paid:true) AffiliatePartner.tally_partner_totals partner1.reload partner1.referral_user_count.should eq(0) partner1.cumulative_earnings_in_cents.should eq(0) - FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner:partner2, year:2015, quarter:0, due_amount_in_cents: 10, closed:true, paid:true) + FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner:partner2, year:2015, quarter:0, due_amount_in_cents: 10, closed:true, paid:true) AffiliatePartner.tally_partner_totals partner1.reload partner1.referral_user_count.should eq(0) @@ -298,7 +298,7 @@ describe AffiliatePartner do partner2.referral_user_count.should eq(0) partner2.cumulative_earnings_in_cents.should eq(10) - FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner:partner2, year:2015, quarter:1, due_amount_in_cents: 100, closed:true, paid:true) + FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner:partner2, year:2015, quarter:1, due_amount_in_cents: 100, closed:true, paid:true) AffiliatePartner.tally_partner_totals partner1.reload partner1.referral_user_count.should eq(0) @@ -307,7 +307,7 @@ describe AffiliatePartner do partner2.referral_user_count.should eq(0) partner2.cumulative_earnings_in_cents.should eq(110) - FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner:partner1, year:2015, quarter:1, due_amount_in_cents: 100, closed:true, paid:true) + FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner:partner1, year:2015, quarter:1, due_amount_in_cents: 100, closed:true, paid:true) AffiliatePartner.tally_partner_totals partner1.reload partner1.referral_user_count.should eq(0) @@ -317,7 +317,7 @@ describe AffiliatePartner do partner2.cumulative_earnings_in_cents.should eq(110) # a paid=false quarterly payment does not yet reflect in cumulative earnings - FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner:partner1, year:2015, quarter:2, due_amount_in_cents: 1000, closed:false, paid:false) + FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner:partner1, year:2015, quarter:2, due_amount_in_cents: 1000, closed:false, paid:false) AffiliatePartner.tally_partner_totals partner1.reload partner1.referral_user_count.should eq(0) @@ -535,7 +535,7 @@ describe AffiliatePartner do it "totals subscriptions with JamTrack sales" do - FactoryGirl.create(:affiliate_distribution, + FactoryBot.create(:affiliate_distribution, product_type: 'Subscription', product_code: 'jamsubsliver', affiliate_referral: partner1, @@ -550,7 +550,7 @@ describe AffiliatePartner do quarter = partner1.quarters.first quarter.due_amount_in_cents.should eq(15) - FactoryGirl.create(:affiliate_distribution, + FactoryBot.create(:affiliate_distribution, product_type: 'Subscription', product_code: 'jamsubgold', affiliate_referral: partner2, @@ -567,7 +567,7 @@ describe AffiliatePartner do quarter.due_amount_in_cents.should eq(30) #subscribe by non-affiliate user should not create affiliate payments - FactoryGirl.create(:user) + FactoryBot.create(:user) AffiliatePartner.ensure_quarters_exist(2015, 0) expect { AffiliatePartner.total_quarters(2015, 0)}.to change(AffiliateQuarterlyPayment, :count).by(0) @@ -609,7 +609,7 @@ describe AffiliatePartner do quarter.jamtracks_sold.should eq(1) #affiliate earnings from subscriptions from previous quater should not attribute to quater been considered - FactoryGirl.create(:affiliate_distribution, + FactoryBot.create(:affiliate_distribution, product_type: 'Subscription', product_code: 'jamsubgold', affiliate_referral: partner1, @@ -627,7 +627,7 @@ describe AffiliatePartner do quarter.due_amount_in_cents.should eq(55) #affiliate earnings from subscriptions of next quater should not attribute to quater been considered - FactoryGirl.create(:affiliate_distribution, + FactoryBot.create(:affiliate_distribution, product_type: 'Subscription', product_code: 'jamsubgold', affiliate_referral: partner2, @@ -789,7 +789,7 @@ describe AffiliatePartner do AffiliateQuarterlyPayment.count.should eq(0) AffiliateMonthlyPayment.count.should eq(0) - FactoryGirl.create(:affiliate_distribution, + FactoryBot.create(:affiliate_distribution, product_type: 'Subscription', product_code: 'jamsubgold', affiliate_referral: partner1, @@ -924,7 +924,7 @@ describe AffiliatePartner do traffic_total_day0.signups.should eq(1) # add in a visit - visit = FactoryGirl.create(:affiliate_referral_visit, affiliate_partner: user_partner1.affiliate_referral) + visit = FactoryBot.create(:affiliate_referral_visit, affiliate_partner: user_partner1.affiliate_referral) # it won't get seen though because we've moved on AffiliatePartner.tally_traffic_totals(day1, day1) @@ -956,9 +956,9 @@ describe AffiliatePartner do user_partner2.touch - visit2 = FactoryGirl.create(:affiliate_referral_visit, affiliate_partner: user_partner1.affiliate_referral) - visit3 = FactoryGirl.create(:affiliate_referral_visit, affiliate_partner: user_partner1.affiliate_referral) - visit_partner2 = FactoryGirl.create(:affiliate_referral_visit, affiliate_partner: user_partner2.affiliate_referral) + visit2 = FactoryBot.create(:affiliate_referral_visit, affiliate_partner: user_partner1.affiliate_referral) + visit3 = FactoryBot.create(:affiliate_referral_visit, affiliate_partner: user_partner1.affiliate_referral) + visit_partner2 = FactoryBot.create(:affiliate_referral_visit, affiliate_partner: user_partner2.affiliate_referral) visit2.created_at = day2 visit3.created_at = day2 visit_partner2.created_at = day2 @@ -966,8 +966,8 @@ describe AffiliatePartner do visit3.save! visit_partner2.save! - user2 = FactoryGirl.create(:user, affiliate_referral:user_partner1.affiliate_referral) - user3 = FactoryGirl.create(:user, affiliate_referral:user_partner1.affiliate_referral) + user2 = FactoryBot.create(:user, affiliate_referral:user_partner1.affiliate_referral) + user3 = FactoryBot.create(:user, affiliate_referral:user_partner1.affiliate_referral) user2.created_at = day2 user3.created_at = day2 user_partner2.created_at = day2 diff --git a/ruby/spec/jam_ruby/models/affiliate_payment_spec.rb b/ruby/spec/jam_ruby/models/affiliate_payment_spec.rb index 21c12f15f..a074f2dff 100644 --- a/ruby/spec/jam_ruby/models/affiliate_payment_spec.rb +++ b/ruby/spec/jam_ruby/models/affiliate_payment_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe AffiliatePayment do - let(:partner) { FactoryGirl.create(:affiliate_partner) } - let(:user_partner) { FactoryGirl.create(:user, affiliate_partner: partner) } + let(:partner) { FactoryBot.create(:affiliate_partner) } + let(:user_partner) { FactoryBot.create(:user, affiliate_partner: partner) } it "succeeds with no data" do results, nex = AffiliatePayment.index(user_partner, {}) @@ -11,11 +11,11 @@ describe AffiliatePayment do end it "sorts month and quarters correctly" do - monthly1 = FactoryGirl.create(:affiliate_monthly_payment, affiliate_partner: partner, closed: true, due_amount_in_cents: 10, month: 1, year: 2015) - monthly2 = FactoryGirl.create(:affiliate_monthly_payment, affiliate_partner: partner, closed: true, due_amount_in_cents: 20, month: 2, year: 2015) - monthly3 = FactoryGirl.create(:affiliate_monthly_payment, affiliate_partner: partner, closed: true, due_amount_in_cents: 30, month: 3, year: 2015) - monthly4 = FactoryGirl.create(:affiliate_monthly_payment, affiliate_partner: partner, closed: true, due_amount_in_cents: 40, month: 1, year: 2016) - quarterly = FactoryGirl.create(:affiliate_quarterly_payment, affiliate_partner: partner, closed: true, paid:true, due_amount_in_cents: 50, quarter: 0, year: 2015) + monthly1 = FactoryBot.create(:affiliate_monthly_payment, affiliate_partner: partner, closed: true, due_amount_in_cents: 10, month: 1, year: 2015) + monthly2 = FactoryBot.create(:affiliate_monthly_payment, affiliate_partner: partner, closed: true, due_amount_in_cents: 20, month: 2, year: 2015) + monthly3 = FactoryBot.create(:affiliate_monthly_payment, affiliate_partner: partner, closed: true, due_amount_in_cents: 30, month: 3, year: 2015) + monthly4 = FactoryBot.create(:affiliate_monthly_payment, affiliate_partner: partner, closed: true, due_amount_in_cents: 40, month: 1, year: 2016) + quarterly = FactoryBot.create(:affiliate_quarterly_payment, affiliate_partner: partner, closed: true, paid:true, due_amount_in_cents: 50, quarter: 0, year: 2015) results, nex = AffiliatePayment.index(user_partner, {}) diff --git a/ruby/spec/jam_ruby/models/affiliate_referral_visit_spec.rb b/ruby/spec/jam_ruby/models/affiliate_referral_visit_spec.rb index 467127500..f59cd5e51 100644 --- a/ruby/spec/jam_ruby/models/affiliate_referral_visit_spec.rb +++ b/ruby/spec/jam_ruby/models/affiliate_referral_visit_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe AffiliateReferralVisit do - let!(:user) { FactoryGirl.create(:user) } - let(:partner) { FactoryGirl.create(:affiliate_partner) } + let!(:user) { FactoryBot.create(:user) } + let(:partner) { FactoryBot.create(:affiliate_partner) } let(:valid_track_options) { { affiliate_id: partner.id, diff --git a/ruby/spec/jam_ruby/models/band_filter_search_spec.rb b/ruby/spec/jam_ruby/models/band_filter_search_spec.rb index 32d196e73..91682237e 100644 --- a/ruby/spec/jam_ruby/models/band_filter_search_spec.rb +++ b/ruby/spec/jam_ruby/models/band_filter_search_spec.rb @@ -2,13 +2,13 @@ require 'spec_helper' describe 'Band Search Model' do - let!(:searcher) { FactoryGirl.create(:austin_user) } + let!(:searcher) { FactoryBot.create(:austin_user) } let!(:search) { BandSearch.user_search_filter(searcher) } - let!(:austin_user) { FactoryGirl.create(:austin_user) } - let!(:dallas_user) { FactoryGirl.create(:dallas_user) } - let!(:miami_user) { FactoryGirl.create(:miami_user) } - let!(:seattle_user) { FactoryGirl.create(:seattle_user) } + let!(:austin_user) { FactoryBot.create(:austin_user) } + let!(:dallas_user) { FactoryBot.create(:dallas_user) } + let!(:miami_user) { FactoryBot.create(:miami_user) } + let!(:seattle_user) { FactoryBot.create(:seattle_user) } let!(:user_types) { [:austin_user, :dallas_user, :miami_user, :seattle_user] } @@ -22,15 +22,15 @@ describe 'Band Search Model' do before(:each) do @bands = [] - @bands << @band1 = FactoryGirl.create(:band) - @bands << @band2 = FactoryGirl.create(:band) - @bands << @band3 = FactoryGirl.create(:band) - @bands << @band4 = FactoryGirl.create(:band) + @bands << @band1 = FactoryBot.create(:band) + @bands << @band2 = FactoryBot.create(:band) + @bands << @band3 = FactoryBot.create(:band) + @bands << @band4 = FactoryBot.create(:band) @bands.each do |bb| - FactoryGirl.create(:band_musician, :band => bb, :user => FactoryGirl.create(:user)) + FactoryBot.create(:band_musician, :band => bb, :user => FactoryBot.create(:user)) (rand(4)+1).downto(1) do |nn| - FactoryGirl.create(:band_musician, :band => bb, :user => FactoryGirl.create(:user)) + FactoryBot.create(:band_musician, :band => bb, :user => FactoryBot.create(:user)) end end end @@ -229,7 +229,7 @@ describe 'Band Search Model' do end it "filters by instruments" do - minst = FactoryGirl.build(:musician_instrument) + minst = FactoryBot.build(:musician_instrument) band.musician_instruments << minst band.save filter[BandSearch::KEY_INSTRUMENTS] = [{'instrument_id' => minst.instrument_id, diff --git a/ruby/spec/jam_ruby/models/band_location_spec.rb b/ruby/spec/jam_ruby/models/band_location_spec.rb index 186c7f084..b219ab4c4 100644 --- a/ruby/spec/jam_ruby/models/band_location_spec.rb +++ b/ruby/spec/jam_ruby/models/band_location_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe Band do before do - #@geocode2 = FactoryGirl.create(:geocoder) - @band = FactoryGirl.create(:band) + #@geocode2 = FactoryBot.create(:geocoder) + @band = FactoryBot.create(:band) end describe "with profile location data" do diff --git a/ruby/spec/jam_ruby/models/band_search_spec.rb b/ruby/spec/jam_ruby/models/band_search_spec.rb index 79b3759fb..a63f99622 100644 --- a/ruby/spec/jam_ruby/models/band_search_spec.rb +++ b/ruby/spec/jam_ruby/models/band_search_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe "Band Search" do - let(:user) { FactoryGirl.create(:user) } - let(:band) { FactoryGirl.create(:band, name: "Example Band") } + let(:user) { FactoryBot.create(:user) } + let(:band) { FactoryBot.create(:band, name: "Example Band") } let(:band_params) { { name: "The Band", @@ -21,7 +21,7 @@ describe "Band Search" do end before(:each) do - @user = FactoryGirl.create(:user) + @user = FactoryBot.create(:user) band.touch @@ -110,7 +110,7 @@ describe "Band Search" do end it "should tokenize correctly" do - band2 = FactoryGirl.create(:band, name: 'Peach pit') + band2 = FactoryBot.create(:band, name: 'Peach pit') ws = Search.band_search("pea").results ws.length.should == 1 user_result = ws[0] @@ -119,7 +119,7 @@ describe "Band Search" do it "should not return anything with a 1 character search" do - band2 = FactoryGirl.create(:band, name: 'Peach pit') + band2 = FactoryBot.create(:band, name: 'Peach pit') ws = Search.band_search("pe").results ws.length.should == 1 user_result = ws[0] diff --git a/ruby/spec/jam_ruby/models/band_spec.rb b/ruby/spec/jam_ruby/models/band_spec.rb index 6fed8ac1e..b202d1019 100644 --- a/ruby/spec/jam_ruby/models/band_spec.rb +++ b/ruby/spec/jam_ruby/models/band_spec.rb @@ -2,12 +2,12 @@ require 'spec_helper' describe Band do - let(:user) { FactoryGirl.create(:user) } - let(:user2) { FactoryGirl.create(:user) } - let(:fan) { FactoryGirl.create(:fan) } - let(:band) { FactoryGirl.create(:band) } - let(:band_in_austin) { FactoryGirl.create(:band, country: 'US', state: 'TX', city: 'Austin')} - let(:new_band) { FactoryGirl.build(:band) } + let(:user) { FactoryBot.create(:user) } + let(:user2) { FactoryBot.create(:user) } + let(:fan) { FactoryBot.create(:fan) } + let(:band) { FactoryBot.create(:band) } + let(:band_in_austin) { FactoryBot.create(:band, country: 'US', state: 'TX', city: 'Austin')} + let(:new_band) { FactoryBot.build(:band) } let(:band_params) { { name: "The Band", @@ -32,13 +32,13 @@ describe Band do describe 'with instruments' do it 'builds with instruments' do - band.musician_instruments << FactoryGirl.build(:musician_instrument, player: band) + band.musician_instruments << FactoryBot.build(:musician_instrument, player: band) band.musician_instruments.should have(1).items band.instruments.should have(1).items end it 'creates with instruments' do - FactoryGirl.create(:musician_instrument, player: band) + FactoryBot.create(:musician_instrument, player: band) band.reload band.musician_instruments.should have(1).items band.instruments.should have(1).items @@ -207,17 +207,17 @@ describe Band do describe "recent history" do it "should only retrieve recordings with a claimed recording" do - user = FactoryGirl.create(:user) - band = FactoryGirl.create(:band) + user = FactoryBot.create(:user) + band = FactoryBot.create(:band) band.users << user band.save! - claimed_recording = FactoryGirl.create(:claimed_recording, :user => user) + claimed_recording = FactoryBot.create(:claimed_recording, :user => user) claimed_recording.recording.owner = user claimed_recording.recording.band = band claimed_recording.recording.save! - recording = FactoryGirl.create(:recording, :owner => user, :band => band) + recording = FactoryBot.create(:recording, :owner => user, :band => band) Recording.where(:owner_id => user.id).size.should == 2 Recording.where(:band_id => band.id).size.should == 2 diff --git a/ruby/spec/jam_ruby/models/broadcast_notification_spec.rb b/ruby/spec/jam_ruby/models/broadcast_notification_spec.rb index 78daea311..a3663b741 100644 --- a/ruby/spec/jam_ruby/models/broadcast_notification_spec.rb +++ b/ruby/spec/jam_ruby/models/broadcast_notification_spec.rb @@ -2,14 +2,14 @@ require 'spec_helper' describe BroadcastNotification do - let(:broadcast1) { FactoryGirl.create(:broadcast_notification) } - let(:broadcast2) { FactoryGirl.create(:broadcast_notification) } - let(:broadcast3) { FactoryGirl.create(:broadcast_notification) } - let(:broadcast4) { FactoryGirl.create(:broadcast_notification) } - let(:user1) { FactoryGirl.create(:user) } - let(:user2) { FactoryGirl.create(:user) } - let(:user3) { FactoryGirl.create(:user) } - let(:user4) { FactoryGirl.create(:user) } + let(:broadcast1) { FactoryBot.create(:broadcast_notification) } + let(:broadcast2) { FactoryBot.create(:broadcast_notification) } + let(:broadcast3) { FactoryBot.create(:broadcast_notification) } + let(:broadcast4) { FactoryBot.create(:broadcast_notification) } + let(:user1) { FactoryBot.create(:user) } + let(:user2) { FactoryBot.create(:user) } + let(:user3) { FactoryBot.create(:user) } + let(:user4) { FactoryBot.create(:user) } before(:each) do BroadcastNotificationView.delete_all diff --git a/ruby/spec/jam_ruby/models/claimed_recording_spec.rb b/ruby/spec/jam_ruby/models/claimed_recording_spec.rb index 5f771d63a..676c94949 100644 --- a/ruby/spec/jam_ruby/models/claimed_recording_spec.rb +++ b/ruby/spec/jam_ruby/models/claimed_recording_spec.rb @@ -14,11 +14,11 @@ end describe ClaimedRecording do before(:each) do - @user = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @music_session = FactoryGirl.create(:active_music_session, :creator => @user, :musician_access => true) + @user = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @music_session = FactoryBot.create(:active_music_session, :creator => @user, :musician_access => true) # @music_session.connections << @connection @music_session.save @connection.join_the_session(@music_session, true, nil, @user, 10) @@ -117,7 +117,7 @@ describe ClaimedRecording do describe "favorite_index" do - let(:other_user) { FactoryGirl.create(:user) } + let(:other_user) { FactoryBot.create(:user) } it "returns nothing" do favorites, start = ClaimedRecording.index_favorites(@user, user: @user.id) @@ -134,9 +134,9 @@ describe ClaimedRecording do end it "finds favorite claimed_recording if true, not if false" do - claimed_recording1 = FactoryGirl.create(:claimed_recording, user: @user) + claimed_recording1 = FactoryBot.create(:claimed_recording, user: @user) - like = FactoryGirl.create(:recording_like, user: @user, claimed_recording: claimed_recording1, recording: claimed_recording1.recording, favorite: true) + like = FactoryBot.create(:recording_like, user: @user, claimed_recording: claimed_recording1, recording: claimed_recording1.recording, favorite: true) favorites, start = ClaimedRecording.index_favorites(@user, user: @user.id) favorites.length.should == 1 @@ -152,9 +152,9 @@ describe ClaimedRecording do end it "finds others public claimed recordings" do - claimed_recording1 = FactoryGirl.create(:claimed_recording, user: other_user) + claimed_recording1 = FactoryBot.create(:claimed_recording, user: other_user) - like = FactoryGirl.create(:recording_like, user: @user, claimed_recording: claimed_recording1, recording: claimed_recording1.recording, favorite: true) + like = FactoryBot.create(:recording_like, user: @user, claimed_recording: claimed_recording1, recording: claimed_recording1.recording, favorite: true) favorites, start = ClaimedRecording.index_favorites(@user, user: @user.id) favorites.length.should == 1 @@ -162,9 +162,9 @@ describe ClaimedRecording do end it "can find others private claimed recordings" do - claimed_recording1 = FactoryGirl.create(:claimed_recording, user: other_user) + claimed_recording1 = FactoryBot.create(:claimed_recording, user: other_user) - like = FactoryGirl.create(:recording_like, user: @user, claimed_recording: claimed_recording1, recording: claimed_recording1.recording, favorite: false) + like = FactoryBot.create(:recording_like, user: @user, claimed_recording: claimed_recording1, recording: claimed_recording1.recording, favorite: false) favorites, start = ClaimedRecording.index_favorites(@user, user: @user.id) favorites.length.should == 0 @@ -172,9 +172,9 @@ describe ClaimedRecording do end it "can find own private claimed recordings" do - claimed_recording1 = FactoryGirl.create(:claimed_recording, user: @user) + claimed_recording1 = FactoryBot.create(:claimed_recording, user: @user) - like = FactoryGirl.create(:recording_like, user: @user, claimed_recording: claimed_recording1, recording: claimed_recording1.recording, favorite: true) + like = FactoryBot.create(:recording_like, user: @user, claimed_recording: claimed_recording1, recording: claimed_recording1.recording, favorite: true) favorites, start = ClaimedRecording.index_favorites(@user, user: @user.id) favorites.length.should == 1 @@ -182,11 +182,11 @@ describe ClaimedRecording do end it "pagination" do - claimed_recording1 = FactoryGirl.create(:claimed_recording, user: @user) - claimed_recording2 = FactoryGirl.create(:claimed_recording, user: @user) + claimed_recording1 = FactoryBot.create(:claimed_recording, user: @user) + claimed_recording2 = FactoryBot.create(:claimed_recording, user: @user) - like1 = FactoryGirl.create(:recording_like, user: @user, claimed_recording: claimed_recording1, recording: claimed_recording1.recording, favorite: true) - like2 = FactoryGirl.create(:recording_like, user: @user, claimed_recording: claimed_recording2, recording: claimed_recording2.recording, favorite: true) + like1 = FactoryBot.create(:recording_like, user: @user, claimed_recording: claimed_recording1, recording: claimed_recording1.recording, favorite: true) + like2 = FactoryBot.create(:recording_like, user: @user, claimed_recording: claimed_recording2, recording: claimed_recording2.recording, favorite: true) favorites, start = ClaimedRecording.index_favorites(@user, user: @user.id, limit:1) favorites.length.should == 1 diff --git a/ruby/spec/jam_ruby/models/connection_spec.rb b/ruby/spec/jam_ruby/models/connection_spec.rb index bd11fa66c..465b3716a 100644 --- a/ruby/spec/jam_ruby/models/connection_spec.rb +++ b/ruby/spec/jam_ruby/models/connection_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' describe JamRuby::Connection do - let(:user) { FactoryGirl.create(:user) } - let (:music_session) { FactoryGirl.create(:active_music_session, :creator => user) } - let (:conn) { FactoryGirl.create(:connection, + let(:user) { FactoryBot.create(:user) } + let (:music_session) { FactoryBot.create(:active_music_session, :creator => user) } + let (:conn) { FactoryBot.create(:connection, :user => user, :music_session => music_session, :ip_address => "1.1.1.1", @@ -12,7 +12,7 @@ describe JamRuby::Connection do let(:tracks) { [{'sound' => 'mono', 'client_track_id' => 'abc', 'instrument_id' => 'piano'}] } it 'starts in the correct state' do - connection = FactoryGirl.create(:connection, + connection = FactoryBot.create(:connection, :user => user, :music_session => music_session, :ip_address => "1.1.1.1", @@ -22,7 +22,7 @@ describe JamRuby::Connection do end it 'transitions properly' do - connection = FactoryGirl.create(:connection, + connection = FactoryBot.create(:connection, :user => user, :music_session => music_session, :ip_address => "1.1.1.1", @@ -42,11 +42,11 @@ describe JamRuby::Connection do it 'updates user lat/lng' do pending 'distance search changes' - uu = FactoryGirl.create(:user) + uu = FactoryBot.create(:user) uu.lat.should == nil - msess = FactoryGirl.create(:active_music_session, :creator => uu) - geocode = FactoryGirl.create(:geocoder) - connection = FactoryGirl.create(:connection, + msess = FactoryBot.create(:active_music_session, :creator => uu) + geocode = FactoryBot.create(:geocoder) + connection = FactoryBot.create(:connection, :user => uu, :music_session => msess, :ip_address => "1.1.1.1", @@ -91,7 +91,7 @@ describe JamRuby::Connection do end it "verify that online up/down is only for affected user (no spillover)" do - user2 = FactoryGirl.create(:user) + user2 = FactoryBot.create(:user) user2.online.should be_false conn.touch @@ -101,7 +101,7 @@ describe JamRuby::Connection do user.online.should be_true user2.online.should be_false # make sure there is no spillover to unrelated users - conn2 = FactoryGirl.create(:connection, + conn2 = FactoryBot.create(:connection, :user => user2, :music_session => music_session, :ip_address => "1.1.1.1", @@ -129,7 +129,7 @@ describe JamRuby::Connection do it "n connections" do conn.touch - conn2 = FactoryGirl.create(:connection, + conn2 = FactoryBot.create(:connection, :user => user, :music_session => music_session, :ip_address => "1.1.1.1", diff --git a/ruby/spec/jam_ruby/models/diagnostic_spec.rb b/ruby/spec/jam_ruby/models/diagnostic_spec.rb index 8900deb21..873584042 100644 --- a/ruby/spec/jam_ruby/models/diagnostic_spec.rb +++ b/ruby/spec/jam_ruby/models/diagnostic_spec.rb @@ -1,15 +1,15 @@ require 'spec_helper' describe Diagnostic do - let (:user) { FactoryGirl.create(:user) } - let (:diagnostic) { FactoryGirl.create(:diagnostic, user: user) } + let (:user) { FactoryBot.create(:user) } + let (:diagnostic) { FactoryBot.create(:diagnostic, user: user) } it 'can be made' do diagnostic.save! end it "validates type" do - diagnostic = FactoryGirl.build(:diagnostic, user: user, type: 'bleh') + diagnostic = FactoryBot.build(:diagnostic, user: user, type: 'bleh') diagnostic.errors[:type].should == [] diff --git a/ruby/spec/jam_ruby/models/download_tracker_spec.rb b/ruby/spec/jam_ruby/models/download_tracker_spec.rb index 041abdf04..e6fe1e660 100644 --- a/ruby/spec/jam_ruby/models/download_tracker_spec.rb +++ b/ruby/spec/jam_ruby/models/download_tracker_spec.rb @@ -2,15 +2,15 @@ require 'spec_helper' describe DownloadTracker do - let(:user1) {FactoryGirl.create(:user)} - let(:user2) {FactoryGirl.create(:user)} - let(:user3) {FactoryGirl.create(:user)} - let(:jam_track) {FactoryGirl.create(:jam_track)} + let(:user1) {FactoryBot.create(:user)} + let(:user2) {FactoryBot.create(:user)} + let(:user3) {FactoryBot.create(:user)} + let(:jam_track) {FactoryBot.create(:jam_track)} describe "check_user_sharer" do describe "with max 1" do it "and there is one row that is not paid for" do - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') results = DownloadTracker.check_user_sharer(1) results.all.length.should eq 1 @@ -21,21 +21,21 @@ describe DownloadTracker do describe "with max 2" do it "and there is one row that is not paid for" do - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') results = DownloadTracker.check_user_sharer(2) results.all.length.should eq 0 # and then add that same user at different IP, and see that something shows up - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '2.2.2.2') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '2.2.2.2') results = DownloadTracker.check_user_sharer(2) results.all.length.should eq 1 end it "and there are two rows from different IP address, different jam tracks" do - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '2.2.2.2') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '2.2.2.2') results = DownloadTracker.check_user_sharer(2) results.all.length.should eq 1 @@ -43,7 +43,7 @@ describe DownloadTracker do results[0]['count'].should eql 2 # now add a second user with one of the previous IP addresses; shouldn't matter yet - tracker1 = FactoryGirl.create(:download_tracker, user: user2, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user2, paid: false, remote_ip: '1.1.1.1') results = DownloadTracker.check_user_sharer(2) results.all.length.should eq 1 @@ -52,18 +52,18 @@ describe DownloadTracker do end it "and there are two rows from same IP adresss, same jam track" do - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1', jam_track: jam_track) - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1', jam_track: jam_track) + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1', jam_track: jam_track) + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1', jam_track: jam_track) results = DownloadTracker.check_user_sharer(2) results.all.length.should eq 0 - tracker1 = FactoryGirl.create(:download_tracker, user: user2, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user2, paid: false, remote_ip: '1.1.1.1') results = DownloadTracker.check_user_sharer(2) results.all.length.should eq 0 - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '2.2.2.2') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '2.2.2.2') results = DownloadTracker.check_user_sharer(2) results.all.length.should eq 1 @@ -72,8 +72,8 @@ describe DownloadTracker do end it "and there are two rows from same user one paid for, one not" do - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: true, remote_ip: '1.1.1.1') - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '2.2.2.2') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: true, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '2.2.2.2') results = DownloadTracker.check_user_sharer(2) results.all.length.should eq 1 @@ -86,14 +86,14 @@ describe DownloadTracker do describe "with max 1" do it "and there is one row that is not paid for" do - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') results = DownloadTracker.check_freebie_snarfer(1) results.all.length.should eq 1 end it "and there is one row that is paid for" do - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: true, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: true, remote_ip: '1.1.1.1') results = DownloadTracker.check_freebie_snarfer(1) results.all.length.should eq 0 @@ -102,28 +102,28 @@ describe DownloadTracker do describe "with max 2" do it "and there is one row that is not paid for" do - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') results = DownloadTracker.check_freebie_snarfer(2) results.all.length.should eq 0 # and then add a second user at same IP, and see that something shows up - tracker1 = FactoryGirl.create(:download_tracker, user: user2, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user2, paid: false, remote_ip: '1.1.1.1') results = DownloadTracker.check_freebie_snarfer(2) results.all.length.should eq 1 end it "and there are two rows from same user, different jam tracks" do - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') results = DownloadTracker.check_freebie_snarfer(2) results.all.length.should eq 1 results[0]['remote_ip'].should eql('1.1.1.1') results[0]['count'].should eql 2 - tracker1 = FactoryGirl.create(:download_tracker, user: user2, paid: false, remote_ip: '2.2.2.2') + tracker1 = FactoryBot.create(:download_tracker, user: user2, paid: false, remote_ip: '2.2.2.2') results = DownloadTracker.check_freebie_snarfer(2) results.all.length.should eq 1 @@ -132,17 +132,17 @@ describe DownloadTracker do end it "and there are two rows from same user, same jam track" do - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1', jam_track: jam_track) - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1', jam_track: jam_track) + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1', jam_track: jam_track) + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1', jam_track: jam_track) results = DownloadTracker.check_freebie_snarfer(2) results.all.length.should eq 0 - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '2.2.2.2') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '2.2.2.2') results = DownloadTracker.check_freebie_snarfer(2) results.all.length.should eq 0 - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') results = DownloadTracker.check_freebie_snarfer(2) results.all.length.should eq 1 @@ -151,8 +151,8 @@ describe DownloadTracker do end it "and there are two rows from same user one paid for, one not" do - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: true, remote_ip: '1.1.1.1') - tracker1 = FactoryGirl.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: true, remote_ip: '1.1.1.1') + tracker1 = FactoryBot.create(:download_tracker, user: user1, paid: false, remote_ip: '1.1.1.1') results = DownloadTracker.check_freebie_snarfer(2) results.all.length.should eq 0 diff --git a/ruby/spec/jam_ruby/models/email_batch_spec.rb b/ruby/spec/jam_ruby/models/email_batch_spec.rb index de0d85aa3..5e0d54662 100644 --- a/ruby/spec/jam_ruby/models/email_batch_spec.rb +++ b/ruby/spec/jam_ruby/models/email_batch_spec.rb @@ -16,7 +16,7 @@ describe EmailBatch do # before { pending } - let (:email_batch) { FactoryGirl.create(:email_batch) } + let (:email_batch) { FactoryBot.create(:email_batch) } before(:each) do BatchMailer.deliveries.clear @@ -35,13 +35,13 @@ describe EmailBatch do describe 'new musician' do before { pending } - let (:new_musician_batch) { FactoryGirl.create(:email_batch_new_musician) } + let (:new_musician_batch) { FactoryBot.create(:email_batch_new_musician) } before(:each) do - @u1 = FactoryGirl.create(:user, :lat => 37.791649, :lng => -122.394395, :email => 'jonathan@jamkazam.com', :subscribe_email => true, :created_at => Time.now - 3.weeks) - @u2 = FactoryGirl.create(:user, :lat => 37.791649, :lng => -122.394395, :subscribe_email => true) - @u3 = FactoryGirl.create(:user, :lat => 37.791649, :lng => -122.394395, :subscribe_email => false, :created_at => Time.now - 3.weeks) - @u4 = FactoryGirl.create(:user, :lat => 37.791649, :lng => -122.394395, :subscribe_email => true, :created_at => Time.now - 3.weeks) + @u1 = FactoryBot.create(:user, :lat => 37.791649, :lng => -122.394395, :email => 'jonathan@jamkazam.com', :subscribe_email => true, :created_at => Time.now - 3.weeks) + @u2 = FactoryBot.create(:user, :lat => 37.791649, :lng => -122.394395, :subscribe_email => true) + @u3 = FactoryBot.create(:user, :lat => 37.791649, :lng => -122.394395, :subscribe_email => false, :created_at => Time.now - 3.weeks) + @u4 = FactoryBot.create(:user, :lat => 37.791649, :lng => -122.394395, :subscribe_email => true, :created_at => Time.now - 3.weeks) end it 'find new musicians with good score' do @@ -153,11 +153,11 @@ describe EmailBatch do describe 'client_notdl' do # before { pending } let(:batchp) { - FactoryGirl.create(:email_batch_progression, :sub_type => :client_notdl) + FactoryBot.create(:email_batch_progression, :sub_type => :client_notdl) } - let(:user_) { FactoryGirl.create(:user) } + let(:user_) { FactoryBot.create(:user) } let(:user_existing) { - FactoryGirl.create(:user, + FactoryBot.create(:user, :created_at => Time.now - (2 * batchp.days_past_for_trigger_index(2)).days) } after(:each) do @@ -178,7 +178,7 @@ describe EmailBatch do end it 'loops bunch of users' do users = [] - 3.times { |nn| users << FactoryGirl.create(:user) } + 3.times { |nn| users << FactoryBot.create(:user) } loops_bunch_of_users(batchp, users) end end @@ -186,12 +186,12 @@ describe EmailBatch do describe 'client_dl_notrun' do # before { pending } let(:batchp) { - FactoryGirl.create(:email_batch_progression, :sub_type => :client_dl_notrun) + FactoryBot.create(:email_batch_progression, :sub_type => :client_dl_notrun) } - let(:user_) { FactoryGirl.create(:user, :first_downloaded_client_at => Time.now) } + let(:user_) { FactoryBot.create(:user, :first_downloaded_client_at => Time.now) } let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days } let(:user_existing) { - FactoryGirl.create(:user, + FactoryBot.create(:user, :created_at => date_in_past, :first_downloaded_client_at => date_in_past) } @@ -213,7 +213,7 @@ describe EmailBatch do end it 'loops bunch of users' do users = [] - 3.times { |nn| users << FactoryGirl.create(:user, :first_downloaded_client_at => Time.now) } + 3.times { |nn| users << FactoryBot.create(:user, :first_downloaded_client_at => Time.now) } loops_bunch_of_users(batchp, users) end end @@ -221,12 +221,12 @@ describe EmailBatch do describe 'client_run_notgear' do # before { pending } let(:batchp) { - FactoryGirl.create(:email_batch_progression, :sub_type => :client_run_notgear) + FactoryBot.create(:email_batch_progression, :sub_type => :client_run_notgear) } - let(:user_) { FactoryGirl.create(:user, :first_ran_client_at => Time.now) } + let(:user_) { FactoryBot.create(:user, :first_ran_client_at => Time.now) } let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days } let(:user_existing) { - FactoryGirl.create(:user, + FactoryBot.create(:user, :created_at => date_in_past, :first_ran_client_at => date_in_past) } @@ -248,7 +248,7 @@ describe EmailBatch do end it 'loops bunch of users' do users = [] - 3.times { |nn| users << FactoryGirl.create(:user, :first_ran_client_at => Time.now) } + 3.times { |nn| users << FactoryBot.create(:user, :first_ran_client_at => Time.now) } loops_bunch_of_users(batchp, users) end end @@ -256,12 +256,12 @@ describe EmailBatch do describe 'gear_notsess' do # before { pending } let(:batchp) { - FactoryGirl.create(:email_batch_progression, :sub_type => :gear_notsess) + FactoryBot.create(:email_batch_progression, :sub_type => :gear_notsess) } - let(:user_) { FactoryGirl.create(:user, :first_certified_gear_at => Time.now) } + let(:user_) { FactoryBot.create(:user, :first_certified_gear_at => Time.now) } let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days } let(:user_existing) { - FactoryGirl.create(:user, + FactoryBot.create(:user, :created_at => date_in_past, :first_certified_gear_at => date_in_past) } @@ -283,7 +283,7 @@ describe EmailBatch do end it 'loops bunch of users' do users = [] - 3.times { |nn| users << FactoryGirl.create(:user, :first_certified_gear_at => Time.now) } + 3.times { |nn| users << FactoryBot.create(:user, :first_certified_gear_at => Time.now) } loops_bunch_of_users(batchp, users) end end @@ -291,12 +291,12 @@ describe EmailBatch do describe 'sess_notgood' do # before { pending } let(:batchp) { - FactoryGirl.create(:email_batch_progression, :sub_type => :sess_notgood) + FactoryBot.create(:email_batch_progression, :sub_type => :sess_notgood) } - let(:user_) { FactoryGirl.create(:user, :first_real_music_session_at => Time.now) } + let(:user_) { FactoryBot.create(:user, :first_real_music_session_at => Time.now) } let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days } let(:user_existing) { - FactoryGirl.create(:user, + FactoryBot.create(:user, :created_at => date_in_past, :first_real_music_session_at => date_in_past) } @@ -318,7 +318,7 @@ describe EmailBatch do end it 'loops bunch of users' do users = [] - 3.times { |nn| users << FactoryGirl.create(:user, :first_real_music_session_at => Time.now) } + 3.times { |nn| users << FactoryBot.create(:user, :first_real_music_session_at => Time.now) } loops_bunch_of_users(batchp, users) end end @@ -326,12 +326,12 @@ describe EmailBatch do describe 'sess_notrecord' do # before { pending } let(:batchp) { - FactoryGirl.create(:email_batch_progression, :sub_type => :sess_notrecord) + FactoryBot.create(:email_batch_progression, :sub_type => :sess_notrecord) } - let(:user_) { FactoryGirl.create(:user, :first_real_music_session_at => Time.now) } + let(:user_) { FactoryBot.create(:user, :first_real_music_session_at => Time.now) } let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days } let(:user_existing) { - FactoryGirl.create(:user, + FactoryBot.create(:user, :created_at => date_in_past, :first_real_music_session_at => date_in_past) } @@ -353,7 +353,7 @@ describe EmailBatch do end it 'loops bunch of users' do users = [] - 3.times { |nn| users << FactoryGirl.create(:user, :first_real_music_session_at => Time.now) } + 3.times { |nn| users << FactoryBot.create(:user, :first_real_music_session_at => Time.now) } loops_bunch_of_users(batchp, users) end end @@ -361,12 +361,12 @@ describe EmailBatch do describe 'reg_notinvite' do # before { pending } let(:batchp) { - FactoryGirl.create(:email_batch_progression, :sub_type => :reg_notinvite) + FactoryBot.create(:email_batch_progression, :sub_type => :reg_notinvite) } - let(:user_) { FactoryGirl.create(:user) } + let(:user_) { FactoryBot.create(:user) } let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days } let(:user_existing) { - FactoryGirl.create(:user, + FactoryBot.create(:user, :created_at => date_in_past) } after(:each) do @@ -387,7 +387,7 @@ describe EmailBatch do end it 'loops bunch of users' do users = [] - 3.times { |nn| users << FactoryGirl.create(:user) } + 3.times { |nn| users << FactoryBot.create(:user) } loops_bunch_of_users(batchp, users) end end @@ -395,12 +395,12 @@ describe EmailBatch do describe 'reg_notconnect' do # before { pending } let(:batchp) { - FactoryGirl.create(:email_batch_progression, :sub_type => :reg_notconnect) + FactoryBot.create(:email_batch_progression, :sub_type => :reg_notconnect) } - let(:user_) { FactoryGirl.create(:user) } + let(:user_) { FactoryBot.create(:user) } let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days } let(:user_existing) { - FactoryGirl.create(:user, + FactoryBot.create(:user, :created_at => date_in_past) } after(:each) do @@ -421,7 +421,7 @@ describe EmailBatch do end it 'loops bunch of users' do users = [] - 3.times { |nn| users << FactoryGirl.create(:user) } + 3.times { |nn| users << FactoryBot.create(:user) } loops_bunch_of_users(batchp, users) end end @@ -429,12 +429,12 @@ describe EmailBatch do describe 'reg_notlike' do # before { pending } let(:batchp) { - FactoryGirl.create(:email_batch_progression, :sub_type => :reg_notlike) + FactoryBot.create(:email_batch_progression, :sub_type => :reg_notlike) } - let(:user_) { FactoryGirl.create(:user) } + let(:user_) { FactoryBot.create(:user) } let(:date_in_past) { Time.now - (2 * batchp.days_past_for_trigger_index(2)).days } let(:user_existing) { - FactoryGirl.create(:user, + FactoryBot.create(:user, :created_at => date_in_past) } after(:each) do @@ -455,7 +455,7 @@ describe EmailBatch do end it 'loops bunch of users' do users = [] - 3.times { |nn| users << FactoryGirl.create(:user) } + 3.times { |nn| users << FactoryBot.create(:user) } loops_bunch_of_users(batchp, users) end end diff --git a/ruby/spec/jam_ruby/models/email_batch_spec_new_musicians.rb b/ruby/spec/jam_ruby/models/email_batch_spec_new_musicians.rb index 1366db5ab..d4270ff67 100644 --- a/ruby/spec/jam_ruby/models/email_batch_spec_new_musicians.rb +++ b/ruby/spec/jam_ruby/models/email_batch_spec_new_musicians.rb @@ -15,7 +15,7 @@ describe EmailBatchNewMusician do let (:batch_created_at) { Time.now - 1.day - # FactoryGirl.create(:email_batch_new_musician, :created_at => Time.now - 1.day) + # FactoryBot.create(:email_batch_new_musician, :created_at => Time.now - 1.day) } let (:receiver_date) { @@ -23,29 +23,29 @@ describe EmailBatchNewMusician do } let (:receiver1) { - FactoryGirl.create(:user, + FactoryBot.create(:user, :created_at => receiver_date, :last_jam_locidispid => 1, :last_jam_addr => 1 ) } let (:receiver2) { - FactoryGirl.create(:user, + FactoryBot.create(:user, :created_at => receiver_date, :last_jam_locidispid => 3, :last_jam_addr => 3 ) } - let (:drummer) { FactoryGirl.create(:user, :last_jam_locidispid => 1, :created_at => batch_created_at - 1.hour) } - let (:guitarist) { FactoryGirl.create(:user, :last_jam_locidispid => 1, :created_at => batch_created_at - 1.hour) } - let (:bassist) { FactoryGirl.create(:user, :last_jam_locidispid => 1, :created_at => batch_created_at - 1.hour) } - let (:vocalist) { FactoryGirl.create(:user, :last_jam_locidispid => 1, :created_at => batch_created_at - 1.hour) } - let (:loser) { FactoryGirl.create(:user, :last_jam_locidispid => 2, :created_at => batch_created_at - 1.hour) } - let (:drummer3) { FactoryGirl.create(:user, :last_jam_locidispid => 3, :created_at => batch_created_at - 1.hour) } - let (:guitarist3) { FactoryGirl.create(:user, :last_jam_locidispid => 3, :created_at => batch_created_at - 1.hour) } - let (:bassist3) { FactoryGirl.create(:user, :last_jam_locidispid => 3, :created_at => batch_created_at - 1.hour) } - let (:vocalist3) { FactoryGirl.create(:user, :last_jam_locidispid => 3, :created_at => batch_created_at - 1.hour) } + let (:drummer) { FactoryBot.create(:user, :last_jam_locidispid => 1, :created_at => batch_created_at - 1.hour) } + let (:guitarist) { FactoryBot.create(:user, :last_jam_locidispid => 1, :created_at => batch_created_at - 1.hour) } + let (:bassist) { FactoryBot.create(:user, :last_jam_locidispid => 1, :created_at => batch_created_at - 1.hour) } + let (:vocalist) { FactoryBot.create(:user, :last_jam_locidispid => 1, :created_at => batch_created_at - 1.hour) } + let (:loser) { FactoryBot.create(:user, :last_jam_locidispid => 2, :created_at => batch_created_at - 1.hour) } + let (:drummer3) { FactoryBot.create(:user, :last_jam_locidispid => 3, :created_at => batch_created_at - 1.hour) } + let (:guitarist3) { FactoryBot.create(:user, :last_jam_locidispid => 3, :created_at => batch_created_at - 1.hour) } + let (:bassist3) { FactoryBot.create(:user, :last_jam_locidispid => 3, :created_at => batch_created_at - 1.hour) } + let (:vocalist3) { FactoryBot.create(:user, :last_jam_locidispid => 3, :created_at => batch_created_at - 1.hour) } before(:each) do drummer; guitarist; bassist; vocalist; loser @@ -59,7 +59,7 @@ describe EmailBatchNewMusician do end it 'sets up data properly' do - ebatch0 = FactoryGirl.create(:email_batch_new_musician, + ebatch0 = FactoryBot.create(:email_batch_new_musician, :created_at => batch_created_at) results = ebatch0.fetch_recipients @@ -79,7 +79,7 @@ describe EmailBatchNewMusician do end it 'sends email' do - ebatch0 = FactoryGirl.create(:email_batch_new_musician, + ebatch0 = FactoryBot.create(:email_batch_new_musician, :created_at => batch_created_at) ebatch0.deliver_batch num = User.where(:last_jam_locidispid => 1) @@ -88,22 +88,22 @@ describe EmailBatchNewMusician do expect(num).to be > 0 expect(UserMailer.deliveries.length).to eq(num) - ebatch1 = FactoryGirl.create(:email_batch_new_musician, + ebatch1 = FactoryBot.create(:email_batch_new_musician, :created_at => ebatch0.created_at + 1.day) # new musicians - FactoryGirl.create(:user, + FactoryBot.create(:user, :last_jam_locidispid => 5, :created_at => ebatch0.created_at + 1.minute) - FactoryGirl.create(:user, + FactoryBot.create(:user, :last_jam_locidispid => 5, :created_at => ebatch1.created_at - 1.minute) JamRuby::Score.createx(1, 'a', 1, 5, 'a', 5, 10) # decoy JamRuby::Score.createx(1, 'a', 1, 3, 'a', 3, Score::MAX_YELLOW_LATENCY + 1) - FactoryGirl.create(:user, + FactoryBot.create(:user, :last_jam_locidispid => 2, :created_at => ebatch1.created_at - 1.minute) - FactoryGirl.create(:user, + FactoryBot.create(:user, :last_jam_locidispid => 3, :created_at => ebatch1.created_at - 1.minute) @@ -142,7 +142,7 @@ describe EmailBatchNewMusician do JamRuby::Score.createx(1, 'a', 1, 4, 'a', 4, 10) JamRuby::Score.createx(2, 'a', 2, 4, 'a', 4, 10) - ebatch0 = FactoryGirl.create(:email_batch_new_musician, :created_at => batch_created_at) + ebatch0 = FactoryBot.create(:email_batch_new_musician, :created_at => batch_created_at) results = ebatch0.fetch_recipients expect(results.count).to eq(2) user, new_musicians = results.detect { |rr| rr[0].id == receiver1.id } @@ -152,21 +152,21 @@ describe EmailBatchNewMusician do end it 'handles large batches' do - ebatch0 = FactoryGirl.create(:email_batch_new_musician, :created_at => receiver_date) + ebatch0 = FactoryBot.create(:email_batch_new_musician, :created_at => receiver_date) dd = ebatch0.created_at - 1.day 20.downto(1) do |nn| - FactoryGirl.create(:user, :last_jam_locidispid => 5, :created_at => dd) + FactoryBot.create(:user, :last_jam_locidispid => 5, :created_at => dd) end 10.downto(1) do |nn| - FactoryGirl.create(:user, :last_jam_locidispid => 6, + FactoryBot.create(:user, :last_jam_locidispid => 6, :created_at => ebatch0.created_at + 1.hour) end JamRuby::Score.delete_all JamRuby::Score.connection.execute('delete from current_network_scores').check JamRuby::Score.createx(5, 'a', 5, 6, 'a', 6, 10) JamRuby::Score.createx(5, 'a', 5, 7, 'a', 7, Score::MAX_YELLOW_LATENCY + 1) - FactoryGirl.create(:user, :last_jam_locidispid => 8, :created_at => dd) - FactoryGirl.create(:user, :last_jam_locidispid => 7) + FactoryBot.create(:user, :last_jam_locidispid => 8, :created_at => dd) + FactoryBot.create(:user, :last_jam_locidispid => 7) receivers = [] ebatch0.fetch_recipients(3) do |uu, newm| diff --git a/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb b/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb index 805799df0..c7487e58e 100644 --- a/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb +++ b/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb @@ -19,7 +19,7 @@ describe EmailBatchScheduledSessions do describe 'daily scheduled' do # before { pending } - let (:scheduled_batch) { FactoryGirl.create(:email_batch_scheduled_session) } + let (:scheduled_batch) { FactoryBot.create(:email_batch_scheduled_session) } let (:drums) { Instrument.find('drums') } let (:guitar) { Instrument.find('acoustic guitar') } @@ -27,17 +27,17 @@ describe EmailBatchScheduledSessions do let (:vocals) { Instrument.find('voice') } let (:electric_guitar) { Instrument.find('electric guitar')} - let (:drummer) { FactoryGirl.create(:user, first_name: 'drummer', :last_jam_locidispid => 1, :last_jam_addr => 1, specific_instruments: [drums, guitar]) } - let (:guitarist) { FactoryGirl.create(:user, first_name: 'guitarist', :last_jam_locidispid => 1, :last_jam_addr => 1, specific_instruments: [guitar, drums]) } - let (:bassist) { FactoryGirl.create(:user, first_name: 'bassist', :last_jam_locidispid => 1, :last_jam_addr => 1, specific_instruments: [bass]) } - let (:vocalist) { FactoryGirl.create(:user, first_name: 'vocalist', :last_jam_locidispid => 1, :last_jam_addr => 1, specific_instruments: [vocals, electric_guitar]) } - let (:loser) { FactoryGirl.create(:user, first_name: 'loser', :last_jam_locidispid => 2, :last_jam_addr => 2, specific_instruments: [vocals, drums]) } + let (:drummer) { FactoryBot.create(:user, first_name: 'drummer', :last_jam_locidispid => 1, :last_jam_addr => 1, specific_instruments: [drums, guitar]) } + let (:guitarist) { FactoryBot.create(:user, first_name: 'guitarist', :last_jam_locidispid => 1, :last_jam_addr => 1, specific_instruments: [guitar, drums]) } + let (:bassist) { FactoryBot.create(:user, first_name: 'bassist', :last_jam_locidispid => 1, :last_jam_addr => 1, specific_instruments: [bass]) } + let (:vocalist) { FactoryBot.create(:user, first_name: 'vocalist', :last_jam_locidispid => 1, :last_jam_addr => 1, specific_instruments: [vocals, electric_guitar]) } + let (:loser) { FactoryBot.create(:user, first_name: 'loser', :last_jam_locidispid => 2, :last_jam_addr => 2, specific_instruments: [vocals, drums]) } - let (:session3_creator) {FactoryGirl.create(:user, first_name: 'session3_creator', :last_jam_locidispid => 3, :last_jam_addr => 3, specific_instruments: [vocals]) } - let (:session4_creator) {FactoryGirl.create(:user, first_name: 'session4_creator', :last_jam_locidispid => 4, :last_jam_addr => 4, specific_instruments: [vocals]) } + let (:session3_creator) {FactoryBot.create(:user, first_name: 'session3_creator', :last_jam_locidispid => 3, :last_jam_addr => 3, specific_instruments: [vocals]) } + let (:session4_creator) {FactoryBot.create(:user, first_name: 'session4_creator', :last_jam_locidispid => 4, :last_jam_addr => 4, specific_instruments: [vocals]) } let (:session1) do - FactoryGirl.create(:music_session, + FactoryBot.create(:music_session, :creator => drummer, :scheduled_start => Time.now() + 2.days, :open_rsvps=> true, @@ -45,7 +45,7 @@ describe EmailBatchScheduledSessions do :created_at => Time.now - 1.hour) end let (:session2) do - FactoryGirl.create(:music_session, + FactoryBot.create(:music_session, :creator => drummer, :open_rsvps => false, :is_unstructured_rsvp => false, @@ -53,7 +53,7 @@ describe EmailBatchScheduledSessions do :created_at => Time.now - 1.hour) end let (:session3) do - FactoryGirl.create(:music_session, + FactoryBot.create(:music_session, :creator => session3_creator, :open_rsvps => true, :is_unstructured_rsvp => true, @@ -61,7 +61,7 @@ describe EmailBatchScheduledSessions do :created_at => Time.now - 1.hour) end let (:session4) do - FactoryGirl.create(:music_session, + FactoryBot.create(:music_session, :creator => session4_creator, :open_rsvps => true, :is_unstructured_rsvp => true, @@ -76,15 +76,15 @@ describe EmailBatchScheduledSessions do JamRuby::Score.connection.execute('delete from current_network_scores').check scheduled_batch.reset! - @drums_rsvp_slot = FactoryGirl.create(:rsvp_slot, :instrument => drums, :music_session => session1) - @guitar_rsvp_slot = FactoryGirl.create(:rsvp_slot, :instrument => guitar, :music_session => session1) - @bass_rsvp_slot = FactoryGirl.create(:rsvp_slot, :instrument => bass, :music_session => session1) - FactoryGirl.create(:rsvp_slot, :instrument => drums, :music_session => session2) - FactoryGirl.create(:rsvp_slot, :instrument => guitar, :music_session => session2) - FactoryGirl.create(:rsvp_slot, :instrument => bass, :music_session => session2) - # oo = FactoryGirl.create(:rsvp_slot, :instrument => vocals, :music_session => session1) + @drums_rsvp_slot = FactoryBot.create(:rsvp_slot, :instrument => drums, :music_session => session1) + @guitar_rsvp_slot = FactoryBot.create(:rsvp_slot, :instrument => guitar, :music_session => session1) + @bass_rsvp_slot = FactoryBot.create(:rsvp_slot, :instrument => bass, :music_session => session1) + FactoryBot.create(:rsvp_slot, :instrument => drums, :music_session => session2) + FactoryBot.create(:rsvp_slot, :instrument => guitar, :music_session => session2) + FactoryBot.create(:rsvp_slot, :instrument => bass, :music_session => session2) + # oo = FactoryBot.create(:rsvp_slot, :instrument => vocals, :music_session => session1) # oo.rsvp_request_slot.update_attributes(chosen: true) - # oo = FactoryGirl.create(:rsvp_request, :user => vocalist, :rsvp_slot => oo) + # oo = FactoryBot.create(:rsvp_request, :user => vocalist, :rsvp_slot => oo) # oo.rsvp_request_slot.update_attributes(chosen: true) expect(drummer.instruments.include?(drums)).to eq(true) @@ -161,8 +161,8 @@ describe EmailBatchScheduledSessions do describe "closes a RSVP slot in session1" do before(:each) do - request = FactoryGirl.create(:rsvp_request, user: loser) - FactoryGirl.create(:rsvp_request_rsvp_slot, chosen: true, rsvp_request: request, rsvp_slot: @bass_rsvp_slot) + request = FactoryBot.create(:rsvp_request, user: loser) + FactoryBot.create(:rsvp_request_rsvp_slot, chosen: true, rsvp_request: request, rsvp_slot: @bass_rsvp_slot) end it "finds one less" do @@ -207,8 +207,8 @@ describe EmailBatchScheduledSessions do describe "21 more sessions" do before(:each) do 20.times do |i| - creator = FactoryGirl.create(:user, :last_jam_locidispid => 1, :last_jam_addr => 1) - FactoryGirl.create(:music_session, + creator = FactoryBot.create(:user, :last_jam_locidispid => 1, :last_jam_addr => 1) + FactoryBot.create(:music_session, :creator => creator, :open_rsvps => true, :is_unstructured_rsvp => true, @@ -260,7 +260,7 @@ describe EmailBatchScheduledSessions do end describe "with invitations" do - let(:invitation) {friend(drummer, guitarist); FactoryGirl.create(:invitation, sender: drummer, receiver:guitarist, music_session: session1)} + let(:invitation) {friend(drummer, guitarist); FactoryBot.create(:invitation, sender: drummer, receiver:guitarist, music_session: session1)} before(:each) do invitation.touch @@ -284,29 +284,29 @@ describe EmailBatchScheduledSessions do it 'handles large batches' do creators = [] 8.downto(1) do |nn| - creators << uu = FactoryGirl.create(:user, :last_jam_locidispid => 5, :last_jam_addr => 5) - msess = FactoryGirl.create(:music_session, + creators << uu = FactoryBot.create(:user, :last_jam_locidispid => 5, :last_jam_addr => 5) + msess = FactoryBot.create(:music_session, :creator => uu, :scheduled_start => Time.now() + 2.days, :musician_access => true, :approval_required => false, :created_at => Time.now - 1.hour) - FactoryGirl.create(:rsvp_slot, :instrument => drums, :music_session => msess) - FactoryGirl.create(:rsvp_slot, :instrument => guitar, :music_session => msess) - FactoryGirl.create(:rsvp_slot, :instrument => bass, :music_session => msess) + FactoryBot.create(:rsvp_slot, :instrument => drums, :music_session => msess) + FactoryBot.create(:rsvp_slot, :instrument => guitar, :music_session => msess) + FactoryBot.create(:rsvp_slot, :instrument => bass, :music_session => msess) end instruments = [drums, guitar, bass] 4.downto(1) do |nn| - uu = FactoryGirl.create(:user, :last_jam_locidispid => 6, :last_jam_addr => 6) - uu.musician_instruments << FactoryGirl.build(:musician_instrument, + uu = FactoryBot.create(:user, :last_jam_locidispid => 6, :last_jam_addr => 6) + uu.musician_instruments << FactoryBot.build(:musician_instrument, player: uu, instrument: instruments.sample, proficiency_level: 2) end JamRuby::Score.createx(5, 'a', 5, 6, 'a', 6, 10) JamRuby::Score.createx(5, 'a', 5, 7, 'a', 7, Score::MAX_YELLOW_LATENCY + 1) - FactoryGirl.create(:user, :last_jam_locidispid => 8, :last_jam_addr => 8) - FactoryGirl.create(:user, :last_jam_locidispid => 7, :last_jam_addr => 7) + FactoryBot.create(:user, :last_jam_locidispid => 8, :last_jam_addr => 8) + FactoryBot.create(:user, :last_jam_locidispid => 7, :last_jam_addr => 7) receivers = [] scheduled_batch.fetch_recipients(3) do |receiver, sessions| diff --git a/ruby/spec/jam_ruby/models/email_blacklist_spec.rb b/ruby/spec/jam_ruby/models/email_blacklist_spec.rb index 35c4097df..2557effb7 100644 --- a/ruby/spec/jam_ruby/models/email_blacklist_spec.rb +++ b/ruby/spec/jam_ruby/models/email_blacklist_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe EmailBlacklist do - let(:user) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } describe "#banned" do it "returns false if no ban" do @@ -10,7 +10,7 @@ describe EmailBlacklist do end it "returns true if banned" do - FactoryGirl.create(:email_blacklist, email: user.email) + FactoryBot.create(:email_blacklist, email: user.email) EmailBlacklist.banned(user).should eq true end end diff --git a/ruby/spec/jam_ruby/models/event_session_spec.rb b/ruby/spec/jam_ruby/models/event_session_spec.rb index 947370e86..98157c132 100644 --- a/ruby/spec/jam_ruby/models/event_session_spec.rb +++ b/ruby/spec/jam_ruby/models/event_session_spec.rb @@ -3,21 +3,21 @@ require 'spec_helper' describe EventSession do it "should be creatable" do - event = FactoryGirl.create(:event) - event_session = FactoryGirl.create(:event_session, event: event) + event = FactoryBot.create(:event) + event_session = FactoryBot.create(:event_session, event: event) end it "requires a parent event" do - event_session = FactoryGirl.build(:event_session) + event_session = FactoryBot.build(:event_session) event_session.save.should be_false event_session.errors[:event].should == ["can't be blank"] end it "can't specify both band and user" do - user = FactoryGirl.create(:user) - band = FactoryGirl.create(:band) - event = FactoryGirl.create(:event) - event_session = FactoryGirl.build(:event_session, event: event, user: user, band:band) + user = FactoryBot.create(:user) + band = FactoryBot.create(:band) + event = FactoryBot.create(:event) + event_session = FactoryBot.build(:event_session, event: event, user: user, band:band) event_session.save.should be_false event_session.errors[:user].should == ["specify band, or user. not both"] end diff --git a/ruby/spec/jam_ruby/models/event_spec.rb b/ruby/spec/jam_ruby/models/event_spec.rb index 93a8629a2..cfff34b1e 100644 --- a/ruby/spec/jam_ruby/models/event_spec.rb +++ b/ruby/spec/jam_ruby/models/event_spec.rb @@ -3,19 +3,19 @@ require 'spec_helper' describe Event do it "should be creatable" do - FactoryGirl.create(:event) + FactoryBot.create(:event) end it "should not have duplicate slugs" do - event1 = FactoryGirl.create(:event) - dup = FactoryGirl.build(:event, slug: event1.slug) + event1 = FactoryBot.create(:event) + dup = FactoryBot.build(:event, slug: event1.slug) dup.save.should be_false dup.errors[:slug].should == ["has already been taken"] end it "can have associated event session, then destroy it by destroying event" do - event = FactoryGirl.create(:event) - event_session = FactoryGirl.create(:event_session, event: event) + event = FactoryBot.create(:event) + event_session = FactoryBot.create(:event_session, event: event) event.reload event.event_sessions.length.should == 1 event_session.event.should == event diff --git a/ruby/spec/jam_ruby/models/facebook_signup_spec.rb b/ruby/spec/jam_ruby/models/facebook_signup_spec.rb index c5fbbffaa..a42df9b6e 100644 --- a/ruby/spec/jam_ruby/models/facebook_signup_spec.rb +++ b/ruby/spec/jam_ruby/models/facebook_signup_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe FacebookSignup do it "does not delete new one" do - new_signup = FactoryGirl.create(:facebook_signup) + new_signup = FactoryBot.create(:facebook_signup) FacebookSignup.delete_old @@ -11,7 +11,7 @@ describe FacebookSignup do end it "does delete old one" do - old_signup = FactoryGirl.create(:facebook_signup, :created_at => 10.days.ago) + old_signup = FactoryBot.create(:facebook_signup, :created_at => 10.days.ago) FacebookSignup.delete_old diff --git a/ruby/spec/jam_ruby/models/feed_spec.rb b/ruby/spec/jam_ruby/models/feed_spec.rb index 683e64bc0..14ef89fa4 100644 --- a/ruby/spec/jam_ruby/models/feed_spec.rb +++ b/ruby/spec/jam_ruby/models/feed_spec.rb @@ -9,11 +9,11 @@ describe Feed do end - let (:user1) { FactoryGirl.create(:user) } - let (:user2) { FactoryGirl.create(:user) } - let (:user3) { FactoryGirl.create(:user) } - let (:user4) { FactoryGirl.create(:user) } - let (:band) { FactoryGirl.create(:band) } + let (:user1) { FactoryBot.create(:user) } + let (:user2) { FactoryBot.create(:user) } + let (:user3) { FactoryBot.create(:user) } + let (:user4) { FactoryBot.create(:user) } + let (:band) { FactoryBot.create(:band) } it "no result" do feeds, next_page = Feed.index(user1) @@ -21,7 +21,7 @@ describe Feed do end it "one claimed recording" do - claimed_recording = FactoryGirl.create(:claimed_recording) + claimed_recording = FactoryBot.create(:claimed_recording) MusicSessionUserHistory.delete_all # the factory makes a music_session while making the recording/claimed_recording MusicSession.delete_all # the factory makes a music_session while making the recording/claimed_recording feeds, next_page = Feed.index(user1) @@ -30,10 +30,10 @@ describe Feed do end it "two claimed recordings for the same recording should only return one" do - recording = FactoryGirl.create(:claimed_recording).recording - second_track = FactoryGirl.create(:recorded_track, recording: recording) + recording = FactoryBot.create(:claimed_recording).recording + second_track = FactoryBot.create(:recorded_track, recording: recording) recording.recorded_tracks << second_track - FactoryGirl.create(:claimed_recording, recording: recording, user: second_track.user) + FactoryBot.create(:claimed_recording, recording: recording, user: second_track.user) MusicSessionUserHistory.delete_all # the factory makes a music_session while making the recording/claimed_recording MusicSession.delete_all @@ -45,14 +45,14 @@ describe Feed do end it "one music session" do - music_session = FactoryGirl.create(:active_music_session) + music_session = FactoryBot.create(:active_music_session) feeds, next_page = Feed.index(user1) feeds.length.should == 1 feeds[0].music_session == music_session.music_session end it "does not return a recording with no claimed recordings" do - recording = FactoryGirl.create(:recording) + recording = FactoryBot.create(:recording) MusicSessionUserHistory.delete_all # the factory makes a music_session while making the recording/claimed_recording MusicSession.delete_all @@ -66,7 +66,7 @@ describe Feed do end it "sorts by active flag / index (date) DESC" do - claimed_recording = FactoryGirl.create(:claimed_recording) + claimed_recording = FactoryBot.create(:claimed_recording) feeds, next_page = Feed.index(user1) feeds.length.should == 2 @@ -75,16 +75,16 @@ describe Feed do end it "sort by active flag / plays DESC" do - claimed_recording1 = FactoryGirl.create(:claimed_recording) - claimed_recording2 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) + claimed_recording2 = FactoryBot.create(:claimed_recording) - FactoryGirl.create(:playable_play, playable: claimed_recording1.recording, claimed_recording: claimed_recording1, user:claimed_recording1.user) + FactoryBot.create(:playable_play, playable: claimed_recording1.recording, claimed_recording: claimed_recording1, user:claimed_recording1.user) feeds, next_page = Feed.index(user1, :sort => 'plays') feeds.length.should == 4 - FactoryGirl.create(:playable_play, playable: claimed_recording2.recording, claimed_recording: claimed_recording2, user:claimed_recording1.user) - FactoryGirl.create(:playable_play, playable: claimed_recording2.recording, claimed_recording: claimed_recording2, user:claimed_recording2.user) + FactoryBot.create(:playable_play, playable: claimed_recording2.recording, claimed_recording: claimed_recording2, user:claimed_recording1.user) + FactoryBot.create(:playable_play, playable: claimed_recording2.recording, claimed_recording: claimed_recording2, user:claimed_recording2.user) claimed_recording2.recording.play_count += 2 claimed_recording2.recording.save! @@ -93,9 +93,9 @@ describe Feed do feeds[0].recording.should == claimed_recording2.recording feeds[2].recording.should == claimed_recording1.recording - FactoryGirl.create(:playable_play, playable: claimed_recording2.recording.music_session.music_session, user: user1) - FactoryGirl.create(:playable_play, playable: claimed_recording2.recording.music_session.music_session, user: user2) - FactoryGirl.create(:playable_play, playable: claimed_recording2.recording.music_session.music_session, user: user3) + FactoryBot.create(:playable_play, playable: claimed_recording2.recording.music_session.music_session, user: user1) + FactoryBot.create(:playable_play, playable: claimed_recording2.recording.music_session.music_session, user: user2) + FactoryBot.create(:playable_play, playable: claimed_recording2.recording.music_session.music_session, user: user3) claimed_recording2.recording.play_count+=3 claimed_recording2.recording.save! @@ -106,16 +106,16 @@ describe Feed do end it "sort by active flag / likes DESC" do - claimed_recording1 = FactoryGirl.create(:claimed_recording) - claimed_recording2 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) + claimed_recording2 = FactoryBot.create(:claimed_recording) - FactoryGirl.create(:recording_like, recording: claimed_recording1.recording, claimed_recording: claimed_recording1, user:claimed_recording1.user) + FactoryBot.create(:recording_like, recording: claimed_recording1.recording, claimed_recording: claimed_recording1, user:claimed_recording1.user) feeds, next_page = Feed.index(user1, :sort => 'likes') feeds.length.should == 4 - FactoryGirl.create(:recording_like, recording: claimed_recording2.recording, claimed_recording: claimed_recording2, user:claimed_recording1.user) - FactoryGirl.create(:recording_like, recording: claimed_recording2.recording, claimed_recording: claimed_recording2, user:claimed_recording2.user) + FactoryBot.create(:recording_like, recording: claimed_recording2.recording, claimed_recording: claimed_recording2, user:claimed_recording1.user) + FactoryBot.create(:recording_like, recording: claimed_recording2.recording, claimed_recording: claimed_recording2, user:claimed_recording2.user) feeds, next_page = Feed.index(user1, :sort => 'likes') feeds.length.should == 4 @@ -123,9 +123,9 @@ describe Feed do feeds[0].recording.should == claimed_recording2.recording feeds[1].recording.should == claimed_recording1.recording - FactoryGirl.create(:music_session_like, music_session: claimed_recording1.recording.music_session.music_session, user: user1) - FactoryGirl.create(:music_session_like, music_session: claimed_recording1.recording.music_session.music_session, user: user2) - FactoryGirl.create(:music_session_like, music_session: claimed_recording1.recording.music_session.music_session, user: user3) + FactoryBot.create(:music_session_like, music_session: claimed_recording1.recording.music_session.music_session, user: user1) + FactoryBot.create(:music_session_like, music_session: claimed_recording1.recording.music_session.music_session, user: user2) + FactoryBot.create(:music_session_like, music_session: claimed_recording1.recording.music_session.music_session, user: user3) feeds, next_page = Feed.index(user1, :sort => 'likes') feeds.length.should == 4 @@ -138,7 +138,7 @@ describe Feed do describe "type filters" do it "returns only sessions" do # creates both recording and history record in feed - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) feeds, next_page = Feed.index(user1, :type => 'music_session') feeds.length.should == 1 @@ -147,7 +147,7 @@ describe Feed do it "returns only sessions" do # creates both recording and history record in feed - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) feeds, next_page = Feed.index(user1, :type => 'music_session') feeds.length.should == 1 @@ -158,7 +158,7 @@ describe Feed do describe "time ranges" do it "month" do # creates both recording and history record in feed - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) # move the feed entry created for the recording back more than a months ago claimed_recording1.recording.feed.created_at = 32.days.ago @@ -170,7 +170,7 @@ describe Feed do it "day" do # creates both recording and history record in feed - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) # move the feed entry created for the recording back more than a day ago claimed_recording1.recording.feed.created_at = 48.hours.ago @@ -182,7 +182,7 @@ describe Feed do it "week" do # creates both recording and history record in feed - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) # move the feed entry created for the recording back more than a months ago claimed_recording1.recording.feed.created_at = 8.days.ago @@ -194,7 +194,7 @@ describe Feed do it "all" do # creates both recording and history record in feed - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) # move the feed entry created for the recording back more than a months ago claimed_recording1.recording.feed.created_at = 700.days.ago @@ -207,7 +207,7 @@ describe Feed do describe "pagination" do it "supports date pagination" do - claimed_recording = FactoryGirl.create(:claimed_recording) + claimed_recording = FactoryBot.create(:claimed_recording) ams = ActiveMusicSession.find(claimed_recording.recording.music_session.music_session.id) ams.before_destroy @@ -231,9 +231,9 @@ describe Feed do end it "supports likes pagination" do - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) - FactoryGirl.create(:music_session_like, music_session: claimed_recording1.recording.music_session.music_session, user: user1) + FactoryBot.create(:music_session_like, music_session: claimed_recording1.recording.music_session.music_session, user: user1) options = {limit: 1, sort: 'likes'} feeds, next_page = Feed.index(user1, options) @@ -254,9 +254,9 @@ describe Feed do end it "supports plays pagination" do - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) - FactoryGirl.create(:playable_play, playable: claimed_recording1.recording.music_session.music_session, user: user1) + FactoryBot.create(:playable_play, playable: claimed_recording1.recording.music_session.music_session, user: user1) options = {limit: 1, sort: 'plays'} feeds, next_page = Feed.index(user1, options) @@ -279,7 +279,7 @@ describe Feed do describe "public feed" do it "public and private" do - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) claimed_recording1.is_public = false claimed_recording1.save! @@ -296,11 +296,11 @@ describe Feed do describe "band feeds" do it "does show other band's stuff in this feed" do - other_band = FactoryGirl.create(:band) - music_session = FactoryGirl.create(:active_music_session, band: other_band) - FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => user1) + other_band = FactoryBot.create(:band) + music_session = FactoryBot.create(:active_music_session, band: other_band) + FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => user1) - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) claimed_recording1.is_public = true claimed_recording1.recording.band = other_band claimed_recording1.recording.save! @@ -313,7 +313,7 @@ describe Feed do it "shows public recordings to you and to others" do user1.bands << band user1.save! - music_session = FactoryGirl.create(:active_music_session, band: band) + music_session = FactoryBot.create(:active_music_session, band: band) music_session.music_session.fan_access.should be_true feeds, next_page = Feed.index(user1, band: band.id) @@ -328,7 +328,7 @@ describe Feed do it "shows private sessions to you and to others" do user1.bands << band user1.save! - music_session = FactoryGirl.create(:active_music_session, band: band, fan_access: false) + music_session = FactoryBot.create(:active_music_session, band: band, fan_access: false) music_session.music_session.fan_access.should be_false feeds, next_page = Feed.index(user1, band: band.id) @@ -342,7 +342,7 @@ describe Feed do end it "shows public recordings to you and to others" do - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) claimed_recording1.is_public = true claimed_recording1.recording.band = band claimed_recording1.recording.save! @@ -358,7 +358,7 @@ describe Feed do end it "shows private recordings to you and to others" do - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) claimed_recording1.is_public = false claimed_recording1.recording.band = band claimed_recording1.recording.save! @@ -378,10 +378,10 @@ describe Feed do describe "user feeds" do it "does not show stuff from other people" do - music_session = FactoryGirl.create(:active_music_session) - FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => user2) + music_session = FactoryBot.create(:active_music_session) + FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => user2) - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) claimed_recording1.is_public = true claimed_recording1.save! @@ -390,8 +390,8 @@ describe Feed do end it "shows public sessions to you and to others" do - music_session = FactoryGirl.create(:active_music_session) - FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => user1) + music_session = FactoryBot.create(:active_music_session) + FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => user1) feeds, next_page = Feed.index(user1, user: user1.id) @@ -406,9 +406,9 @@ describe Feed do it "shows private sessions to you and to others" do - music_session = FactoryGirl.create(:active_music_session, fan_access: false) + music_session = FactoryBot.create(:active_music_session, fan_access: false) music_session.music_session.fan_access.should be_false - FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => user1) + FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => user1) feeds, next_page = Feed.index(user1, user: user1.id) feeds.length.should == 1 @@ -421,7 +421,7 @@ describe Feed do end it "shows public recordings to you and to others" do - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) claimed_recording1.is_public = true claimed_recording1.save! @@ -435,7 +435,7 @@ describe Feed do end it "shows private recordings to you and to others" do - claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1 = FactoryBot.create(:claimed_recording) claimed_recording1.is_public = false claimed_recording1.save! @@ -453,7 +453,7 @@ describe Feed do user2.bands << band user2.save! - claimed_recording1 = FactoryGirl.create(:claimed_recording, user: user2) + claimed_recording1 = FactoryBot.create(:claimed_recording, user: user2) claimed_recording1.is_public = true claimed_recording1.recording.band = band claimed_recording1.recording.save! @@ -481,7 +481,7 @@ describe Feed do describe "deleted recording" do it "should not show" do - claimed_recording = FactoryGirl.create(:claimed_recording) + claimed_recording = FactoryBot.create(:claimed_recording) MusicSessionUserHistory.delete_all # the factory makes a music_session while making the recording/claimed_recording MusicSession.delete_all # the factory makes a music_session while making the recording/claimed_recording recording = claimed_recording.recording diff --git a/ruby/spec/jam_ruby/models/friendship_spec.rb b/ruby/spec/jam_ruby/models/friendship_spec.rb index 8fabe66b2..d112442cf 100644 --- a/ruby/spec/jam_ruby/models/friendship_spec.rb +++ b/ruby/spec/jam_ruby/models/friendship_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe Friendship do - let(:user1) { FactoryGirl.create(:user) } - let(:user2) { FactoryGirl.create(:user) } + let(:user1) { FactoryBot.create(:user) } + let(:user2) { FactoryBot.create(:user) } before(:each) do Friendship.save_using_models(user1, user2) @@ -20,8 +20,8 @@ describe Friendship do end it "should accept a single request" do - user1 = FactoryGirl.create(:user) - user2 = FactoryGirl.create(:user) + user1 = FactoryBot.create(:user) + user2 = FactoryBot.create(:user) req1 = FriendRequest.new req1.user = user1 @@ -35,8 +35,8 @@ describe Friendship do end it "should update duplicate requests" do - user1 = FactoryGirl.create(:user) - user2 = FactoryGirl.create(:user) + user1 = FactoryBot.create(:user) + user2 = FactoryBot.create(:user) req1 = FriendRequest.new req1.user = user1 diff --git a/ruby/spec/jam_ruby/models/get_work_spec.rb b/ruby/spec/jam_ruby/models/get_work_spec.rb index ed134c5c8..81003a938 100644 --- a/ruby/spec/jam_ruby/models/get_work_spec.rb +++ b/ruby/spec/jam_ruby/models/get_work_spec.rb @@ -13,7 +13,7 @@ describe GetWork do describe "get_work_list" do it "selects no score when no other clients" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) score_location(austin_geo[:locidispid], dallas_geo[:locidispid], 20) @@ -21,8 +21,8 @@ describe GetWork do end it "selects unscored location" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) GetWork.get_work_list(my_connection).should == [other_connection.client_id] GetWork.get_work_list(other_connection).should == [my_connection.client_id] @@ -31,8 +31,8 @@ describe GetWork do it "skips scored location" do score_location(austin_geo[:locidispid], dallas_geo[:locidispid], 20) - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) GetWork.get_work_list(my_connection).should == [] GetWork.get_work_list(other_connection).should == [] @@ -43,8 +43,8 @@ describe GetWork do # age the scores Score.connection.execute("UPDATE scores SET score_dt = score_dt - INTERVAL '200 hours'") - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) GetWork.get_work_list(my_connection).should == [other_connection.client_id] GetWork.get_work_list(other_connection).should == [my_connection.client_id] @@ -57,8 +57,8 @@ describe GetWork do # create some newer ones score_location(austin_geo[:locidispid], dallas_geo[:locidispid], 20) - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) GetWork.get_work_list(my_connection).should == [] GetWork.get_work_list(other_connection).should == [] @@ -66,8 +66,8 @@ describe GetWork do it "skips scores regardess of scoring direction" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) score_location(dallas_geo[:locidispid], austin_geo[:locidispid], 20) GetWork.get_work_list(my_connection).should == [] @@ -83,8 +83,8 @@ describe GetWork do it "selects client even if client has scores to self" do # this test just verifies that a bit of data in the db doesn't trip up the query - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) score_location(dallas_geo[:locidispid], dallas_geo[:locidispid], 20) GetWork.get_work_list(my_connection).should == [other_connection.client_id] @@ -94,9 +94,9 @@ describe GetWork do it "selects only one client from a given remote location" do # if two clients have the same locidispid, only one is meant to be selected for scoring - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection1 = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) - other_connection2 = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 3) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection1 = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + other_connection2 = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 3) list = GetWork.get_work_list(my_connection) (list == [other_connection1.client_id] || list == [other_connection2.client_id]).should be_true # we don't know which one it'll pick @@ -107,9 +107,9 @@ describe GetWork do it "selects no clients when multiple clients in same location have a score" do # if two clients have the same locidispid, only one is meant to be selected for scoring - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection1 = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) - other_connection2 = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 3) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection1 = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + other_connection2 = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 3) score_location(austin_geo[:locidispid], dallas_geo[:locidispid], 20) @@ -121,9 +121,9 @@ describe GetWork do it "selects two clients from differing, unscored locations" do # if two clients have the same locidispid, only one is meant to be selected for scoring - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection1 = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) - other_connection2 = FactoryGirl.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection1 = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + other_connection2 = FactoryBot.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) GetWork.get_work_list(my_connection).should =~ [other_connection1.client_id, other_connection2.client_id] GetWork.get_work_list(other_connection1).should =~ [my_connection.client_id, other_connection2.client_id] @@ -133,8 +133,8 @@ describe GetWork do it "ignores client with the same addr" do # if two clients have the same locidispid, only one is meant to be selected for scoring - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection1 = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 1) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection1 = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 1) GetWork.get_work_list(my_connection).should == [] end @@ -142,17 +142,17 @@ describe GetWork do it "ignores client with the same addr" do # if two clients have the same locidispid, only one is meant to be selected for scoring - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection1 = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 1) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection1 = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 1) GetWork.get_work_list(my_connection).should == [] end it "randomizes ordering of selected locations" do # if two clients have the same locidispid, only one is meant to be selected for scoring - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection1 = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) - other_connection2 = FactoryGirl.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection1 = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + other_connection2 = FactoryBot.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) initial_ordering = GetWork.get_work_list(my_connection) initial_ordering.should =~ [other_connection1.client_id, other_connection2.client_id] @@ -168,9 +168,9 @@ describe GetWork do end it "excludes udp unreachable clients" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, udp_reachable: false) - other_connection2 = FactoryGirl.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, udp_reachable: false) + other_connection2 = FactoryBot.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) GetWork.get_work_list(my_connection).should == [other_connection2.client_id] GetWork.get_work_list(other_connection).should == [] @@ -178,9 +178,9 @@ describe GetWork do end it "excludes network testing clients" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, is_network_testing: true) - other_connection2 = FactoryGirl.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, is_network_testing: true) + other_connection2 = FactoryBot.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) GetWork.get_work_list(my_connection).should == [other_connection2.client_id] GetWork.get_work_list(other_connection).should == [] @@ -188,9 +188,9 @@ describe GetWork do end it "excludes scoring_timeout clients (1)" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, scoring_timeout: 1.days.from_now) - other_connection2 = FactoryGirl.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, scoring_timeout: 1.days.from_now) + other_connection2 = FactoryBot.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) GetWork.get_work_list(my_connection).should == [other_connection2.client_id] GetWork.get_work_list(other_connection).should == [] @@ -198,9 +198,9 @@ describe GetWork do end it "excludes scoring_timeout clients (2)" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, scoring_timeout: 1.days.from_now) - other_connection2 = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 3) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, scoring_timeout: 1.days.from_now) + other_connection2 = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 3) GetWork.get_work_list(my_connection).should == [other_connection2.client_id] GetWork.get_work_list(other_connection).should == [] @@ -208,11 +208,11 @@ describe GetWork do end it "excludes connections in a session" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2,) - other_connection2 = FactoryGirl.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2,) + other_connection2 = FactoryBot.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) - music_session = FactoryGirl.create(:active_music_session, creator: my_connection.user) + music_session = FactoryBot.create(:active_music_session, creator: my_connection.user) other_connection.music_session = music_session other_connection.save! @@ -225,8 +225,8 @@ describe GetWork do describe "record" do - let(:connection1) { FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: austin_ip_as_num, ip_address: austin_ip) } - let(:connection2) { FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: dallas_ip_as_num, ip_address: dallas_ip) } + let(:connection1) { FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: austin_ip_as_num, ip_address: austin_ip) } + let(:connection2) { FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: dallas_ip_as_num, ip_address: dallas_ip) } it "records client errors if no score" do @@ -446,7 +446,7 @@ describe GetWork do describe "summary" do it "selects no score when no other clients" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) score_location(austin_geo[:locidispid], dallas_geo[:locidispid], 20) @@ -459,7 +459,7 @@ describe GetWork do end it "selects no score when no other clients" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1, udp_reachable:true) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1, udp_reachable:true) score_location(austin_geo[:locidispid], dallas_geo[:locidispid], 20) @@ -472,8 +472,8 @@ describe GetWork do end it "selects unscored location" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) #score_location(austin_geo[:locidispid], dallas_geo[:locidispid], 20) @@ -484,8 +484,8 @@ describe GetWork do end it "does not count scored location" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) score_location(austin_geo[:locidispid], dallas_geo[:locidispid], 20) @@ -496,9 +496,9 @@ describe GetWork do end it "does not count duplicate location" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) - other_connection2 = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + other_connection2 = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) score_location(austin_geo[:locidispid], dallas_geo[:locidispid], 20) @@ -510,8 +510,8 @@ describe GetWork do end it "does not count udp_reachable" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, udp_reachable: false) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, udp_reachable: false) summary = GetWork.summary summary.length.should == 2 @@ -520,9 +520,9 @@ describe GetWork do end it "does not count udp_reachable with 2 other clients" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, udp_reachable: false) - other_connection2 = FactoryGirl.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2, udp_reachable: false) + other_connection2 = FactoryBot.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) summary = GetWork.summary summary.length.should == 3 @@ -532,9 +532,9 @@ describe GetWork do end it "counts with 3" do - my_connection = FactoryGirl.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) - other_connection = FactoryGirl.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) - other_connection2 = FactoryGirl.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) + my_connection = FactoryBot.create(:connection, locidispid: austin_geo[:locidispid], addr: 1) + other_connection = FactoryBot.create(:connection, locidispid: dallas_geo[:locidispid], addr: 2) + other_connection2 = FactoryBot.create(:connection, locidispid: houston_geoip[:locidispid], addr: 3) #Database.dump('select * FROM get_work_summary_no_agg(INTERVAL \'120 hours\')'); diff --git a/ruby/spec/jam_ruby/models/icecast_admin_authentication_spec.rb b/ruby/spec/jam_ruby/models/icecast_admin_authentication_spec.rb index 85f562405..1c37b5383 100644 --- a/ruby/spec/jam_ruby/models/icecast_admin_authentication_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_admin_authentication_spec.rb @@ -42,7 +42,7 @@ describe IcecastAdminAuthentication do end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } it "success via template" do server.template.admin_auth.save! diff --git a/ruby/spec/jam_ruby/models/icecast_directory_spec.rb b/ruby/spec/jam_ruby/models/icecast_directory_spec.rb index f77f65768..91d93174f 100644 --- a/ruby/spec/jam_ruby/models/icecast_directory_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_directory_spec.rb @@ -40,11 +40,11 @@ describe IcecastDirectory do end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } before(:each) do - server.directory = FactoryGirl.create(:icecast_directory) - server.template.directory = FactoryGirl.create(:icecast_directory) + server.directory = FactoryBot.create(:icecast_directory) + server.template.directory = FactoryBot.create(:icecast_directory) server.template.save! server.save! server.config_updated diff --git a/ruby/spec/jam_ruby/models/icecast_limit_spec.rb b/ruby/spec/jam_ruby/models/icecast_limit_spec.rb index bab815e50..f0593f701 100644 --- a/ruby/spec/jam_ruby/models/icecast_limit_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_limit_spec.rb @@ -58,7 +58,7 @@ describe IcecastLimit do end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } it "success via template" do server.template.limit.save! diff --git a/ruby/spec/jam_ruby/models/icecast_listen_socket_spec.rb b/ruby/spec/jam_ruby/models/icecast_listen_socket_spec.rb index 19a1efa60..738ba90c0 100644 --- a/ruby/spec/jam_ruby/models/icecast_listen_socket_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_listen_socket_spec.rb @@ -19,7 +19,7 @@ describe IcecastListenSocket do end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } it "success via template" do server.template.listen_sockets.first.save! diff --git a/ruby/spec/jam_ruby/models/icecast_logging_spec.rb b/ruby/spec/jam_ruby/models/icecast_logging_spec.rb index 2892bbc82..b2ed415ca 100644 --- a/ruby/spec/jam_ruby/models/icecast_logging_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_logging_spec.rb @@ -32,7 +32,7 @@ describe IcecastLogging do end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } it "success via template" do server.template.logging.save! diff --git a/ruby/spec/jam_ruby/models/icecast_master_server_relay_spec.rb b/ruby/spec/jam_ruby/models/icecast_master_server_relay_spec.rb index 3ffe32aad..f43a5c0ff 100644 --- a/ruby/spec/jam_ruby/models/icecast_master_server_relay_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_master_server_relay_spec.rb @@ -36,11 +36,11 @@ describe IcecastMasterServerRelay do end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } before(:each) do - server.master_relay = FactoryGirl.create(:icecast_master_server_relay) - server.template.master_relay = FactoryGirl.create(:icecast_master_server_relay) + server.master_relay = FactoryBot.create(:icecast_master_server_relay) + server.template.master_relay = FactoryBot.create(:icecast_master_server_relay) server.template.save! server.save! server.config_updated diff --git a/ruby/spec/jam_ruby/models/icecast_mount_spec.rb b/ruby/spec/jam_ruby/models/icecast_mount_spec.rb index 553b5a34d..7c4cd18bf 100644 --- a/ruby/spec/jam_ruby/models/icecast_mount_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_mount_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe IcecastMount do - let(:icecast_mount) { FactoryGirl.create(:icecast_mount) } + let(:icecast_mount) { FactoryBot.create(:icecast_mount) } let(:output) { StringIO.new } let(:builder) { ::Builder::XmlMarkup.new(:target => output, :indent => 1) } @@ -30,8 +30,8 @@ describe IcecastMount do mount.fallback_when_full = true mount.max_listeners = 1000 mount.max_listener_duration = 3600 - mount.authentication = FactoryGirl.create(:icecast_user_authentication) - mount.server = FactoryGirl.create(:icecast_server_with_overrides) + mount.authentication = FactoryBot.create(:icecast_user_authentication) + mount.server = FactoryBot.create(:icecast_server_with_overrides) mount.save! @@ -68,7 +68,7 @@ describe IcecastMount do end describe "override xml over mount template" do - let(:mount) {FactoryGirl.create(:iceast_mount_with_template)} + let(:mount) {FactoryBot.create(:iceast_mount_with_template)} it "should allow override by mount" do mount.dumpXml(builder) @@ -96,10 +96,10 @@ describe IcecastMount do end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } before(:each) do - server.mounts << FactoryGirl.create(:icecast_mount, server: server) + server.mounts << FactoryBot.create(:icecast_mount, server: server) server.save! server.config_updated server.reload @@ -126,7 +126,7 @@ describe IcecastMount do end describe "listener/source" do - let(:mount) {FactoryGirl.create(:iceast_mount_with_template)} + let(:mount) {FactoryBot.create(:iceast_mount_with_template)} describe "listeners" do it "listener_add" do @@ -163,13 +163,13 @@ describe IcecastMount do end describe "build_session_mount" do - let(:server1) {FactoryGirl.create(:icecast_server_minimal)} - let(:server2) {FactoryGirl.create(:icecast_server_with_overrides)} - let(:server3) {FactoryGirl.create(:icecast_server_with_overrides)} - let(:hidden_music_session) { FactoryGirl.create(:active_music_session, :fan_access => false)} - let(:public_music_session) { FactoryGirl.create(:active_music_session, :fan_access => true)} - let(:public_music_session2) { FactoryGirl.create(:active_music_session, :fan_access => true)} - let(:public_music_session3) { FactoryGirl.create(:active_music_session, :fan_access => true)} + let(:server1) {FactoryBot.create(:icecast_server_minimal)} + let(:server2) {FactoryBot.create(:icecast_server_with_overrides)} + let(:server3) {FactoryBot.create(:icecast_server_with_overrides)} + let(:hidden_music_session) { FactoryBot.create(:active_music_session, :fan_access => false)} + let(:public_music_session) { FactoryBot.create(:active_music_session, :fan_access => true)} + let(:public_music_session2) { FactoryBot.create(:active_music_session, :fan_access => true)} + let(:public_music_session3) { FactoryBot.create(:active_music_session, :fan_access => true)} before(:each) do @@ -249,8 +249,8 @@ describe IcecastMount do it "no change if same source_direction" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, source_direction: true) - change1 = FactoryGirl.create(:icecast_source_change, mount: mount, source_direction: true, success:true) + mount = FactoryBot.create(:iceast_mount_with_music_session, source_direction: true) + change1 = FactoryBot.create(:icecast_source_change, mount: mount, source_direction: true, success:true) mount.source_changes.size.should == 1 mount.source_direction = true @@ -260,8 +260,8 @@ describe IcecastMount do end it "NOT deleted on transition to down" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, source_direction: true) - change1 = FactoryGirl.create(:icecast_source_change, mount: mount, source_direction: true, success:true) + mount = FactoryBot.create(:iceast_mount_with_music_session, source_direction: true) + change1 = FactoryBot.create(:icecast_source_change, mount: mount, source_direction: true, success:true) mount.source_changes.size.should == 1 mount.source_direction = false @@ -271,8 +271,8 @@ describe IcecastMount do end it "not deleted on transition to up" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, source_direction: false) - change1 = FactoryGirl.create(:icecast_source_change, mount: mount, source_direction: true, success:true) + mount = FactoryBot.create(:iceast_mount_with_music_session, source_direction: false) + change1 = FactoryBot.create(:icecast_source_change, mount: mount, source_direction: true, success:true) mount.source_changes.size.should == 1 @@ -292,8 +292,8 @@ describe IcecastMount do {success: false, reason: reason, detail:detail} end - let(:sourced_mount) {FactoryGirl.create(:iceast_mount_with_music_session, sourced: true, sourced_needs_changing_at: nil, listeners: 1)} - let(:mount_needing_source) {FactoryGirl.create(:iceast_mount_with_music_session, sourced: false, sourced_needs_changing_at: Time.now, listeners: 1)} + let(:sourced_mount) {FactoryBot.create(:iceast_mount_with_music_session, sourced: true, sourced_needs_changing_at: nil, listeners: 1)} + let(:mount_needing_source) {FactoryBot.create(:iceast_mount_with_music_session, sourced: false, sourced_needs_changing_at: Time.now, listeners: 1)} it "happy sourced mount" do sourced_mount.state.should == success_state('source_up') @@ -304,7 +304,7 @@ describe IcecastMount do end it "transition timeout" do - #change1 = FactoryGirl.create(:icecast_source_change, mount: mount, source_direction: true, success:true) + #change1 = FactoryBot.create(:icecast_source_change, mount: mount, source_direction: true, success:true) mount_needing_source.sourced_needs_changing_at = (APP_CONFIG.source_changes_missing_secs + 1).seconds.ago mount_needing_source.save! @@ -312,7 +312,7 @@ describe IcecastMount do end describe "client attempted transition and" do - let!(:change1) { FactoryGirl.create(:icecast_source_change, mount: mount_needing_source, source_direction: true, success:true) } + let!(:change1) { FactoryBot.create(:icecast_source_change, mount: mount_needing_source, source_direction: true, success:true) } it "happy sourced mount" do mount_needing_source.sourced = true diff --git a/ruby/spec/jam_ruby/models/icecast_mount_template_spec.rb b/ruby/spec/jam_ruby/models/icecast_mount_template_spec.rb index c094b14dc..7ad39d2f7 100644 --- a/ruby/spec/jam_ruby/models/icecast_mount_template_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_mount_template_spec.rb @@ -2,15 +2,15 @@ require 'spec_helper' describe IcecastMountTemplate do - let(:mount_template) { template = FactoryGirl.create(:icecast_mount_template) } + let(:mount_template) { template = FactoryBot.create(:icecast_mount_template) } it "save" do mount_template.errors.any?.should be_false end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } - let(:music_session) { FactoryGirl.create(:active_music_session, :fan_access => true)} + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:music_session) { FactoryBot.create(:active_music_session, :fan_access => true)} before(:each) do server.touch diff --git a/ruby/spec/jam_ruby/models/icecast_path_spec.rb b/ruby/spec/jam_ruby/models/icecast_path_spec.rb index 50354d38d..8d145fd42 100644 --- a/ruby/spec/jam_ruby/models/icecast_path_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_path_spec.rb @@ -56,7 +56,7 @@ describe IcecastPath do end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } it "success via template" do server.template.path.save! diff --git a/ruby/spec/jam_ruby/models/icecast_relay_spec.rb b/ruby/spec/jam_ruby/models/icecast_relay_spec.rb index 705434b3b..880c54b02 100644 --- a/ruby/spec/jam_ruby/models/icecast_relay_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_relay_spec.rb @@ -34,10 +34,10 @@ describe IcecastRelay do end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } before(:each) do - server.relays << FactoryGirl.create(:icecast_relay) + server.relays << FactoryBot.create(:icecast_relay) server.save! server.config_updated server.reload diff --git a/ruby/spec/jam_ruby/models/icecast_security_spec.rb b/ruby/spec/jam_ruby/models/icecast_security_spec.rb index e33d9e180..60fe68ea7 100644 --- a/ruby/spec/jam_ruby/models/icecast_security_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_security_spec.rb @@ -32,7 +32,7 @@ describe IcecastSecurity do end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } it "success via template" do server.template.security.save! diff --git a/ruby/spec/jam_ruby/models/icecast_server_spec.rb b/ruby/spec/jam_ruby/models/icecast_server_spec.rb index a9e6adbb2..678f417bc 100644 --- a/ruby/spec/jam_ruby/models/icecast_server_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_server_spec.rb @@ -8,7 +8,7 @@ describe IcecastServer do it "save" do - server = FactoryGirl.create(:icecast_server_minimal) + server = FactoryBot.create(:icecast_server_minimal) server.save! server.reload server.dumpXml(output) @@ -32,7 +32,7 @@ describe IcecastServer do end it "xml overrides" do - server = FactoryGirl.create(:icecast_server_minimal) + server = FactoryBot.create(:icecast_server_minimal) server.save! server.reload server.dumpXml(output) @@ -47,7 +47,7 @@ describe IcecastServer do server.location = "override" server.fileserve = 1 - server.limit = FactoryGirl.create(:icecast_limit, :queue_size => 777) + server.limit = FactoryBot.create(:icecast_limit, :queue_size => 777) server.save! output = StringIO.new diff --git a/ruby/spec/jam_ruby/models/icecast_source_change_spec.rb b/ruby/spec/jam_ruby/models/icecast_source_change_spec.rb index a2f6fc0e5..e1cc37567 100644 --- a/ruby/spec/jam_ruby/models/icecast_source_change_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_source_change_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe IcecastSourceChange do - let(:change) { FactoryGirl.create(:icecast_source_change) } + let(:change) { FactoryBot.create(:icecast_source_change) } it "validates" do bad_change = IcecastSourceChange.new diff --git a/ruby/spec/jam_ruby/models/icecast_template_spec.rb b/ruby/spec/jam_ruby/models/icecast_template_spec.rb index 690cf9122..1e5926939 100644 --- a/ruby/spec/jam_ruby/models/icecast_template_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_template_spec.rb @@ -2,14 +2,14 @@ require 'spec_helper' describe IcecastTemplate do - let(:template) { template = FactoryGirl.create(:icecast_template_minimal) } + let(:template) { template = FactoryBot.create(:icecast_template_minimal) } it "save" do template.errors.any?.should be_false end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } it "success via template" do server.template.save! diff --git a/ruby/spec/jam_ruby/models/icecast_user_authentication_spec.rb b/ruby/spec/jam_ruby/models/icecast_user_authentication_spec.rb index 8e72506c9..6ee133d9c 100644 --- a/ruby/spec/jam_ruby/models/icecast_user_authentication_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_user_authentication_spec.rb @@ -43,10 +43,10 @@ describe IcecastUserAuthentication do end describe "poke configs" do - let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } + let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) } before(:each) do - server.mounts << FactoryGirl.create(:icecast_mount_with_auth) + server.mounts << FactoryBot.create(:icecast_mount_with_auth) server.save! server.config_updated server.reload diff --git a/ruby/spec/jam_ruby/models/invitation_spec.rb b/ruby/spec/jam_ruby/models/invitation_spec.rb index b22f31f0c..5b6ecb89d 100644 --- a/ruby/spec/jam_ruby/models/invitation_spec.rb +++ b/ruby/spec/jam_ruby/models/invitation_spec.rb @@ -4,13 +4,13 @@ describe ActiveMusicSession do it 'cant create invitation to non-friend' do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1) + music_session = FactoryBot.create(:active_music_session, :creator => user1) - music_session_member1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") - music_session_member2 = FactoryGirl.create(:connection, :user => user2, :music_session => music_session, :ip_address => "2.2.2.2", :client_id => "2") + music_session_member1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") + music_session_member2 = FactoryBot.create(:connection, :user => user2, :music_session => music_session, :ip_address => "2.2.2.2", :client_id => "2") invitation = Invitation.new(:sender => user1, :receiver => user2, :music_session => music_session.music_session) @@ -22,16 +22,16 @@ describe ActiveMusicSession do it 'can create invitation to friend' do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1) + music_session = FactoryBot.create(:active_music_session, :creator => user1) - music_session_member1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") - music_session_member2 = FactoryGirl.create(:connection, :user => user2, :music_session => music_session, :ip_address => "2.2.2.2", :client_id => "2") + music_session_member1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") + music_session_member2 = FactoryBot.create(:connection, :user => user2, :music_session => music_session, :ip_address => "2.2.2.2", :client_id => "2") - FactoryGirl.create(:friendship, :user => user1, :friend => user2) - FactoryGirl.create(:friendship, :user => user2, :friend => user1) + FactoryBot.create(:friendship, :user => user1, :friend => user2) + FactoryBot.create(:friendship, :user => user2, :friend => user1) invitation = Invitation.new(:sender => user1, :receiver => user2, :music_session => music_session.music_session) @@ -39,15 +39,15 @@ describe ActiveMusicSession do end it 'can create invitation to a user who made a join_request' do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1) + music_session = FactoryBot.create(:active_music_session, :creator => user1) - music_session_member1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") - connection2 = FactoryGirl.create(:connection, :user => user2, :ip_address => "2.2.2.2", :client_id => "2") + music_session_member1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") + connection2 = FactoryBot.create(:connection, :user => user2, :ip_address => "2.2.2.2", :client_id => "2") - join_request = FactoryGirl.create(:join_request, :user => user2, :music_session => music_session.music_session) + join_request = FactoryBot.create(:join_request, :user => user2, :music_session => music_session.music_session) invitation = Invitation.new(:sender => user1, :receiver => user2, :music_session => music_session.music_session, :join_request => join_request) @@ -55,16 +55,16 @@ describe ActiveMusicSession do end it 'cant create invitation to a user who did not make a join_request and is not a friend' do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1) - music_session2 = FactoryGirl.create(:active_music_session, :creator => user1) + music_session = FactoryBot.create(:active_music_session, :creator => user1) + music_session2 = FactoryBot.create(:active_music_session, :creator => user1) - music_session_member1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") - connection2 = FactoryGirl.create(:connection, :user => user2, :ip_address => "2.2.2.2", :client_id => "2") + music_session_member1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") + connection2 = FactoryBot.create(:connection, :user => user2, :ip_address => "2.2.2.2", :client_id => "2") - join_request = FactoryGirl.create(:join_request, :user => user2, :music_session => music_session2.music_session) + join_request = FactoryBot.create(:join_request, :user => user2, :music_session => music_session2.music_session) invitation = Invitation.new(:sender => user1, :receiver => user2, :music_session => music_session.music_session, :join_request => join_request) diff --git a/ruby/spec/jam_ruby/models/invited_user_spec.rb b/ruby/spec/jam_ruby/models/invited_user_spec.rb index 5022ec741..876245ab5 100644 --- a/ruby/spec/jam_ruby/models/invited_user_spec.rb +++ b/ruby/spec/jam_ruby/models/invited_user_spec.rb @@ -11,17 +11,17 @@ describe InvitedUser do after {Timecop.return} - let(:user1) { FactoryGirl.create(:user) } + let(:user1) { FactoryBot.create(:user) } it 'max_invites_ever_per_sender' do Timecop.travel(Date.new(2016, 3, 20)) APP_CONFIG.max_invites_ever_per_sender.times do - invited_user = FactoryGirl.create(:invited_user, :sender => user1) + invited_user = FactoryBot.create(:invited_user, :sender => user1) end - invited_user = FactoryGirl.build(:invited_user, :sender => user1) + invited_user = FactoryBot.build(:invited_user, :sender => user1) invited_user.save invited_user.should_not be_valid @@ -30,7 +30,7 @@ describe InvitedUser do Timecop.travel(Date.new(2016, 3, 22)) # this should never 'heal'; once you hit max, you are done for good - invited_user = FactoryGirl.build(:invited_user, :sender => user1) + invited_user = FactoryBot.build(:invited_user, :sender => user1) invited_user.save invited_user.should_not be_valid end @@ -40,10 +40,10 @@ describe InvitedUser do Timecop.travel(Date.new(2016, 3, 20)) APP_CONFIG.max_invites_per_day_per_sender.times do - invited_user = FactoryGirl.create(:invited_user, :sender => user1) + invited_user = FactoryBot.create(:invited_user, :sender => user1) end - invited_user = FactoryGirl.build(:invited_user, :sender => user1) + invited_user = FactoryBot.build(:invited_user, :sender => user1) invited_user.save invited_user.should_not be_valid @@ -52,7 +52,7 @@ describe InvitedUser do Timecop.travel(Date.new(2016, 3, 22)) # this should work because we moved forward by 2 days - invited_user = FactoryGirl.create(:invited_user, :sender => user1) + invited_user = FactoryBot.create(:invited_user, :sender => user1) end @@ -61,10 +61,10 @@ describe InvitedUser do Timecop.travel(Date.new(2016, 3, 20)) APP_CONFIG.max_invites_to_receiver_per_day.times do - invited_user = FactoryGirl.create(:invited_user, :email => 'seth@jamkazam.com') + invited_user = FactoryBot.create(:invited_user, :email => 'seth@jamkazam.com') end - invited_user = FactoryGirl.build(:invited_user, :email => 'seth@jamkazam.com') + invited_user = FactoryBot.build(:invited_user, :email => 'seth@jamkazam.com') invited_user.save invited_user.should_not be_valid @@ -73,7 +73,7 @@ describe InvitedUser do Timecop.travel(Date.new(2016, 3, 22)) # this should work because we moved forward by 2 days - invited_user = FactoryGirl.create(:invited_user, :email => 'seth@jamkazam.com') + invited_user = FactoryBot.create(:invited_user, :email => 'seth@jamkazam.com') end @@ -82,10 +82,10 @@ describe InvitedUser do it 'create an invitation from end-user' do # create an end user - user1 = FactoryGirl.create(:user) + user1 = FactoryBot.create(:user) # create the invitation from the end-user - invited_user = FactoryGirl.create(:invited_user, :sender => user1) + invited_user = FactoryBot.create(:invited_user, :sender => user1) invited_user.email.should_not be_nil invited_user.sender.should_not be_nil @@ -98,10 +98,10 @@ describe InvitedUser do it 'create an invitation from admin-user' do # create an admin user - user1 = FactoryGirl.create(:admin) + user1 = FactoryBot.create(:admin) # create the invitation from the end-user - invited_user = FactoryGirl.create(:invited_user, :sender => user1) + invited_user = FactoryBot.create(:invited_user, :sender => user1) invited_user.email.should_not be_nil invited_user.sender.should_not be_nil @@ -111,27 +111,27 @@ describe InvitedUser do it 'create an invitation from no one in particular' do # create the invitation from the end-user - invited_user = FactoryGirl.build(:invited_user) + invited_user = FactoryBot.build(:invited_user) invited_user.invited_by_administrator?.should be_true end it 'email is sent automatically by virtue of observer' do # create an admin user - user1 = FactoryGirl.create(:admin) + user1 = FactoryBot.create(:admin) # create the invitation from the end-user - invited_user = FactoryGirl.create(:invited_user, :sender => user1) + invited_user = FactoryBot.create(:invited_user, :sender => user1) InvitedUserMailer.deliveries.length.should == 1 end it 'accept an invitation' do # create an admin user - user1 = FactoryGirl.create(:admin) + user1 = FactoryBot.create(:admin) # create the invitation from the end-user - invited_user = FactoryGirl.create(:invited_user, :sender => user1) + invited_user = FactoryBot.create(:invited_user, :sender => user1) invited_user.accepted.should be_false @@ -143,24 +143,24 @@ describe InvitedUser do it 'checks can invite' do # create an admin user - user1 = FactoryGirl.create(:user) + user1 = FactoryBot.create(:user) user1.can_invite = false user1.save # create the invitation from the end-user - invited_user = FactoryGirl.build(:invited_user, :sender => user1) + invited_user = FactoryBot.build(:invited_user, :sender => user1) invited_user.save invited_user.errors.any?.should be_true end it 'list invites for a user' do # user to create an invite with - user1 = FactoryGirl.create(:user) + user1 = FactoryBot.create(:user) InvitedUser.index(user1).length.should == 0 # create the invitation from the end-user - invited_user = FactoryGirl.create(:invited_user, :sender => user1) + invited_user = FactoryBot.create(:invited_user, :sender => user1) invited_users = InvitedUser.index(user1) invited_users.length.should == 1 invited_users[0].should == invited_user @@ -168,10 +168,10 @@ describe InvitedUser do it 'should not allow note to have profanity' do - user1 = FactoryGirl.create(:user) + user1 = FactoryBot.create(:user) # create the invitation from the end-user - invited_user = FactoryGirl.create(:invited_user, :sender => user1) + invited_user = FactoryBot.create(:invited_user, :sender => user1) invited_user.note = 'fuck you' invited_user.save invited_user.valid?.should be_false @@ -179,8 +179,8 @@ describe InvitedUser do it 'accepts empty emails' do # we only support email as a medium; FB is ignored - user1 = FactoryGirl.create(:user) - invited_user = FactoryGirl.create(:invited_user, :sender_id => user1.id, :invite_medium => InvitedUser::FB_MEDIUM, :email => '') + user1 = FactoryBot.create(:user) + invited_user = FactoryBot.create(:invited_user, :sender_id => user1.id, :invite_medium => InvitedUser::FB_MEDIUM, :email => '') expect(invited_user.valid?).to eq(false) end diff --git a/ruby/spec/jam_ruby/models/ip_blacklist_spec.rb b/ruby/spec/jam_ruby/models/ip_blacklist_spec.rb index 4f0416c30..e82ce93d3 100644 --- a/ruby/spec/jam_ruby/models/ip_blacklist_spec.rb +++ b/ruby/spec/jam_ruby/models/ip_blacklist_spec.rb @@ -8,19 +8,19 @@ describe IpBlacklist do end it "returns true if banned" do - FactoryGirl.create(:ip_blacklist, remote_ip: "1.1.1.1") + FactoryBot.create(:ip_blacklist, remote_ip: "1.1.1.1") IpBlacklist.banned('1.1.1.1').should eq true end it "returns false if whitelisted" do - FactoryGirl.create(:ip_whitelist, remote_ip: "1.1.1.1") + FactoryBot.create(:ip_whitelist, remote_ip: "1.1.1.1") IpBlacklist.banned('1.1.1.1').should eq false end it "returns false if whitelisted and blacklisted too" do - FactoryGirl.create(:ip_blacklist, remote_ip: "1.1.1.1") - FactoryGirl.create(:ip_whitelist, remote_ip: "1.1.1.1") + FactoryBot.create(:ip_blacklist, remote_ip: "1.1.1.1") + FactoryBot.create(:ip_whitelist, remote_ip: "1.1.1.1") IpBlacklist.banned('1.1.1.1').should eq false end end diff --git a/ruby/spec/jam_ruby/models/jam_class_report_spec.rb b/ruby/spec/jam_ruby/models/jam_class_report_spec.rb index 9088a7cf8..41a6c2c03 100644 --- a/ruby/spec/jam_ruby/models/jam_class_report_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_class_report_spec.rb @@ -4,7 +4,7 @@ describe JamClassReport do it "wee bit of data" do pending "lessons paused" - user = FactoryGirl.create(:user, origin_utm_campaign: 'legacy') + user = FactoryBot.create(:user, origin_utm_campaign: 'legacy') query = JamClassReport.analyse query.length.should eql 2 diff --git a/ruby/spec/jam_ruby/models/jam_track_hfa_request_spec.rb b/ruby/spec/jam_ruby/models/jam_track_hfa_request_spec.rb index 95eef5d2f..0c969826a 100644 --- a/ruby/spec/jam_ruby/models/jam_track_hfa_request_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_hfa_request_spec.rb @@ -4,7 +4,7 @@ describe JamTrackHfaRequest do include CarrierWave::Test::Matchers include UsesTempFiles - let(:jamtrack1) {FactoryGirl.create(:jam_track, duration: 90, server_fixation_date: Time.now.to_date ) } + let(:jamtrack1) {FactoryBot.create(:jam_track, duration: 90, server_fixation_date: Time.now.to_date ) } it "creates request" do diff --git a/ruby/spec/jam_ruby/models/jam_track_licensor_spec.rb b/ruby/spec/jam_ruby/models/jam_track_licensor_spec.rb index 80bfc377c..e4ef8ea81 100644 --- a/ruby/spec/jam_ruby/models/jam_track_licensor_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_licensor_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe JamTrackLicensor do it "created" do - FactoryGirl.create(:jam_track_licensor) + FactoryBot.create(:jam_track_licensor) end end diff --git a/ruby/spec/jam_ruby/models/jam_track_mixdown_package_spec.rb b/ruby/spec/jam_ruby/models/jam_track_mixdown_package_spec.rb index 3a90ffcc3..ca9c3d502 100644 --- a/ruby/spec/jam_ruby/models/jam_track_mixdown_package_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_mixdown_package_spec.rb @@ -4,11 +4,11 @@ describe JamTrackMixdownPackage do include UsesTempFiles it "can be created (factory girl)" do - package = FactoryGirl.create(:jam_track_mixdown_package) + package = FactoryBot.create(:jam_track_mixdown_package) end it "can be created" do - mixdown= FactoryGirl.create(:jam_track_mixdown) + mixdown= FactoryBot.create(:jam_track_mixdown) package = JamTrackMixdownPackage.create(mixdown, JamTrackMixdownPackage::FILE_TYPE_OGG, 48, 'jkz') @@ -18,37 +18,37 @@ describe JamTrackMixdownPackage do describe "signing_state" do it "quiet" do - package = FactoryGirl.create(:jam_track_mixdown_package) + package = FactoryBot.create(:jam_track_mixdown_package) package.signing_state.should eq('QUIET') end it "signed" do - package = FactoryGirl.create(:jam_track_mixdown_package, signed: true, signing_started_at: Time.now) + package = FactoryBot.create(:jam_track_mixdown_package, signed: true, signing_started_at: Time.now) package.signing_state.should eq('SIGNED') end it "error" do - package = FactoryGirl.create(:jam_track_mixdown_package, error_count: 1) + package = FactoryBot.create(:jam_track_mixdown_package, error_count: 1) package.signing_state.should eq('ERROR') end it "signing" do - package = FactoryGirl.create(:jam_track_mixdown_package, signing:true, signing_started_at: Time.now, packaging_steps: 3, current_packaging_step:0, last_step_at:Time.now) + package = FactoryBot.create(:jam_track_mixdown_package, signing:true, signing_started_at: Time.now, packaging_steps: 3, current_packaging_step:0, last_step_at:Time.now) package.signing_state.should eq('SIGNING') end it "signing timeout" do - package = FactoryGirl.create(:jam_track_mixdown_package, signing: true, signing_started_at: Time.now - (APP_CONFIG.signing_job_signing_max_time + 1), packaging_steps: 3, current_packaging_step:0, last_step_at:Time.now) + package = FactoryBot.create(:jam_track_mixdown_package, signing: true, signing_started_at: Time.now - (APP_CONFIG.signing_job_signing_max_time + 1), packaging_steps: 3, current_packaging_step:0, last_step_at:Time.now) package.signing_state.should eq('SIGNING_TIMEOUT') end it "queued" do - package = FactoryGirl.create(:jam_track_mixdown_package, signing_queued_at: Time.now) + package = FactoryBot.create(:jam_track_mixdown_package, signing_queued_at: Time.now) package.signing_state.should eq('QUEUED') end it "signing timeout" do - package = FactoryGirl.create(:jam_track_mixdown_package, signing_queued_at: Time.now - (APP_CONFIG.mixdown_job_queue_max_time + 1)) + package = FactoryBot.create(:jam_track_mixdown_package, signing_queued_at: Time.now - (APP_CONFIG.mixdown_job_queue_max_time + 1)) package.signing_state.should eq('QUEUED_TIMEOUT') end end @@ -60,7 +60,7 @@ describe JamTrackMixdownPackage do end it "signing" do - package = FactoryGirl.create(:jam_track_mixdown_package) + package = FactoryBot.create(:jam_track_mixdown_package) JamTrackMixdownPackage.stats.should eq('count' => 1, 'signing_count' => 0) @@ -78,7 +78,7 @@ describe JamTrackMixdownPackage do end it "mixdown packages of different sorts" do - package = FactoryGirl.create(:jam_track_mixdown_package, speed_pitched: true) + package = FactoryBot.create(:jam_track_mixdown_package, speed_pitched: true) JamTrackMixdownPackage.estimated_queue_time.should eq(0) package.queued = true @@ -90,7 +90,7 @@ describe JamTrackMixdownPackage do JamTrackMixdownPackage.estimated_queue_time.should eq(APP_CONFIG.estimated_fast_mixdown_time * 1) - right = FactoryGirl.create(:jam_track_right) + right = FactoryBot.create(:jam_track_right) JamTrackMixdownPackage.estimated_queue_time.should eq(APP_CONFIG.estimated_fast_mixdown_time * 1) right.queued = true diff --git a/ruby/spec/jam_ruby/models/jam_track_mixdown_spec.rb b/ruby/spec/jam_ruby/models/jam_track_mixdown_spec.rb index fb42ed208..399876a3b 100644 --- a/ruby/spec/jam_ruby/models/jam_track_mixdown_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_mixdown_spec.rb @@ -2,12 +2,12 @@ require 'spec_helper' describe JamTrackMixdown do - let(:user) {FactoryGirl.create(:user)} - let(:jam_track) {FactoryGirl.create(:jam_track)} + let(:user) {FactoryBot.create(:user)} + let(:jam_track) {FactoryBot.create(:jam_track)} let(:settings) { {speed:5} } it "can be created (factory girl)" do - mixdown = FactoryGirl.create(:jam_track_mixdown) + mixdown = FactoryBot.create(:jam_track_mixdown) mixdown = JamTrackMixdown.find(mixdown.id) mixdown.settings.should eq({"speed" => 5}) @@ -25,7 +25,7 @@ describe JamTrackMixdown do start.should be_nil count.should eq(0) - mixdown = FactoryGirl.create(:jam_track_mixdown, user: user, jam_track: jam_track) + mixdown = FactoryBot.create(:jam_track_mixdown, user: user, jam_track: jam_track) query, start, count = JamTrackMixdown.index({id: jam_track}, user) query[0].should eq(mixdown) @@ -35,35 +35,35 @@ describe JamTrackMixdown do describe "settings" do it "validates empty settings" do - invalid = FactoryGirl.build(:jam_track_mixdown, settings: {}.to_json) + invalid = FactoryBot.build(:jam_track_mixdown, settings: {}.to_json) invalid.save invalid.errors.any?.should be_true invalid.errors["settings"].should eq(["can't be blank", "have nothing specified"]) end it "validates speed numeric" do - invalid = FactoryGirl.build(:jam_track_mixdown, settings: {"speed" => "5"}.to_json) + invalid = FactoryBot.build(:jam_track_mixdown, settings: {"speed" => "5"}.to_json) invalid.save invalid.errors.any?.should be_true invalid.errors["settings"].should eq(["has non-integer speed"]) end it "validates pitch numeric" do - invalid = FactoryGirl.build(:jam_track_mixdown, settings: {"pitch" => "5"}.to_json) + invalid = FactoryBot.build(:jam_track_mixdown, settings: {"pitch" => "5"}.to_json) invalid.save invalid.errors.any?.should be_true invalid.errors["settings"].should eq(["has non-integer pitch"]) end it "validates speed not-float" do - invalid = FactoryGirl.build(:jam_track_mixdown, settings: {"speed" => 5.5}.to_json) + invalid = FactoryBot.build(:jam_track_mixdown, settings: {"speed" => 5.5}.to_json) invalid.save invalid.errors.any?.should be_true invalid.errors["settings"].should eq(["has non-integer speed"]) end it "validates pitch not-float" do - invalid = FactoryGirl.build(:jam_track_mixdown, settings: {"pitch" => 10.5}.to_json) + invalid = FactoryBot.build(:jam_track_mixdown, settings: {"pitch" => 10.5}.to_json) invalid.save invalid.errors.any?.should be_true invalid.errors["settings"].should eq(["has non-integer pitch"]) diff --git a/ruby/spec/jam_ruby/models/jam_track_right_spec.rb b/ruby/spec/jam_ruby/models/jam_track_right_spec.rb index 7bc60d3f8..e39125d2a 100644 --- a/ruby/spec/jam_ruby/models/jam_track_right_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_right_spec.rb @@ -4,7 +4,7 @@ describe JamTrackRight do include UsesTempFiles include CarrierWave::Test::Matchers it "created" do - jam_track_right = FactoryGirl.create(:jam_track_right) + jam_track_right = FactoryBot.create(:jam_track_right) user = jam_track_right.user jam_track = jam_track_right.jam_track @@ -19,11 +19,11 @@ describe JamTrackRight do describe "validations" do it "one purchase per user/jam_track combo" do - user = FactoryGirl.create(:user) - jam_track = FactoryGirl.create(:jam_track) + user = FactoryBot.create(:user) + jam_track = FactoryBot.create(:jam_track) - right_1 = FactoryGirl.create(:jam_track_right, user: user, jam_track: jam_track) - right_2 = FactoryGirl.build(:jam_track_right, user: user, jam_track: jam_track) + right_1 = FactoryBot.create(:jam_track_right, user: user, jam_track: jam_track) + right_2 = FactoryBot.build(:jam_track_right, user: user, jam_track: jam_track) right_2.valid?.should be_false right_2.errors[:user_id].should == ['has already been taken'] end @@ -31,7 +31,7 @@ describe JamTrackRight do describe "private keys automatically created" do it "created automatically" do - jam_track_right = FactoryGirl.create(:jam_track_right) + jam_track_right = FactoryBot.create(:jam_track_right) jam_track_right.private_key_44.should_not be_nil jam_track_right.private_key_48.should_not be_nil jam_track_right.private_key_44.should eq(jam_track_right.private_key_48) @@ -56,8 +56,8 @@ describe JamTrackRight do end it "should fail if no tracks" do - user = FactoryGirl.create(:user) - jam_track = FactoryGirl.create(:jam_track) + user = FactoryBot.create(:user) + jam_track = FactoryBot.create(:jam_track) right = JamTrackRight.create(:user=>user, :jam_track=>jam_track) expect { JamRuby::JamTracksManager.save_jam_track_jkz(user, jam_track) @@ -66,8 +66,8 @@ describe JamTrackRight do it "should create" do ogg_path = File.join('spec', 'files', 'on.ogg') - user = FactoryGirl.create(:user) - jam_track_track = FactoryGirl.create(:jam_track_track) + user = FactoryBot.create(:user) + jam_track_track = FactoryBot.create(:jam_track_track) jam_track = jam_track_track.jam_track s3 = S3Manager.new(APP_CONFIG.aws_bucket, APP_CONFIG.aws_access_key_id, APP_CONFIG.aws_secret_access_key) @@ -102,7 +102,7 @@ describe JamTrackRight do end describe "list_keys" do - let(:user) {FactoryGirl.create(:user)} + let(:user) {FactoryBot.create(:user)} it "empty" do JamTrackRight.list_keys(user, nil).should eq([]) @@ -113,14 +113,14 @@ describe JamTrackRight do end it "valid track with no rights to it by querying user" do - jam_track = FactoryGirl.create(:jam_track) + jam_track = FactoryBot.create(:jam_track) keys = JamTrackRight.list_keys(user, [jam_track.id]) keys.should have(1).items keys[0]['private_key'].should be_nil end it "valid track with rights to it by querying user" do - jam_track_right = FactoryGirl.create(:jam_track_right) + jam_track_right = FactoryBot.create(:jam_track_right) keys = JamTrackRight.list_keys(jam_track_right.user, [jam_track_right.jam_track.id]) keys.should have(1).items keys[0].id.should == jam_track_right.jam_track.id @@ -133,37 +133,37 @@ describe JamTrackRight do describe "signing_state" do it "quiet" do - right = FactoryGirl.create(:jam_track_right) + right = FactoryBot.create(:jam_track_right) right.signing_state.should eq('QUIET') end it "signed" do - right = FactoryGirl.create(:jam_track_right, signed_44: true, signing_started_at_44: Time.now) + right = FactoryBot.create(:jam_track_right, signed_44: true, signing_started_at_44: Time.now) right.signing_state.should eq('SIGNED') end it "error" do - right = FactoryGirl.create(:jam_track_right, error_count: 1) + right = FactoryBot.create(:jam_track_right, error_count: 1) right.signing_state.should eq('ERROR') end it "signing" do - right = FactoryGirl.create(:jam_track_right, signing_started_at_44: Time.now, packaging_steps: 3, current_packaging_step:0, last_step_at:Time.now) + right = FactoryBot.create(:jam_track_right, signing_started_at_44: Time.now, packaging_steps: 3, current_packaging_step:0, last_step_at:Time.now) right.signing_state(44).should eq('SIGNING') end it "signing timeout" do - right = FactoryGirl.create(:jam_track_right, signing_started_at_48: Time.now - 100, packaging_steps: 3, current_packaging_step:0, last_step_at:Time.now) + right = FactoryBot.create(:jam_track_right, signing_started_at_48: Time.now - 100, packaging_steps: 3, current_packaging_step:0, last_step_at:Time.now) right.signing_state(48).should eq('SIGNING_TIMEOUT') end it "queued" do - right = FactoryGirl.create(:jam_track_right, signing_queued_at: Time.now) + right = FactoryBot.create(:jam_track_right, signing_queued_at: Time.now) right.signing_state(44).should eq('QUEUED') end it "signing timeout" do - right = FactoryGirl.create(:jam_track_right, signing_queued_at: Time.now - (APP_CONFIG.signing_job_queue_max_time + 1)) + right = FactoryBot.create(:jam_track_right, signing_queued_at: Time.now - (APP_CONFIG.signing_job_queue_max_time + 1)) right.signing_state(44).should eq('QUEUED_TIMEOUT') end end @@ -177,7 +177,7 @@ describe JamTrackRight do it "one" do - right1 = FactoryGirl.create(:jam_track_right) + right1 = FactoryBot.create(:jam_track_right) JamTrackRight.stats.should eq('count' => 1, 'signing_count' => 0, 'redeemed_count' => 0, @@ -186,8 +186,8 @@ describe JamTrackRight do end it "two" do - right1 = FactoryGirl.create(:jam_track_right) - right2 = FactoryGirl.create(:jam_track_right) + right1 = FactoryBot.create(:jam_track_right) + right2 = FactoryBot.create(:jam_track_right) JamTrackRight.stats.should eq('count' => 2, 'signing_count' => 0, @@ -227,17 +227,17 @@ describe JamTrackRight do end describe "guard_against_fraud" do - let(:user) {FactoryGirl.create(:user)} - let(:other) {FactoryGirl.create(:user)} + let(:user) {FactoryBot.create(:user)} + let(:other) {FactoryBot.create(:user)} let(:first_fingerprint) { {all: 'all', running: 'running' } } let(:new_fingerprint) { {all: 'all_2', running: 'running' } } let(:full_fingerprint) { {all: :all_3, running: :running_3, all_3: { mac: "72:00:02:4C:1E:61", name: "en2", upstate: true }, running_3: { mac: "72:00:02:4C:1E:62", name: "en3", upstate: false } } } let(:remote_ip) {'1.1.1.1'} let(:remote_ip2) {'2.2.2.2'} - let(:jam_track_right) { FactoryGirl.create(:jam_track_right, user: user, redeemed: true, redeemed_and_fingerprinted: false) } - let(:jam_track_right_purchased) { FactoryGirl.create(:jam_track_right, user: user, redeemed: false, redeemed_and_fingerprinted: false) } - let(:jam_track_right_other) { FactoryGirl.create(:jam_track_right, user: other, redeemed: true, redeemed_and_fingerprinted: false) } - let(:jam_track_right_other_purchased) { FactoryGirl.create(:jam_track_right, user: other, redeemed: false, redeemed_and_fingerprinted: false) } + let(:jam_track_right) { FactoryBot.create(:jam_track_right, user: user, redeemed: true, redeemed_and_fingerprinted: false) } + let(:jam_track_right_purchased) { FactoryBot.create(:jam_track_right, user: user, redeemed: false, redeemed_and_fingerprinted: false) } + let(:jam_track_right_other) { FactoryBot.create(:jam_track_right, user: other, redeemed: true, redeemed_and_fingerprinted: false) } + let(:jam_track_right_other_purchased) { FactoryBot.create(:jam_track_right, user: other, redeemed: false, redeemed_and_fingerprinted: false) } it "denies no current_user" do jam_track_right.guard_against_fraud(nil, first_fingerprint, remote_ip).should eq('no user specified') @@ -372,13 +372,13 @@ describe JamTrackRight do end it "stops you from redeeming two jamtracks" do - right1 = FactoryGirl.create(:jam_track_right, user: user, redeemed: true, redeemed_and_fingerprinted: true) + right1 = FactoryBot.create(:jam_track_right, user: user, redeemed: true, redeemed_and_fingerprinted: true) jam_track_right.guard_against_fraud(user, first_fingerprint, remote_ip).should eq('already redeemed another') MachineFingerprint.count.should eq(0) end it "let's you download a free jamtrack if you have a second but undownloaded free one" do - right1 = FactoryGirl.create(:jam_track_right, user: user, redeemed: true, redeemed_and_fingerprinted: false) + right1 = FactoryBot.create(:jam_track_right, user: user, redeemed: true, redeemed_and_fingerprinted: false) first_fingerprint2 = first_fingerprint.clone jam_track_right.guard_against_fraud(user, first_fingerprint, remote_ip).should be_nil MachineFingerprint.count.should eq(2) @@ -388,7 +388,7 @@ describe JamTrackRight do end it "creates metadata" do - right1 = FactoryGirl.create(:jam_track_right, user: user, redeemed: true, redeemed_and_fingerprinted: false) + right1 = FactoryBot.create(:jam_track_right, user: user, redeemed: true, redeemed_and_fingerprinted: false) jam_track_right.guard_against_fraud(user, full_fingerprint, remote_ip).should be_nil MachineFingerprint.count.should eq(2) diff --git a/ruby/spec/jam_ruby/models/jam_track_search_spec.rb b/ruby/spec/jam_ruby/models/jam_track_search_spec.rb index d4a3dc93d..b64d1df23 100644 --- a/ruby/spec/jam_ruby/models/jam_track_search_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_search_spec.rb @@ -13,10 +13,10 @@ describe 'JamTrack Search Model' do filter } let(:freebird) { - FactoryGirl.create(:jam_track_with_tracks, original_artist: 'jim bob', name: 'freebird') + FactoryBot.create(:jam_track_with_tracks, original_artist: 'jim bob', name: 'freebird') } let(:stairway) { - FactoryGirl.create(:jam_track_with_tracks, original_artist: 'jim bob', name: 'stairway to heaven') + FactoryBot.create(:jam_track_with_tracks, original_artist: 'jim bob', name: 'stairway to heaven') } before :each do @@ -39,7 +39,7 @@ describe 'JamTrack Search Model' do it "paginates by artist" do pending JamTrackSearch::PER_PAGE.times do |nn| - FactoryGirl.create(:jam_track_with_tracks, + FactoryBot.create(:jam_track_with_tracks, original_artist: freebird.original_artist + nn.to_s, name: 'abc'+nn.to_s) end @@ -66,7 +66,7 @@ describe 'JamTrack Search Model' do it "paginates by song" do pending (JamTrackSearch::PER_PAGE + 2).times do |nn| - FactoryGirl.create(:jam_track_with_tracks, + FactoryBot.create(:jam_track_with_tracks, original_artist: freebird.original_artist, name: 'abc'+nn.to_s) end diff --git a/ruby/spec/jam_ruby/models/jam_track_spec.rb b/ruby/spec/jam_ruby/models/jam_track_spec.rb index 022c5c15b..739b1d92d 100644 --- a/ruby/spec/jam_ruby/models/jam_track_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_spec.rb @@ -6,10 +6,10 @@ describe JamTrack do include CarrierWave::Test::Matchers include UsesTempFiles - let(:user) {FactoryGirl.create(:user)} + let(:user) {FactoryBot.create(:user)} it "created" do - jam_track = FactoryGirl.create(:jam_track) + jam_track = FactoryBot.create(:jam_track) jam_track.licensor.should_not be_nil jam_track.licensor.jam_tracks.should == [jam_track] jam_track.genres.length.should eq(1) @@ -17,7 +17,7 @@ describe JamTrack do describe 'sync_reproduction_royalty' do it "all possible conditions" do - jam_track = FactoryGirl.create(:jam_track) + jam_track = FactoryBot.create(:jam_track) jam_track.reproduction_royalty_amount.should be_nil jam_track.duration = 0 @@ -100,7 +100,7 @@ describe JamTrack do describe 'plays' do it "creates played instance properly" do - @jam_track = FactoryGirl.create(:jam_track) + @jam_track = FactoryBot.create(:jam_track) play = PlayablePlay.new # VRFS-2916 jam_tracks.id is varchar: REMOVE @@ -133,8 +133,8 @@ describe JamTrack do end it "groups" do - jam_track1 = FactoryGirl.create(:jam_track_with_tracks, original_artist: 'artist', name: 'a') - jam_track2 = FactoryGirl.create(:jam_track_with_tracks, original_artist: 'artist', name: 'b') + jam_track1 = FactoryBot.create(:jam_track_with_tracks, original_artist: 'artist', name: 'a') + jam_track2 = FactoryBot.create(:jam_track_with_tracks, original_artist: 'artist', name: 'b') query, pager = JamTrack.artist_index({}, user) query.size.should == 1 @@ -144,8 +144,8 @@ describe JamTrack do end it "sorts by name" do - jam_track1 = FactoryGirl.create(:jam_track_with_tracks, original_artist: 'blartist', name: 'a') - jam_track2 = FactoryGirl.create(:jam_track_with_tracks, original_artist: 'artist', name: 'b') + jam_track1 = FactoryBot.create(:jam_track_with_tracks, original_artist: 'blartist', name: 'a') + jam_track2 = FactoryBot.create(:jam_track_with_tracks, original_artist: 'artist', name: 'b') query, pager = JamTrack.artist_index({}, user) query.size.should == 2 @@ -164,8 +164,8 @@ describe JamTrack do end it "sorts by name" do - jam_track1 = FactoryGirl.create(:jam_track_with_tracks, original_artist: 'artist', name: 'a') - jam_track2 = FactoryGirl.create(:jam_track_with_tracks, original_artist: 'artist', name: 'b') + jam_track1 = FactoryBot.create(:jam_track_with_tracks, original_artist: 'artist', name: 'a') + jam_track2 = FactoryBot.create(:jam_track_with_tracks, original_artist: 'artist', name: 'b') query, pager = JamTrack.index({}, user) query.size.should == 2 @@ -183,8 +183,8 @@ describe JamTrack do end it "queries on genre" do - jam_track1 = FactoryGirl.create(:jam_track_with_tracks, original_artist: 'artist', name: 'a') - jam_track2 = FactoryGirl.create(:jam_track_with_tracks, original_artist: 'artist', name: 'b') + jam_track1 = FactoryBot.create(:jam_track_with_tracks, original_artist: 'artist', name: 'a') + jam_track2 = FactoryBot.create(:jam_track_with_tracks, original_artist: 'artist', name: 'b') jam_track1.genres = [Genre.find('rock')] jam_track2.genres = [Genre.find('asian')] jam_track1.save! @@ -203,22 +203,22 @@ describe JamTrack do end it "supports showing purchased only" do - jam_track1 = FactoryGirl.create(:jam_track_with_tracks, name: 'a') + jam_track1 = FactoryBot.create(:jam_track_with_tracks, name: 'a') # no results yet query, pager, count = JamTrack.index({show_purchased_only:true}, user) count.should == 0 # but after the user buys it, it is returned - FactoryGirl.create(:jam_track_right, jam_track: jam_track1, user: user) + FactoryBot.create(:jam_track_right, jam_track: jam_track1, user: user) query, pager = JamTrack.index({show_purchased_only:true}, user) query.size.should == 1 query[0].should eq(jam_track1) end it "full text search" do - jam_track1 = FactoryGirl.create(:jam_track_with_tracks, name: 'Take a Chance On Me', original_artist: 'ABBA') - jam_track2 = FactoryGirl.create(:jam_track_with_tracks, name: 'Nothing Chance', original_artist: 'ABBA') + jam_track1 = FactoryBot.create(:jam_track_with_tracks, name: 'Take a Chance On Me', original_artist: 'ABBA') + jam_track2 = FactoryBot.create(:jam_track_with_tracks, name: 'Nothing Chance', original_artist: 'ABBA') query, pager = JamTrack.index({search: 'Take'}, user) query.size.should == 1 @@ -240,7 +240,7 @@ describe JamTrack do query, pager, count = JamTrack.index({sort_by: 'jamtrack', artist: 'K.C. And The Sunshine Band'}, user) count.should == 0 - jam_track1 = FactoryGirl.create(:jam_track_with_tracks, name: 'Take a Chance On Me', original_artist: 'K.C. And The Sunshine Band') + jam_track1 = FactoryBot.create(:jam_track_with_tracks, name: 'Take a Chance On Me', original_artist: 'K.C. And The Sunshine Band') query, pager, count = JamTrack.index({sort_by: 'jamtrack', artist: 'K.C. And The Sunshine Band'}, user) count.should == 1 @@ -252,27 +252,27 @@ describe JamTrack do describe "price" do it "0.99" do - FactoryGirl.build(:jam_track, price: 0.99).valid?.should be_true + FactoryBot.build(:jam_track, price: 0.99).valid?.should be_true end it "1" do - FactoryGirl.build(:jam_track, price: 1).valid?.should be_true + FactoryBot.build(:jam_track, price: 1).valid?.should be_true end it "100" do - FactoryGirl.build(:jam_track, price: 100).valid?.should be_true + FactoryBot.build(:jam_track, price: 100).valid?.should be_true end it "100.1" do - FactoryGirl.build(:jam_track, price: 100.1).valid?.should be_true + FactoryBot.build(:jam_track, price: 100.1).valid?.should be_true end it "100.12" do - FactoryGirl.build(:jam_track, price: 100.12).valid?.should be_true + FactoryBot.build(:jam_track, price: 100.12).valid?.should be_true end it "100.123" do - jam_track = FactoryGirl.build(:jam_track, price: 100.123) + jam_track = FactoryBot.build(:jam_track, price: 100.123) jam_track.valid?.should be_false jam_track.errors[:price].should == ['is invalid'] end @@ -280,31 +280,31 @@ describe JamTrack do describe "reproduction_royalty_amount" do it "0.99" do - FactoryGirl.build(:jam_track, reproduction_royalty_amount: 0.99).valid?.should be_true + FactoryBot.build(:jam_track, reproduction_royalty_amount: 0.99).valid?.should be_true end it "1" do - FactoryGirl.build(:jam_track, reproduction_royalty_amount: 1).valid?.should be_true + FactoryBot.build(:jam_track, reproduction_royalty_amount: 1).valid?.should be_true end it "100" do - FactoryGirl.build(:jam_track, reproduction_royalty_amount: 100).valid?.should be_true + FactoryBot.build(:jam_track, reproduction_royalty_amount: 100).valid?.should be_true end it "100.1" do - FactoryGirl.build(:jam_track, reproduction_royalty_amount: 100.1).valid?.should be_true + FactoryBot.build(:jam_track, reproduction_royalty_amount: 100.1).valid?.should be_true end it "100.12" do - FactoryGirl.build(:jam_track, reproduction_royalty_amount: 100.12).valid?.should be_true + FactoryBot.build(:jam_track, reproduction_royalty_amount: 100.12).valid?.should be_true end it "100.123" do - FactoryGirl.build(:jam_track, reproduction_royalty_amount: 100.123).valid?.should be_true + FactoryBot.build(:jam_track, reproduction_royalty_amount: 100.123).valid?.should be_true end it "100.1234" do - jam_track = FactoryGirl.build(:jam_track, reproduction_royalty_amount: 100.12345) + jam_track = FactoryBot.build(:jam_track, reproduction_royalty_amount: 100.12345) jam_track.valid?.should be_false jam_track.errors[:reproduction_royalty_amount].should == ['is invalid'] end diff --git a/ruby/spec/jam_ruby/models/jam_track_tap_in_spec.rb b/ruby/spec/jam_ruby/models/jam_track_tap_in_spec.rb index c60f310a7..8d7a26ef5 100644 --- a/ruby/spec/jam_ruby/models/jam_track_tap_in_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_tap_in_spec.rb @@ -4,15 +4,15 @@ require 'spec_helper' describe JamTrackTapIn do it "creates successfully" do - FactoryGirl.create(:jam_track_tap_in) + FactoryBot.create(:jam_track_tap_in) end it "offset must be specified" do - FactoryGirl.build(:jam_track_tap_in, offset_time: nil).valid?.should be_false + FactoryBot.build(:jam_track_tap_in, offset_time: nil).valid?.should be_false end it "jam_track must be specified" do - FactoryGirl.build(:jam_track_tap_in, jam_track: nil).valid?.should be_false + FactoryBot.build(:jam_track_tap_in, jam_track: nil).valid?.should be_false end end =end diff --git a/ruby/spec/jam_ruby/models/jam_track_track_spec.rb b/ruby/spec/jam_ruby/models/jam_track_track_spec.rb index 67a50ec22..a914ab99f 100644 --- a/ruby/spec/jam_ruby/models/jam_track_track_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_track_spec.rb @@ -5,7 +5,7 @@ describe JamTrackTrack do include UsesTempFiles it "created" do - jam_track_track = FactoryGirl.create(:jam_track_track) + jam_track_track = FactoryBot.create(:jam_track_track) jam_track_track.jam_track.should_not be_nil jam_track_track.jam_track.reload jam_track_track.jam_track.jam_track_tracks.should == [jam_track_track] @@ -13,16 +13,16 @@ describe JamTrackTrack do describe "validations" do it "position" do - jam_track = FactoryGirl.create(:jam_track) - jam_track_track_1 = FactoryGirl.create(:jam_track_track, position: 1, jam_track: jam_track) - jam_track_track_2 = FactoryGirl.build(:jam_track_track, position: 1, jam_track: jam_track) + jam_track = FactoryBot.create(:jam_track) + jam_track_track_1 = FactoryBot.create(:jam_track_track, position: 1, jam_track: jam_track) + jam_track_track_2 = FactoryBot.build(:jam_track_track, position: 1, jam_track: jam_track) jam_track_track_2.valid?.should == false #jam_track_track_2.errors[:position].should == ['has already been taken'] end it "jam_track required" do pending "Need to be not mandatory because of activeadmin" - jam_track = FactoryGirl.build(:jam_track_track, jam_track: nil) + jam_track = FactoryBot.build(:jam_track_track, jam_track: nil) jam_track.valid?.should be_false jam_track.errors[:jam_track].should == ["can't be blank"] end @@ -49,7 +49,7 @@ describe JamTrackTrack do it "uploads to s3 with correct name, and then downloads via signed URL" do s3 = S3Manager.new(APP_CONFIG.aws_bucket, APP_CONFIG.aws_access_key_id, APP_CONFIG.aws_secret_access_key) - jam_track_track = FactoryGirl.create(:jam_track_track) + jam_track_track = FactoryBot.create(:jam_track_track) s3.upload(jam_track_track.manually_uploaded_filename(:url_48), TRACK_NAME) jam_track_track[:url_48] = jam_track_track.manually_uploaded_filename(:url_48) jam_track_track.save! diff --git a/ruby/spec/jam_ruby/models/jamblaster_spec.rb b/ruby/spec/jam_ruby/models/jamblaster_spec.rb index 8a35a6c57..276da0565 100644 --- a/ruby/spec/jam_ruby/models/jamblaster_spec.rb +++ b/ruby/spec/jam_ruby/models/jamblaster_spec.rb @@ -2,11 +2,11 @@ require 'spec_helper' describe Jamblaster do - let(:jamblaster) { FactoryGirl.create(:jamblaster) } - let(:user) { FactoryGirl.create(:user) } + let(:jamblaster) { FactoryBot.create(:jamblaster) } + let(:user) { FactoryBot.create(:user) } it "can be created" do - FactoryGirl.create(:jamblaster) + FactoryBot.create(:jamblaster) end it "can associate to users" do @@ -44,7 +44,7 @@ describe Jamblaster do jamblaster.most_recent_pairing.should be nil - pairing1 = FactoryGirl.create(:jamblaster_pairing_request, user: user, jamblaster: jamblaster, vtoken: 'token2', sibling_key: nil) + pairing1 = FactoryBot.create(:jamblaster_pairing_request, user: user, jamblaster: jamblaster, vtoken: 'token2', sibling_key: nil) jamblaster.most_recent_pairing.should be nil @@ -52,7 +52,7 @@ describe Jamblaster do jamblaster.most_recent_pairing.should eql pairing1 - pairing2 = FactoryGirl.create(:jamblaster_pairing_request, user: user, jamblaster: jamblaster, sibling_key: 'key1', vtoken: 'token1') + pairing2 = FactoryBot.create(:jamblaster_pairing_request, user: user, jamblaster: jamblaster, sibling_key: 'key1', vtoken: 'token1') jamblaster.most_recent_pairing.should eql pairing1 diff --git a/ruby/spec/jam_ruby/models/join_request_spec.rb b/ruby/spec/jam_ruby/models/join_request_spec.rb index bfdd1a92b..d20c8bfd3 100644 --- a/ruby/spec/jam_ruby/models/join_request_spec.rb +++ b/ruby/spec/jam_ruby/models/join_request_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' describe JoinRequest do it 'can create a join request' do - user1 = FactoryGirl.create(:user) - music_session = FactoryGirl.create(:active_music_session, :creator => user1) - music_session_member1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session) + user1 = FactoryBot.create(:user) + music_session = FactoryBot.create(:active_music_session, :creator => user1) + music_session_member1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session) join_request = JoinRequest.new(:user => user1, :music_session => music_session.music_session, :text => "Let me join yo") join_request.save.should be_true @@ -16,10 +16,10 @@ describe JoinRequest do end it 'fans cant create a join request' do - user1 = FactoryGirl.create(:user, :musician => true) - user2 = FactoryGirl.create(:user, :musician => false) - music_session = FactoryGirl.create(:active_music_session, :creator => user1) - music_session_member1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session) + user1 = FactoryBot.create(:user, :musician => true) + user2 = FactoryBot.create(:user, :musician => false) + music_session = FactoryBot.create(:active_music_session, :creator => user1) + music_session_member1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session) join_request = JoinRequest.new(:user => user2, :music_session => music_session.music_session, :text => "Let me join yo") join_request.save.should be_false @@ -28,9 +28,9 @@ describe JoinRequest do end it 'cant create a dup join_request' do - user1 = FactoryGirl.create(:user) - music_session = FactoryGirl.create(:active_music_session, :creator => user1) - music_session_member1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session) + user1 = FactoryBot.create(:user) + music_session = FactoryBot.create(:active_music_session, :creator => user1) + music_session_member1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session) join_request = JoinRequest.new(:user => user1, :music_session => music_session.music_session, :text => "Let me join yo") join_request.save.should be_true @@ -41,9 +41,9 @@ describe JoinRequest do end it "cant contain profanity in the text" do - user1 = FactoryGirl.create(:user) - music_session = FactoryGirl.create(:active_music_session, :creator => user1) - music_session_member1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session) + user1 = FactoryBot.create(:user) + music_session = FactoryBot.create(:active_music_session, :creator => user1) + music_session_member1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session) join_request = JoinRequest.new(:user => user1, :music_session => music_session.music_session, :text => "fuck you") join_request.save join_request.valid?.should be_false diff --git a/ruby/spec/jam_ruby/models/latency_tester_spec.rb b/ruby/spec/jam_ruby/models/latency_tester_spec.rb index c0d26a619..7a111bdab 100644 --- a/ruby/spec/jam_ruby/models/latency_tester_spec.rb +++ b/ruby/spec/jam_ruby/models/latency_tester_spec.rb @@ -9,7 +9,7 @@ describe LatencyTester do } it "success" do - latency_tester = FactoryGirl.create(:latency_tester) + latency_tester = FactoryBot.create(:latency_tester) latency_tester.connection.should_not be_nil latency_tester.connection.latency_tester.should_not be_nil @@ -25,7 +25,7 @@ describe LatencyTester do end it "existing latency tester, no connection" do - latency_tester = FactoryGirl.create(:latency_tester, client_id: params[:client_id], make_connection: false) + latency_tester = FactoryBot.create(:latency_tester, client_id: params[:client_id], make_connection: false) latency_tester.connection.should be_nil latency_tester.client_id = params[:client_id] @@ -39,7 +39,7 @@ describe LatencyTester do end it "existing latency tester, existing connection" do - latency_tester = FactoryGirl.create(:latency_tester) + latency_tester = FactoryBot.create(:latency_tester) latency_tester.connection.aasm_state = Connection::STALE_STATE.to_s latency_tester.save! diff --git a/ruby/spec/jam_ruby/models/lesson_booking_slot_spec.rb b/ruby/spec/jam_ruby/models/lesson_booking_slot_spec.rb index b1fce69b0..19d01cea4 100644 --- a/ruby/spec/jam_ruby/models/lesson_booking_slot_spec.rb +++ b/ruby/spec/jam_ruby/models/lesson_booking_slot_spec.rb @@ -4,9 +4,9 @@ require 'spec_helper' # collissions with teacher's schedule? describe LessonBookingSlot do - let(:user) { FactoryGirl.create(:user, stored_credit_card: false, remaining_free_lessons: 1, remaining_test_drives: 1) } - let(:lesson_booking_slot_single1) { FactoryGirl.build(:lesson_booking_slot_single, timezone: 'US/Pacific', hour: 12) } - let(:lesson_booking_slot_recurring1) { FactoryGirl.build(:lesson_booking_slot_recurring, timezone: 'US/Pacific', hour: 12) } + let(:user) { FactoryBot.create(:user, stored_credit_card: false, remaining_free_lessons: 1, remaining_test_drives: 1) } + let(:lesson_booking_slot_single1) { FactoryBot.build(:lesson_booking_slot_single, timezone: 'US/Pacific', hour: 12) } + let(:lesson_booking_slot_recurring1) { FactoryBot.build(:lesson_booking_slot_recurring, timezone: 'US/Pacific', hour: 12) } before do diff --git a/ruby/spec/jam_ruby/models/lesson_booking_spec.rb b/ruby/spec/jam_ruby/models/lesson_booking_spec.rb index f415affa5..b5a3d739f 100644 --- a/ruby/spec/jam_ruby/models/lesson_booking_spec.rb +++ b/ruby/spec/jam_ruby/models/lesson_booking_spec.rb @@ -5,13 +5,13 @@ require 'spec_helper' # collissions with teacher's schedule? describe LessonBooking do - let(:user) { FactoryGirl.create(:user, stored_credit_card: false, remaining_free_lessons: 1, remaining_test_drives: 1) } - let(:teacher_user) { FactoryGirl.create(:teacher_user) } + let(:user) { FactoryBot.create(:user, stored_credit_card: false, remaining_free_lessons: 1, remaining_test_drives: 1) } + let(:teacher_user) { FactoryBot.create(:teacher_user) } let(:teacher) { teacher_user.teacher } - let(:lesson_booking_slot_single1) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_single2) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_recurring1) { FactoryGirl.build(:lesson_booking_slot_recurring, day_of_week: 2.days.from_now.wday) } - let(:lesson_booking_slot_recurring2) { FactoryGirl.build(:lesson_booking_slot_recurring, day_of_week: 3.days.from_now.wday) } + let(:lesson_booking_slot_single1) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_single2) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_recurring1) { FactoryBot.build(:lesson_booking_slot_recurring, day_of_week: 2.days.from_now.wday) } + let(:lesson_booking_slot_recurring2) { FactoryBot.build(:lesson_booking_slot_recurring, day_of_week: 3.days.from_now.wday) } let(:valid_single_slots) { [lesson_booking_slot_single1, lesson_booking_slot_single2] } let(:valid_recurring_slots) { [lesson_booking_slot_recurring1, lesson_booking_slot_recurring2] } @@ -424,7 +424,7 @@ describe LessonBooking do end it "must have well-formed booking slots" do - bad_slot = FactoryGirl.build(:lesson_booking_slot_single, minute: nil) + bad_slot = FactoryBot.build(:lesson_booking_slot_single, minute: nil) booking = LessonBooking.book_free(user, teacher_user, [lesson_booking_slot_single1, bad_slot], "Hey I've heard of you before.") booking.errors.any?.should be true booking.errors[:lesson_booking_slots].should eq ["is invalid"] @@ -487,7 +487,7 @@ describe LessonBooking do it "must have well-formed booking slots" do - bad_slot = FactoryGirl.build(:lesson_booking_slot_single, minute: nil) + bad_slot = FactoryBot.build(:lesson_booking_slot_single, minute: nil) booking = LessonBooking.book_test_drive(user, teacher_user, [lesson_booking_slot_single1, bad_slot], "Hey I've heard of you before.") booking.errors.any?.should be true booking.errors[:lesson_booking_slots].should eq ["is invalid"] @@ -587,7 +587,7 @@ describe LessonBooking do it "must have well-formed booking slots" do - bad_slot = FactoryGirl.build(:lesson_booking_slot_recurring, day_of_week: nil) + bad_slot = FactoryBot.build(:lesson_booking_slot_recurring, day_of_week: nil) booking = LessonBooking.book_test_drive(user, teacher_user, [lesson_booking_slot_recurring1, bad_slot], "Hey I've heard of you before.") booking.errors.any?.should be true booking.errors[:lesson_booking_slots].should eq ["is invalid"] @@ -769,7 +769,7 @@ describe LessonBooking do initial_scheduled_time = lesson_session.scheduled_start - counter = FactoryGirl.build(:lesson_booking_slot_single, preferred_day: Date.today + 20) + counter = FactoryBot.build(:lesson_booking_slot_single, preferred_day: Date.today + 20) lesson_session.counter({proposer: user, slot: counter, message: 'ACtually, let\'s do this instead for just this one'}) Timecop.travel(initial_scheduled_time + 1) @@ -790,7 +790,7 @@ describe LessonBooking do lesson_session.status.should eql LessonSession::STATUS_REQUESTED lesson_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) - counter = FactoryGirl.build(:lesson_booking_slot_single, hour: 16) + counter = FactoryBot.build(:lesson_booking_slot_single, hour: 16) lesson_session.counter({proposer: user, slot: counter, message: 'Does this work better?'}) lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_COUNTERED @@ -816,7 +816,7 @@ describe LessonBooking do lesson_session.status.should eql LessonSession::STATUS_REQUESTED lesson_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) - counter = FactoryGirl.build(:lesson_booking_slot_recurring, day_of_week: 2, update_all: true) + counter = FactoryBot.build(:lesson_booking_slot_recurring, day_of_week: 2, update_all: true) lesson_session.counter({proposer: user, slot: counter, message: 'Does this work better?'}) lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_REQUESTED @@ -847,7 +847,7 @@ describe LessonBooking do # now it's approved, we have 2 sessions that are not yet completed with a time # we should be able to reschedule just one of the lessons - counter2 = FactoryGirl.build(:lesson_booking_slot_single, day_of_week: 4) + counter2 = FactoryBot.build(:lesson_booking_slot_single, day_of_week: 4) lesson_session.counter({proposer: user, slot: counter2, message: 'ACtually, let\'s do this instead for just this one'}) lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_COUNTERED @@ -869,7 +869,7 @@ describe LessonBooking do # we should be able to reschedule all of the lessons - counter3 = FactoryGirl.build(:lesson_booking_slot_recurring, day_of_week: 5, update_all: true) + counter3 = FactoryBot.build(:lesson_booking_slot_recurring, day_of_week: 5, update_all: true) lesson_session.counter({proposer: user, slot: counter3, message: 'ACtually, let\'s do this instead for just this one... again'}) lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_APPROVED diff --git a/ruby/spec/jam_ruby/models/lesson_package_purchase_spec.rb b/ruby/spec/jam_ruby/models/lesson_package_purchase_spec.rb index 5d542f0c4..f9924f359 100644 --- a/ruby/spec/jam_ruby/models/lesson_package_purchase_spec.rb +++ b/ruby/spec/jam_ruby/models/lesson_package_purchase_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe LessonPackagePurchase do - let(:user) {FactoryGirl.create(:user)} - let(:lesson_booking) {FactoryGirl.create(:lesson_booking)} + let(:user) {FactoryBot.create(:user)} + let(:lesson_booking) {FactoryBot.create(:lesson_booking)} end diff --git a/ruby/spec/jam_ruby/models/lesson_payment_charge_spec.rb b/ruby/spec/jam_ruby/models/lesson_payment_charge_spec.rb index f51510228..b34bce68d 100644 --- a/ruby/spec/jam_ruby/models/lesson_payment_charge_spec.rb +++ b/ruby/spec/jam_ruby/models/lesson_payment_charge_spec.rb @@ -2,14 +2,14 @@ require 'spec_helper' describe TeacherPaymentCharge, no_transaction: true do - let(:user) { FactoryGirl.create(:user) } - let(:user2) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } + let(:user2) { FactoryBot.create(:user) } let(:teacher1_auth) { UserAuthorization.create(provider: 'stripe_connect', uid: stripe_account1_id, token: 'abc', refresh_token: 'abc', token_expiration: Date.today + 365, secret: 'secret') } let(:teacher2_auth) { UserAuthorization.create(provider: 'stripe_connect', uid: stripe_account2_id, token: 'abc', refresh_token: 'abc', token_expiration: Date.today + 365, secret: 'secret') } - let(:teacher) { FactoryGirl.create(:user) } - let(:teacher2) { FactoryGirl.create(:user) } - let(:teacher_obj) { FactoryGirl.create(:teacher, user: teacher) } - let(:teacher_obj2) { FactoryGirl.create(:teacher, user: teacher2) } + let(:teacher) { FactoryBot.create(:user) } + let(:teacher2) { FactoryBot.create(:user) } + let(:teacher_obj) { FactoryBot.create(:teacher, user: teacher) } + let(:teacher_obj2) { FactoryBot.create(:teacher, user: teacher2) } let(:lesson) { normal_lesson(user, teacher, finish: true, accept: true, student_show: true, no_after_logic: true) } diff --git a/ruby/spec/jam_ruby/models/lesson_session_analyser_spec.rb b/ruby/spec/jam_ruby/models/lesson_session_analyser_spec.rb index 0bf91c2cb..2b3c1924e 100644 --- a/ruby/spec/jam_ruby/models/lesson_session_analyser_spec.rb +++ b/ruby/spec/jam_ruby/models/lesson_session_analyser_spec.rb @@ -4,13 +4,13 @@ require 'spec_helper' describe LessonSessionAnalyser do - let(:user) { FactoryGirl.create(:user, remaining_test_drives: 1) } - let(:teacher) { FactoryGirl.create(:teacher_user) } + let(:user) { FactoryBot.create(:user, remaining_test_drives: 1) } + let(:teacher) { FactoryBot.create(:teacher_user) } let(:start) { Time.now } - let(:lesson_booking_slot_single1) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_single2) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_recurring1) { FactoryGirl.build(:lesson_booking_slot_recurring) } - let(:lesson_booking_slot_recurring2) { FactoryGirl.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_single1) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_single2) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_recurring1) { FactoryBot.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_recurring2) { FactoryBot.build(:lesson_booking_slot_recurring) } let(:valid_single_slots) { [lesson_booking_slot_single1, lesson_booking_slot_single2] } let(:valid_recurring_slots) { [lesson_booking_slot_recurring1, lesson_booking_slot_recurring2] } @@ -48,7 +48,7 @@ describe LessonSessionAnalyser do # create some bogus, super-perfect teacher/student times start = lesson.scheduled_start end_time = lesson.scheduled_start + (60 * lesson.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher, history: music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher, history: music_session, created_at: start, session_removed_at: end_time) Timecop.travel(end_time + 1) @@ -75,7 +75,7 @@ describe LessonSessionAnalyser do # create some bogus, super-perfect teacher/student times start = lesson.scheduled_start end_time = lesson.scheduled_start + (60 * lesson.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: user, history: music_session, created_at: start - 60, session_removed_at: nil) + uh2 = FactoryBot.create(:music_session_user_history, user: user, history: music_session, created_at: start - 60, session_removed_at: nil) Timecop.freeze(start + 11 * 60) @@ -106,8 +106,8 @@ describe LessonSessionAnalyser do start = lesson.scheduled_start end_time = lesson.scheduled_start + (60 * lesson.duration) late_start = start + (7 * 60) - uh1 = FactoryGirl.create(:music_session_user_history, user: user, history: music_session, created_at: late_start, session_removed_at: late_start + 4 * 60) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher, history: music_session, created_at: start, session_removed_at: end_time) + uh1 = FactoryBot.create(:music_session_user_history, user: user, history: music_session, created_at: late_start, session_removed_at: late_start + 4 * 60) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher, history: music_session, created_at: start, session_removed_at: end_time) Timecop.travel(end_time + 1) @@ -140,8 +140,8 @@ describe LessonSessionAnalyser do # create some bogus, super-perfect teacher/student times start = lesson.scheduled_start end_time = lesson.scheduled_start + (60 * lesson.duration) - uh1 = FactoryGirl.create(:music_session_user_history, user: user, history: music_session, created_at: start, session_removed_at: end_time) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher, history: music_session, created_at: start, session_removed_at: end_time) + uh1 = FactoryBot.create(:music_session_user_history, user: user, history: music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher, history: music_session, created_at: start, session_removed_at: end_time) analysis = LessonSessionAnalyser.analyse(lesson) @@ -237,7 +237,7 @@ describe LessonSessionAnalyser do uh1Begin = start uh1End = start + 1 - uh1 = FactoryGirl.build(:music_session_user_history, user: user, history: music_session, created_at: uh1Begin, session_removed_at: uh1End) + uh1 = FactoryBot.build(:music_session_user_history, user: user, history: music_session, created_at: uh1Begin, session_removed_at: uh1End) ranges = LessonSessionAnalyser.time_ranges [uh1] @@ -251,8 +251,8 @@ describe LessonSessionAnalyser do uh2Begin = uh1Begin uh2End = uh1End - uh1 = FactoryGirl.build(:music_session_user_history, user: user, history: music_session, created_at: uh1Begin, session_removed_at: uh1End) - uh2 = FactoryGirl.build(:music_session_user_history, user: user, history: music_session, created_at: uh2Begin, session_removed_at: uh2End) + uh1 = FactoryBot.build(:music_session_user_history, user: user, history: music_session, created_at: uh1Begin, session_removed_at: uh1End) + uh2 = FactoryBot.build(:music_session_user_history, user: user, history: music_session, created_at: uh2Begin, session_removed_at: uh2End) ranges = LessonSessionAnalyser.time_ranges [uh1, uh2] @@ -266,8 +266,8 @@ describe LessonSessionAnalyser do uh2Begin = start + 3 uh2End = start + 5 - uh1 = FactoryGirl.build(:music_session_user_history, user: user, history: music_session, created_at: uh1Begin, session_removed_at: uh1End) - uh2 = FactoryGirl.build(:music_session_user_history, user: user, history: music_session, created_at: uh2Begin, session_removed_at: uh2End) + uh1 = FactoryBot.build(:music_session_user_history, user: user, history: music_session, created_at: uh1Begin, session_removed_at: uh1End) + uh2 = FactoryBot.build(:music_session_user_history, user: user, history: music_session, created_at: uh2Begin, session_removed_at: uh2End) ranges = LessonSessionAnalyser.time_ranges [uh1, uh2] @@ -281,8 +281,8 @@ describe LessonSessionAnalyser do uh2Begin = start + 0.5 uh2End = start + 5 - uh1 = FactoryGirl.build(:music_session_user_history, user: user, history: music_session, created_at: uh1Begin, session_removed_at: uh1End) - uh2 = FactoryGirl.build(:music_session_user_history, user: user, history: music_session, created_at: uh2Begin, session_removed_at: uh2End) + uh1 = FactoryBot.build(:music_session_user_history, user: user, history: music_session, created_at: uh1Begin, session_removed_at: uh1End) + uh2 = FactoryBot.build(:music_session_user_history, user: user, history: music_session, created_at: uh2Begin, session_removed_at: uh2End) ranges = LessonSessionAnalyser.time_ranges [uh1, uh2] @@ -299,9 +299,9 @@ describe LessonSessionAnalyser do uh3Begin = start + 0.1 uh3End = start + 6 - uh1 = FactoryGirl.build(:music_session_user_history, user: user, history: music_session, created_at: uh1Begin, session_removed_at: uh1End) - uh2 = FactoryGirl.build(:music_session_user_history, user: user, history: music_session, created_at: uh2Begin, session_removed_at: uh2End) - uh3 = FactoryGirl.build(:music_session_user_history, user: user, history: music_session, created_at: uh3Begin, session_removed_at: uh3End) + uh1 = FactoryBot.build(:music_session_user_history, user: user, history: music_session, created_at: uh1Begin, session_removed_at: uh1End) + uh2 = FactoryBot.build(:music_session_user_history, user: user, history: music_session, created_at: uh2Begin, session_removed_at: uh2End) + uh3 = FactoryBot.build(:music_session_user_history, user: user, history: music_session, created_at: uh3Begin, session_removed_at: uh3End) ranges = LessonSessionAnalyser.time_ranges [uh1, uh2, uh3] diff --git a/ruby/spec/jam_ruby/models/lesson_session_monthly_price_spec.rb b/ruby/spec/jam_ruby/models/lesson_session_monthly_price_spec.rb index 703d6b529..7ae40dcb7 100644 --- a/ruby/spec/jam_ruby/models/lesson_session_monthly_price_spec.rb +++ b/ruby/spec/jam_ruby/models/lesson_session_monthly_price_spec.rb @@ -2,13 +2,13 @@ require 'spec_helper' describe LessonSessionMonthlyPrice do - let(:user) { FactoryGirl.create(:user) } - let(:teacher) { FactoryGirl.create(:teacher_user) } + let(:user) { FactoryBot.create(:user) } + let(:teacher) { FactoryBot.create(:teacher_user) } let(:start) { Time.now } - let(:lesson_booking_slot_single1) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_single2) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_recurring1) { FactoryGirl.build(:lesson_booking_slot_recurring) } - let(:lesson_booking_slot_recurring2) { FactoryGirl.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_single1) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_single2) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_recurring1) { FactoryBot.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_recurring2) { FactoryBot.build(:lesson_booking_slot_recurring) } let(:valid_single_slots) { [lesson_booking_slot_single1, lesson_booking_slot_single2] } let(:valid_recurring_slots) { [lesson_booking_slot_recurring1, lesson_booking_slot_recurring2] } diff --git a/ruby/spec/jam_ruby/models/lesson_session_spec.rb b/ruby/spec/jam_ruby/models/lesson_session_spec.rb index 5c89a3e38..b77c87e85 100644 --- a/ruby/spec/jam_ruby/models/lesson_session_spec.rb +++ b/ruby/spec/jam_ruby/models/lesson_session_spec.rb @@ -3,10 +3,10 @@ require 'spec_helper' describe LessonSession do - let(:user) { FactoryGirl.create(:user, stored_credit_card: true, remaining_free_lessons: 1, remaining_test_drives: 1) } - let(:teacher) { FactoryGirl.create(:teacher_user) } - let(:slot1) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:slot2) { FactoryGirl.build(:lesson_booking_slot_single) } + let(:user) { FactoryBot.create(:user, stored_credit_card: true, remaining_free_lessons: 1, remaining_test_drives: 1) } + let(:teacher) { FactoryBot.create(:teacher_user) } + let(:slot1) { FactoryBot.build(:lesson_booking_slot_single) } + let(:slot2) { FactoryBot.build(:lesson_booking_slot_single) } let(:lesson_booking) { b = LessonBooking.book_normal(user, teacher, [slot1, slot2], "Hey I've heard of you before.", false, LessonBooking::PAYMENT_STYLE_SINGLE, 60); b.card_presumed_ok = true; b.save!; b } let(:lesson_session) { lesson_booking.lesson_sessions[0] } @@ -18,7 +18,7 @@ describe LessonSession do it "counter madness" do lesson = monthly_lesson(user, teacher, {accept: false}) # start with the student - invalid = FactoryGirl.build(:lesson_booking_slot_single, update_all: false) + invalid = FactoryBot.build(:lesson_booking_slot_single, update_all: false) lesson.counter({proposer: user, message: "crumble and bumble", slot: invalid}) lesson.errors.any?.should be_true @@ -26,7 +26,7 @@ describe LessonSession do lesson.reload lesson.counter_slot.should be_nil - counter1 = FactoryGirl.build(:lesson_booking_slot_recurring, update_all: true) + counter1 = FactoryBot.build(:lesson_booking_slot_recurring, update_all: true) lesson.counter({proposer: user, message: "crumble and bumble take 2", slot: counter1}) lesson.errors.any?.should be_false @@ -36,7 +36,7 @@ describe LessonSession do lesson.counter_slot.should be_nil lesson.lesson_booking.counter_slot.id.should eql counter1.id - counter2 = FactoryGirl.build(:lesson_booking_slot_recurring, update_all: true) + counter2 = FactoryBot.build(:lesson_booking_slot_recurring, update_all: true) lesson.counter({proposer: teacher, message: "crumble and bumble take 3", slot: counter2}) lesson.errors.any?.should be_false @@ -53,7 +53,7 @@ describe LessonSession do lesson.status.should eql LessonSession::STATUS_APPROVED lesson.has_recurring_counter?.should be false - counter3 = FactoryGirl.build(:lesson_booking_slot_recurring) + counter3 = FactoryBot.build(:lesson_booking_slot_recurring) lesson.counter({proposer: user, message: "crumble and bumble take 4", slot: counter3}) lesson.errors.any?.should be_false @@ -63,7 +63,7 @@ describe LessonSession do lesson.lesson_booking.counter_slot.id.should eql counter3.id lesson.has_recurring_counter?.should be true - counter4 = FactoryGirl.build(:lesson_booking_slot_recurring, update_all: true) + counter4 = FactoryBot.build(:lesson_booking_slot_recurring, update_all: true) lesson.counter({proposer: teacher, message: "crumble and bumble take 5", slot: counter4}) lesson.errors.any?.should be_false @@ -79,7 +79,7 @@ describe LessonSession do lesson1 = monthly_lesson(user, teacher, {accept: true}) lesson2 = lesson1.lesson_booking.lesson_sessions.order(:created_at).last - counter1 = FactoryGirl.build(:lesson_booking_slot_recurring, update_all: true) + counter1 = FactoryBot.build(:lesson_booking_slot_recurring, update_all: true) lesson1.counter({proposer: user, message: "crumble and bumble take 2", slot: counter1}) lesson1.errors.any?.should be_false @@ -92,7 +92,7 @@ describe LessonSession do lesson1.lesson_booking.counter_slot.id.should eql counter1.id lesson1.lesson_booking.is_countered?.should be true - counter2 = FactoryGirl.build(:lesson_booking_slot_single, update_all: true) + counter2 = FactoryBot.build(:lesson_booking_slot_single, update_all: true) lesson2.counter({proposer: user, message: "crumble and bumble take 3", slot: counter2}) lesson1.errors.any?.should be_false @@ -127,7 +127,7 @@ describe LessonSession do lesson1 = monthly_lesson(user, teacher, {accept: true}) lesson2 = lesson1.lesson_booking.lesson_sessions.order(:created_at).last - counter1 = FactoryGirl.build(:lesson_booking_slot_recurring, update_all: true) + counter1 = FactoryBot.build(:lesson_booking_slot_recurring, update_all: true) lesson1.counter({proposer: user, message: "crumble and bumble take 2", slot: counter1}) lesson1.errors.any?.should be_false @@ -141,7 +141,7 @@ describe LessonSession do lesson1.lesson_booking.counter_slot.id.should eql counter1.id lesson1.lesson_booking.is_countered?.should be true - counter2 = FactoryGirl.build(:lesson_booking_slot_single, update_all: true) + counter2 = FactoryBot.build(:lesson_booking_slot_single, update_all: true) lesson2.counter({proposer: user, message: "crumble and bumble take 3", slot: counter2}) lesson1.errors.any?.should be_false @@ -179,7 +179,7 @@ describe LessonSession do lesson1 = monthly_lesson(user, teacher, {accept: true}) lesson2 = lesson1.lesson_booking.lesson_sessions.order(:created_at).last - counter1 = FactoryGirl.build(:lesson_booking_slot_recurring, update_all: true) + counter1 = FactoryBot.build(:lesson_booking_slot_recurring, update_all: true) lesson1.counter({proposer: user, message: "crumble and bumble take 2", slot: counter1}) lesson1.errors.any?.should be_false @@ -354,7 +354,7 @@ describe LessonSession do describe "accept" do it "accepts in the past is errored" do - slot = FactoryGirl.build(:lesson_booking_slot_single, preferred_day: Date.today + 1) + slot = FactoryBot.build(:lesson_booking_slot_single, preferred_day: Date.today + 1) lesson = normal_lesson(user, teacher, {slots: [slot, slot2]}) Timecop.travel(Date.today + 2) lesson.accept({ @@ -367,8 +367,8 @@ describe LessonSession do end it "accepts in the past for a recurring is OK" do - slotRecurring1 = FactoryGirl.build(:lesson_booking_slot_recurring) - slotRecurring2 = FactoryGirl.build(:lesson_booking_slot_recurring) + slotRecurring1 = FactoryBot.build(:lesson_booking_slot_recurring) + slotRecurring2 = FactoryBot.build(:lesson_booking_slot_recurring) lesson = monthly_lesson(user, teacher, {slots: [slotRecurring1, slotRecurring2]}) Timecop.travel(Date.today + 100) lesson.accept({ @@ -380,7 +380,7 @@ describe LessonSession do end it "cancel in the past is OK" do - slot = FactoryGirl.build(:lesson_booking_slot_single, preferred_day: Date.today + 1) + slot = FactoryBot.build(:lesson_booking_slot_single, preferred_day: Date.today + 1) lesson = normal_lesson(user, teacher, {slots: [slot, slot2]}) Timecop.travel(Date.today + 2) @@ -408,8 +408,8 @@ describe LessonSession do it "cancels both recurring lessons" do now = Time.now - slotRecurring1 = FactoryGirl.build(:lesson_booking_slot_recurring, day_of_week: day_out(2)) - slotRecurring2 = FactoryGirl.build(:lesson_booking_slot_recurring, day_of_week: day_out(3)) + slotRecurring1 = FactoryBot.build(:lesson_booking_slot_recurring, day_of_week: day_out(2)) + slotRecurring2 = FactoryBot.build(:lesson_booking_slot_recurring, day_of_week: day_out(3)) lesson = monthly_lesson(user, teacher, {slots: [slotRecurring1, slotRecurring2], accept: true}) lesson.reload @@ -450,8 +450,8 @@ describe LessonSession do slight_future = 6.hours.from_now slight_future2 = 7.hours.from_now - slotRecurring1 = FactoryGirl.build(:lesson_booking_slot_recurring, day_of_week: slight_future.wday, hour: slight_future.hour) - slotRecurring2 = FactoryGirl.build(:lesson_booking_slot_recurring, day_of_week: slight_future2.wday, hour: slight_future2.hour) + slotRecurring1 = FactoryBot.build(:lesson_booking_slot_recurring, day_of_week: slight_future.wday, hour: slight_future.hour) + slotRecurring2 = FactoryBot.build(:lesson_booking_slot_recurring, day_of_week: slight_future2.wday, hour: slight_future2.hour) lesson = monthly_lesson(user, teacher, {slots: [slotRecurring1, slotRecurring2], accept: true}) lesson.reload @@ -489,10 +489,10 @@ describe LessonSession do it "student can join session" do lesson = normal_lesson(user, teacher) - FactoryGirl.create(:active_music_session, music_session: lesson.music_session, creator: teacher) + FactoryBot.create(:active_music_session, music_session: lesson.music_session, creator: teacher) - connection1 = FactoryGirl.create(:connection, user: user, music_session_id: lesson.music_session.active_music_session.id, as_musician: true) - connection2 = FactoryGirl.create(:connection, user: teacher, music_session_id: lesson.music_session.active_music_session.id, as_musician: true) + connection1 = FactoryBot.create(:connection, user: user, music_session_id: lesson.music_session.active_music_session.id, as_musician: true) + connection2 = FactoryBot.create(:connection, user: teacher, music_session_id: lesson.music_session.active_music_session.id, as_musician: true) connection1.can_join_music_session connection1.errors.any?.should be_false @@ -776,7 +776,7 @@ describe LessonSession do query.length.should eq 1 # make sure some random nobody can see this lesson session - query = LessonSession.index(FactoryGirl.create(:user))[:query] + query = LessonSession.index(FactoryBot.create(:user))[:query] query.length.should eq 0 end @@ -790,12 +790,12 @@ describe LessonSession do query.length.should eq 1 # make sure some random nobody can see this lesson session - query = LessonSession.index(FactoryGirl.create(:user), {as_teacher: true})[:query] + query = LessonSession.index(FactoryBot.create(:user), {as_teacher: true})[:query] query.length.should eq 0 end describe "schools" do - let (:school) { FactoryGirl.create(:school, scheduling_communication: School::SCHEDULING_COMM_SCHOOL) } + let (:school) { FactoryBot.create(:school, scheduling_communication: School::SCHEDULING_COMM_SCHOOL) } describe "owner" do it "works when not a teacher" do diff --git a/ruby/spec/jam_ruby/models/mix_spec.rb b/ruby/spec/jam_ruby/models/mix_spec.rb index 5989abb85..aca4ad006 100755 --- a/ruby/spec/jam_ruby/models/mix_spec.rb +++ b/ruby/spec/jam_ruby/models/mix_spec.rb @@ -3,11 +3,11 @@ require 'spec_helper' describe Mix do before do stub_const("APP_CONFIG", app_config) - @user = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @music_session = FactoryGirl.create(:active_music_session, :creator => @user, :musician_access => true) + @user = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @music_session = FactoryBot.create(:active_music_session, :creator => @user, :musician_access => true) # @music_session.connections << @connection @music_session.save @connection.join_the_session(@music_session, true, nil, @user, 10) @@ -53,7 +53,7 @@ describe Mix do @mix.reload @mix.errors.any?.should be_false - @user2 = FactoryGirl.create(:user) + @user2 = FactoryBot.create(:user) recordings = Recording.list_downloads(@user)["downloads"] recordings.length.should == 1 @@ -67,7 +67,7 @@ describe Mix do describe "download count" do it "will fail if too high" do - mix = FactoryGirl.create(:mix) + mix = FactoryBot.create(:mix) mix.current_user = mix.recording.owner mix.update_download_count(APP_CONFIG.max_audio_downloads + 1) mix.save diff --git a/ruby/spec/jam_ruby/models/mobile_recording_upload_spec.rb b/ruby/spec/jam_ruby/models/mobile_recording_upload_spec.rb index 621256f25..93483c274 100644 --- a/ruby/spec/jam_ruby/models/mobile_recording_upload_spec.rb +++ b/ruby/spec/jam_ruby/models/mobile_recording_upload_spec.rb @@ -26,7 +26,7 @@ describe MobileRecordingUpload do mru.size = File.size(MRU_TEMP_FILE) mr = MobileRecording.new - mr.user = FactoryGirl.create(:user) + mr.user = FactoryBot.create(:user) mr.save! mru.mobile_recording = mr diff --git a/ruby/spec/jam_ruby/models/music_notation_spec.rb b/ruby/spec/jam_ruby/models/music_notation_spec.rb index c1fb3e2e1..6f110be9d 100644 --- a/ruby/spec/jam_ruby/models/music_notation_spec.rb +++ b/ruby/spec/jam_ruby/models/music_notation_spec.rb @@ -23,7 +23,7 @@ describe MusicNotation do notation = MusicNotation.new notation.file_url = File.open(NOTATION_TEMP_FILE) notation.size = File.size(NOTATION_TEMP_FILE) - notation.user = FactoryGirl.create(:user) + notation.user = FactoryBot.create(:user) notation.save! File.basename(notation.file_url.path).should == notation.user.id diff --git a/ruby/spec/jam_ruby/models/music_session_perf_data_spec.rb b/ruby/spec/jam_ruby/models/music_session_perf_data_spec.rb index b39bf07a1..252a091ad 100644 --- a/ruby/spec/jam_ruby/models/music_session_perf_data_spec.rb +++ b/ruby/spec/jam_ruby/models/music_session_perf_data_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe MusicSessionPerfData do before do - #music_session = FactoryGirl.create(:active_music_session) - #connection = FactoryGirl.create(:connection, :music_session => music_session) + #music_session = FactoryBot.create(:active_music_session) + #connection = FactoryBot.create(:connection, :music_session => music_session) end it "create" do diff --git a/ruby/spec/jam_ruby/models/music_session_spec.rb b/ruby/spec/jam_ruby/models/music_session_spec.rb index 0eaabd080..8731dfcfb 100644 --- a/ruby/spec/jam_ruby/models/music_session_spec.rb +++ b/ruby/spec/jam_ruby/models/music_session_spec.rb @@ -3,28 +3,28 @@ require 'spec_helper' describe MusicSession do - let(:creator) {FactoryGirl.create(:user, last_jam_locidispid: 1)} - let(:some_user) { FactoryGirl.create(:user) } - let(:music_session1) { FactoryGirl.create(:music_session) } - let(:music_session2) { FactoryGirl.create(:music_session) } - let(:music_session3) { FactoryGirl.create(:music_session) } - let(:music_session4) { FactoryGirl.create(:music_session) } + let(:creator) {FactoryBot.create(:user, last_jam_locidispid: 1)} + let(:some_user) { FactoryBot.create(:user) } + let(:music_session1) { FactoryBot.create(:music_session) } + let(:music_session2) { FactoryBot.create(:music_session) } + let(:music_session3) { FactoryBot.create(:music_session) } + let(:music_session4) { FactoryBot.create(:music_session) } describe "validations" do it "genre must be set" do - music_session = FactoryGirl.build(:music_session) + music_session = FactoryBot.build(:music_session) music_session.genre = nil music_session.save.should be_false music_session.errors[:genre].should == ["can't be blank"] end it "updates the fields of a music session properly" do - genre1 = FactoryGirl.create(:genre) - genre2 = FactoryGirl.create(:genre) - genre3 = FactoryGirl.create(:genre) - genre4 = FactoryGirl.create(:genre) - creator = FactoryGirl.create(:user) - session = FactoryGirl.create(:music_session, :creator => creator, :description => "Session", :genre => genre3) + genre1 = FactoryBot.create(:genre) + genre2 = FactoryBot.create(:genre) + genre3 = FactoryBot.create(:genre) + genre4 = FactoryBot.create(:genre) + creator = FactoryBot.create(:user) + session = FactoryBot.create(:music_session, :creator => creator, :description => "Session", :genre => genre3) session.update_attributes({:description => "Session2", :genre => genre1}) session.reload session.description.should == "Session2" @@ -32,16 +32,16 @@ describe MusicSession do end it "must have legal_terms accepted" do - user1 = FactoryGirl.create(:user) - music_session = FactoryGirl.build(:music_session, :creator => user1, legal_terms: false) + user1 = FactoryBot.create(:user) + music_session = FactoryBot.build(:music_session, :creator => user1, legal_terms: false) music_session.save music_session.valid?.should be_false music_session.errors["legal_terms"].should == ["is not included in the list"] end it "cannot have profanity in the description" do - user1 = FactoryGirl.create(:user) - music_session = FactoryGirl.build(:music_session, :creator => user1, legal_terms: false, :description => "fuck you") + user1 = FactoryBot.create(:user) + music_session = FactoryBot.build(:music_session, :creator => user1, legal_terms: false, :description => "fuck you") music_session.save music_session.valid?.should be_false end @@ -103,20 +103,20 @@ describe MusicSession do describe "pretty_scheduled_start" do it "displays central time correctly" do time = MusicSession.parse_scheduled_start("Thu Jul 10 2014 10:00 PM", "Central Time (US & Canada),America/Chicago") - music_session = FactoryGirl.create(:music_session, scheduled_start: time, timezone: "Central Time (US & Canada),America/Chicago") + music_session = FactoryBot.create(:music_session, scheduled_start: time, timezone: "Central Time (US & Canada),America/Chicago") music_session.pretty_scheduled_start(true).should == 'Thursday, July 10, 10:00-11:00 PM US Central Time' music_session.pretty_scheduled_start(false).should == 'Thursday, July 10 - 11:00pm' end it "displays default correctly" do - music_session = FactoryGirl.create(:music_session, scheduled_start: nil) + music_session = FactoryBot.create(:music_session, scheduled_start: nil) music_session.pretty_scheduled_start(true).should == 'Date and time TBD' music_session.pretty_scheduled_start(false).should == 'Date and time TBD' end it "displays default correctly (shorter)" do time = MusicSession.parse_scheduled_start("Thu Jul 10 2014 10:00 PM", "Central Time (US & Canada),America/Chicago") - music_session = FactoryGirl.create(:music_session, scheduled_start: time, timezone: "Central Time (US & Canada),America/Chicago") + music_session = FactoryBot.create(:music_session, scheduled_start: time, timezone: "Central Time (US & Canada),America/Chicago") puts music_session.pretty_scheduled_start(true, true) puts music_session.pretty_scheduled_start(true, false) end @@ -124,17 +124,17 @@ describe MusicSession do describe "nindex" do it "nindex orders two sessions by created_at starting with most recent" do - creator = FactoryGirl.create(:user) - creator2 = FactoryGirl.create(:user) + creator = FactoryBot.create(:user) + creator2 = FactoryBot.create(:user) - earlier_session = FactoryGirl.create(:active_music_session, :creator => creator, :description => "Earlier Session") - c1 = FactoryGirl.create(:connection, user: creator, music_session: earlier_session, addr: 0x01020304, locidispid: 1) + earlier_session = FactoryBot.create(:active_music_session, :creator => creator, :description => "Earlier Session") + c1 = FactoryBot.create(:connection, user: creator, music_session: earlier_session, addr: 0x01020304, locidispid: 1) - later_session = FactoryGirl.create(:active_music_session, :creator => creator2, :description => "Later Session") - c2 = FactoryGirl.create(:connection, user: creator2, music_session: later_session, addr: 0x21020304, locidispid: 2) + later_session = FactoryBot.create(:active_music_session, :creator => creator2, :description => "Later Session") + c2 = FactoryBot.create(:connection, user: creator2, music_session: later_session, addr: 0x21020304, locidispid: 2) - user = FactoryGirl.create(:user) - c3 = FactoryGirl.create(:connection, user: user, locidispid: 3) + user = FactoryBot.create(:user) + c3 = FactoryBot.create(:connection, user: user, locidispid: 3) Score.createx(c1.locidispid, c1.client_id, c1.addr, c3.locidispid, c3.client_id, c3.addr, 20, nil); Score.createx(c2.locidispid, c2.client_id, c2.addr, c3.locidispid, c3.client_id, c3.addr, 30, nil); @@ -154,31 +154,31 @@ describe MusicSession do it 'uninvited users cant join approval-required sessions without invitation' do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1, :musician_access => true, :approval_required => true) + music_session = FactoryBot.create(:active_music_session, :creator => user1, :musician_access => true, :approval_required => true) - connection1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session) - expect { FactoryGirl.create(:connection, :user => user2, :music_session => music_session, :joining_session => true) }.to raise_error(ActiveRecord::RecordInvalid) + connection1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session) + expect { FactoryBot.create(:connection, :user => user2, :music_session => music_session, :joining_session => true) }.to raise_error(ActiveRecord::RecordInvalid) end it "is_recording? returns false if not recording" do - user1 = FactoryGirl.create(:user) - music_session = FactoryGirl.build(:active_music_session, :creator => user1) + user1 = FactoryBot.create(:user) + music_session = FactoryBot.build(:active_music_session, :creator => user1) music_session.is_recording?.should be_false end describe "recordings" do before(:each) do - @user1 = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user1) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @music_session = FactoryGirl.create(:active_music_session, :creator => @user1, :musician_access => true) + @user1 = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user1) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @music_session = FactoryBot.create(:active_music_session, :creator => @user1, :musician_access => true) # @music_session.connections << @connection @music_session.save! @connection.join_the_session(@music_session, true, nil, @user1, 10) @@ -192,7 +192,7 @@ describe MusicSession do describe "currently recording" do before(:each) do - @recording = FactoryGirl.create(:recording, :music_session => @music_session, :owner => @user1) + @recording = FactoryBot.create(:recording, :music_session => @music_session, :owner => @user1) end it "is_recording? returns true if recording" do @@ -234,7 +234,7 @@ describe MusicSession do end it "disallow a claimed recording to be started when already started by someone else" do - @user2 = FactoryGirl.create(:user) + @user2 = FactoryBot.create(:user) @music_session.claimed_recording_start(@user1, @claimed_recording) @music_session.errors.any?.should be_false @music_session.claimed_recording_start(@user2, @claimed_recording) @@ -243,7 +243,7 @@ describe MusicSession do end it "allow a claimed recording to be started when already started by self" do - @user2 = FactoryGirl.create(:user) + @user2 = FactoryBot.create(:user) @claimed_recording2 = @recording.claim(@user1, "name", "description", Genre.first, true) @music_session.claimed_recording_start(@user1, @claimed_recording) @music_session.errors.any?.should be_false @@ -255,11 +255,11 @@ describe MusicSession do describe "get_connection_ids" do before(:each) do - @user1 = FactoryGirl.create(:user) - @user2 = FactoryGirl.create(:user) - @music_session = FactoryGirl.create(:active_music_session, :creator => @user1, :musician_access => true) - @connection1 = FactoryGirl.create(:connection, :user => @user1, :music_session => @music_session, :as_musician => true) - @connection2 = FactoryGirl.create(:connection, :user => @user2, :music_session => @music_session, :as_musician => false) + @user1 = FactoryBot.create(:user) + @user2 = FactoryBot.create(:user) + @music_session = FactoryBot.create(:active_music_session, :creator => @user1, :musician_access => true) + @connection1 = FactoryBot.create(:connection, :user => @user1, :music_session => @music_session, :as_musician => true) + @connection2 = FactoryBot.create(:connection, :user => @user2, :music_session => @music_session, :as_musician => false) end @@ -319,7 +319,7 @@ describe MusicSession do it "handles 2 instruments for a single request correctly" do - rsvp_request = FactoryGirl.create(:rsvp_request_for_multiple_slots, user: some_user, music_session: music_session1, number: 2, chosen:true) + rsvp_request = FactoryBot.create(:rsvp_request_for_multiple_slots, user: some_user, music_session: music_session1, number: 2, chosen:true) approved_rsvps = music_session1.approved_rsvps approved_rsvps.length.should == 2 @@ -371,7 +371,7 @@ describe MusicSession do describe "scheduled" do it "includes any RSVP'ed" do - rsvp_request = FactoryGirl.create(:rsvp_request_for_multiple_slots, user: some_user, music_session: music_session1, number: 2, chosen:true) + rsvp_request = FactoryBot.create(:rsvp_request_for_multiple_slots, user: some_user, music_session: music_session1, number: 2, chosen:true) approved_rsvps = music_session1.approved_rsvps approved_rsvps.length.should == 2 @@ -390,17 +390,17 @@ describe MusicSession do end it "includes invited" do - invitee = FactoryGirl.create(:user, last_jam_audio_latency: 30, last_jam_locidispid: 3) - FactoryGirl.create(:friendship, user: creator, friend: invitee) - FactoryGirl.create(:friendship, user: invitee, friend: creator) - music_session = FactoryGirl.create(:music_session, creator: creator) - FactoryGirl.create(:invitation, receiver:invitee, sender:creator, music_session: music_session) + invitee = FactoryBot.create(:user, last_jam_audio_latency: 30, last_jam_locidispid: 3) + FactoryBot.create(:friendship, user: creator, friend: invitee) + FactoryBot.create(:friendship, user: invitee, friend: creator) + music_session = FactoryBot.create(:music_session, creator: creator) + FactoryBot.create(:invitation, receiver:invitee, sender:creator, music_session: music_session) sessions = MusicSession.scheduled(invitee) sessions.length.should == 1 end it "excludes based on time-range" do - session = FactoryGirl.create(:music_session, scheduled_start: Time.now) + session = FactoryBot.create(:music_session, scheduled_start: Time.now) MusicSession.count.should eq(1) @@ -437,7 +437,7 @@ describe MusicSession do end it "excludes canceled" do - session = FactoryGirl.create(:music_session, scheduled_start: Time.now) + session = FactoryBot.create(:music_session, scheduled_start: Time.now) sessions = MusicSession.scheduled(session.creator) sessions.length.should == 1 @@ -472,9 +472,9 @@ describe MusicSession do end describe "session_with_scores", no_transaction: true do - let(:conn) { FactoryGirl.create(:connection, user: creator, locidispid: creator.last_jam_locidispid) } - let(:searcher) { FactoryGirl.create(:user, last_jam_locidispid: 2) } - let(:searcher_conn) { FactoryGirl.create(:connection, user: searcher, ip_address: '2.2.2.2', locidispid: searcher.last_jam_locidispid) } + let(:conn) { FactoryBot.create(:connection, user: creator, locidispid: creator.last_jam_locidispid) } + let(:searcher) { FactoryBot.create(:user, last_jam_locidispid: 2) } + let(:searcher_conn) { FactoryBot.create(:connection, user: searcher, ip_address: '2.2.2.2', locidispid: searcher.last_jam_locidispid) } let(:default_opts) { {client_id: searcher_conn.client_id} } let(:network_score) { 20 } @@ -487,7 +487,7 @@ describe MusicSession do end it "one session with scores" do - session = FactoryGirl.create(:music_session, creator: creator) + session = FactoryBot.create(:music_session, creator: creator) music_session, user_scores = session_with_scores(searcher, session.id) music_session.latency.should be_nil # we don't return music_session.latency with session_with_scores, because it's used for sorting among many sessions user_scores.length.should == 1 @@ -497,9 +497,9 @@ describe MusicSession do describe "sms_index_2" do describe "simple" do - let(:conn) { FactoryGirl.create(:connection, user: creator, locidispid: creator.last_jam_locidispid) } - let(:searcher) { FactoryGirl.create(:user, last_jam_locidispid: 2) } - let(:searcher_conn) { FactoryGirl.create(:connection, user: searcher, ip_address: '2.2.2.2', locidispid: searcher.last_jam_locidispid) } + let(:conn) { FactoryBot.create(:connection, user: creator, locidispid: creator.last_jam_locidispid) } + let(:searcher) { FactoryBot.create(:user, last_jam_locidispid: 2) } + let(:searcher_conn) { FactoryBot.create(:connection, user: searcher, ip_address: '2.2.2.2', locidispid: searcher.last_jam_locidispid) } let(:default_opts) { {client_id: searcher_conn.client_id} } let(:network_score) { 20 } @@ -509,7 +509,7 @@ describe MusicSession do it "one session shows/hides based on open_rsvps" do - music_session = FactoryGirl.create(:music_session, creator: creator, scheduled_start: nil) + music_session = FactoryBot.create(:music_session, creator: creator, scheduled_start: nil) music_sessions = MusicSession.scheduled_index(searcher, {}) music_sessions.length.should == 1 @@ -521,7 +521,7 @@ describe MusicSession do it "one session, one RSVP (creator)" do - music_session = FactoryGirl.create(:music_session, creator: creator) + music_session = FactoryBot.create(:music_session, creator: creator) music_sessions = MusicSession.scheduled_index(searcher, {}) music_sessions.length.should == 1 end @@ -530,8 +530,8 @@ describe MusicSession do interval = MusicSession::UNSTARTED_INTERVAL_DAYS_SKIP dd = Time.now - (interval.to_i + 1).days Timecop.travel(dd) - msess1 = FactoryGirl.create(:music_session, creator: creator, scheduled_start: dd) - msess2 = FactoryGirl.create(:music_session, creator: creator) + msess1 = FactoryBot.create(:music_session, creator: creator, scheduled_start: dd) + msess2 = FactoryBot.create(:music_session, creator: creator) music_sessions = MusicSession.scheduled_index(searcher, {}) music_sessions.length.should == 1 expect(music_sessions[0].id).to eq(msess2.id) @@ -539,7 +539,7 @@ describe MusicSession do it "filters sessions in the past" do - music_session = FactoryGirl.create(:music_session, creator: creator) + music_session = FactoryBot.create(:music_session, creator: creator) music_sessions = MusicSession.scheduled_index(searcher, {}) music_sessions.length.should == 1 @@ -560,29 +560,29 @@ describe MusicSession do it "one session, one RSVP (creator), one invitation" do # create an invitee, and friend them with the creator (you have to be friends to send an invite) - invitee = FactoryGirl.create(:user) - FactoryGirl.create(:friendship, user: creator, friend: invitee) - FactoryGirl.create(:friendship, user: invitee, friend: creator) - music_session = FactoryGirl.create(:music_session, creator: creator) - FactoryGirl.create(:invitation, receiver:invitee, sender:creator, music_session: music_session) + invitee = FactoryBot.create(:user) + FactoryBot.create(:friendship, user: creator, friend: invitee) + FactoryBot.create(:friendship, user: invitee, friend: creator) + music_session = FactoryBot.create(:music_session, creator: creator) + FactoryBot.create(:invitation, receiver:invitee, sender:creator, music_session: music_session) music_sessions = MusicSession.scheduled_index(searcher, default_opts) music_sessions.length.should == 1 #search with the invitee this time. - invitee_conn = FactoryGirl.create(:connection, user: invitee) + invitee_conn = FactoryBot.create(:connection, user: invitee) music_sessions = MusicSession.scheduled_index(invitee, {}) music_sessions.length.should == 1 end it "does not show when it goes active" do # we create a scheduled session--it should return - music_session = FactoryGirl.create(:music_session, creator: creator, scheduled_start: nil) + music_session = FactoryBot.create(:music_session, creator: creator, scheduled_start: nil) music_sessions = MusicSession.scheduled_index(searcher, {}) music_sessions.length.should == 1 # but then make an active session for this scheduled session - ams = FactoryGirl.create(:active_music_session, music_session: music_session, creator: creator, musician_access: true) + ams = FactoryBot.create(:active_music_session, music_session: music_session, creator: creator, musician_access: true) music_sessions = MusicSession.scheduled_index(searcher, {}) music_sessions.length.should == 0 @@ -597,9 +597,9 @@ describe MusicSession do describe "sms_index", no_transaction: true do describe "simple" do - let(:conn) { FactoryGirl.create(:connection, user: creator, locidispid: creator.last_jam_locidispid) } - let(:searcher) { FactoryGirl.create(:user, last_jam_locidispid: 2) } - let(:searcher_conn) { FactoryGirl.create(:connection, user: searcher, ip_address: '2.2.2.2', locidispid: searcher.last_jam_locidispid) } + let(:conn) { FactoryBot.create(:connection, user: creator, locidispid: creator.last_jam_locidispid) } + let(:searcher) { FactoryBot.create(:user, last_jam_locidispid: 2) } + let(:searcher_conn) { FactoryBot.create(:connection, user: searcher, ip_address: '2.2.2.2', locidispid: searcher.last_jam_locidispid) } let(:default_opts) { {client_id: searcher_conn.client_id} } let(:network_score) { 20 } @@ -616,7 +616,7 @@ describe MusicSession do creator.last_jam_locidispid = conn.locidispid creator.save! - music_session = FactoryGirl.create(:music_session, creator: creator, scheduled_start: nil) + music_session = FactoryBot.create(:music_session, creator: creator, scheduled_start: nil) music_sessions, user_scores = sms(searcher, default_opts, 1) music_session.open_rsvps = false @@ -628,7 +628,7 @@ describe MusicSession do creator.last_jam_locidispid = conn.locidispid creator.save! - music_session = FactoryGirl.create(:music_session, creator: creator, scheduled_start: nil) + music_session = FactoryBot.create(:music_session, creator: creator, scheduled_start: nil) music_sessions, user_scores = sms(searcher, default_opts, 1) end @@ -637,7 +637,7 @@ describe MusicSession do creator.last_jam_locidispid = conn.locidispid creator.save! - music_session = FactoryGirl.create(:music_session, creator: creator) + music_session = FactoryBot.create(:music_session, creator: creator) music_sessions, user_scores = sms(searcher, default_opts, 1, 1) music_sessions[0].tag.should == 3 # open session sort music_sessions[0].latency.should == (network_score + searcher.last_jam_audio_latency + creator.last_jam_audio_latency ) @@ -648,15 +648,15 @@ describe MusicSession do interval = MusicSession::UNSTARTED_INTERVAL_DAYS_SKIP dd = Time.now - (interval.to_i + 1).days Timecop.travel(dd) - msess1 = FactoryGirl.create(:music_session, creator: creator, scheduled_start: dd) - msess2 = FactoryGirl.create(:music_session, creator: creator) + msess1 = FactoryBot.create(:music_session, creator: creator, scheduled_start: dd) + msess2 = FactoryBot.create(:music_session, creator: creator) music_sessions, user_scores = sms(searcher, default_opts, 1) expect(music_sessions[0].id).to eq(msess2.id) end it "filters sessions in the past" do - music_session = FactoryGirl.create(:music_session, creator: creator) + music_session = FactoryBot.create(:music_session, creator: creator) ActiveRecord::Base.transaction do music_sessions, user_scores = sms(searcher, default_opts, 1) end @@ -676,11 +676,11 @@ describe MusicSession do it "one session, one RSVP (creator), one invitation" do # create an invitee, and friend them with the creator (you have to be friends to send an invite) - invitee = FactoryGirl.create(:user, last_jam_audio_latency: 30, last_jam_locidispid: 3) - FactoryGirl.create(:friendship, user: creator, friend: invitee) - FactoryGirl.create(:friendship, user: invitee, friend: creator) - music_session = FactoryGirl.create(:music_session, creator: creator) - FactoryGirl.create(:invitation, receiver:invitee, sender:creator, music_session: music_session) + invitee = FactoryBot.create(:user, last_jam_audio_latency: 30, last_jam_locidispid: 3) + FactoryBot.create(:friendship, user: creator, friend: invitee) + FactoryBot.create(:friendship, user: invitee, friend: creator) + music_session = FactoryBot.create(:music_session, creator: creator) + FactoryBot.create(:invitation, receiver:invitee, sender:creator, music_session: music_session) # create a score between creator, searcher Score.createx(creator.last_jam_locidispid, conn.client_id, conn.addr, searcher.last_jam_locidispid, searcher_conn.client_id, searcher_conn.addr, network_score, nil, nil, {auserid: creator.id, buserid: searcher.id}) @@ -695,7 +695,7 @@ describe MusicSession do user_scores[creator.id][:full_score].should == (network_score + searcher.last_jam_audio_latency + creator.last_jam_audio_latency ) #search with the invitee this time. - invitee_conn = FactoryGirl.create(:connection, user: invitee, ip_address: '3.3.3.3', locidispid: invitee.last_jam_locidispid) + invitee_conn = FactoryBot.create(:connection, user: invitee, ip_address: '3.3.3.3', locidispid: invitee.last_jam_locidispid) music_sessions, user_scores = sms(invitee, {client_id: invitee_conn.client_id}, 1, 1) music_sessions[0].tag.should == 2 # invited sort music_sessions[0].latency.should == ((network_score + invitee.last_jam_audio_latency + creator.last_jam_audio_latency )).ceil @@ -704,11 +704,11 @@ describe MusicSession do it "does not show when it goes active" do # we create a scheduled session--it should return - music_session = FactoryGirl.create(:music_session, creator: creator, scheduled_start: nil) + music_session = FactoryBot.create(:music_session, creator: creator, scheduled_start: nil) music_sessions, user_scores = sms(searcher, default_opts, 1) # but then make an active session for this scheduled session - ams = FactoryGirl.create(:active_music_session, music_session: music_session, creator: creator, musician_access: true) + ams = FactoryBot.create(:active_music_session, music_session: music_session, creator: creator, musician_access: true) music_sessions, user_scores = sms(searcher, default_opts, 0) # finally, delete the active session, and see results go back to one @@ -726,7 +726,7 @@ describe MusicSession do before(:each) do creator.last_jam_locidispid = conn.locidispid creator.save! - FactoryGirl.create(:music_session, creator: creator, scheduled_start: nil, description: 'chunky icecream for the fools') + FactoryBot.create(:music_session, creator: creator, scheduled_start: nil, description: 'chunky icecream for the fools') end it "handles single keyword" do @@ -751,20 +751,20 @@ describe MusicSession do describe "sorting" do - let!(:creator_1) { FactoryGirl.create(:user, last_jam_locidispid: 4, last_jam_audio_latency: 8) } - let!(:creator_conn_1) { FactoryGirl.create(:connection, user: creator_1, ip_address: '4.4.4.4', locidispid: 4, addr:4) } - let!(:creator_2) { FactoryGirl.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 10) } - let!(:creator_conn_2) { FactoryGirl.create(:connection, user: creator_2, ip_address: '4.4.4.4', locidispid: 1, addr:1) } - let!(:creator_3) { FactoryGirl.create(:user, last_jam_locidispid: 2, last_jam_audio_latency: 12) } - let!(:creator_conn_3) { FactoryGirl.create(:connection, user: creator_3, ip_address: '5.5.5.5', locidispid: 2, addr:2) } - let!(:searcher_1) { FactoryGirl.create(:user, last_jam_locidispid: 5, last_jam_audio_latency: 6) } - let!(:searcher_conn_1) { FactoryGirl.create(:connection, user: searcher_1, ip_address: '8.8.8.8', locidispid: 5, addr:5) } - let!(:searcher_2) { FactoryGirl.create(:user, last_jam_locidispid: 3, last_jam_audio_latency: 14) } - let!(:searcher_conn_2) { FactoryGirl.create(:connection, user: searcher_2, ip_address: '9.9.9.9', locidispid: 3, addr:3) } + let!(:creator_1) { FactoryBot.create(:user, last_jam_locidispid: 4, last_jam_audio_latency: 8) } + let!(:creator_conn_1) { FactoryBot.create(:connection, user: creator_1, ip_address: '4.4.4.4', locidispid: 4, addr:4) } + let!(:creator_2) { FactoryBot.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 10) } + let!(:creator_conn_2) { FactoryBot.create(:connection, user: creator_2, ip_address: '4.4.4.4', locidispid: 1, addr:1) } + let!(:creator_3) { FactoryBot.create(:user, last_jam_locidispid: 2, last_jam_audio_latency: 12) } + let!(:creator_conn_3) { FactoryBot.create(:connection, user: creator_3, ip_address: '5.5.5.5', locidispid: 2, addr:2) } + let!(:searcher_1) { FactoryBot.create(:user, last_jam_locidispid: 5, last_jam_audio_latency: 6) } + let!(:searcher_conn_1) { FactoryBot.create(:connection, user: searcher_1, ip_address: '8.8.8.8', locidispid: 5, addr:5) } + let!(:searcher_2) { FactoryBot.create(:user, last_jam_locidispid: 3, last_jam_audio_latency: 14) } + let!(:searcher_conn_2) { FactoryBot.create(:connection, user: searcher_2, ip_address: '9.9.9.9', locidispid: 3, addr:3) } - let!(:music_session_1) { FactoryGirl.create(:music_session, creator: creator_1, genre: Genre.find('african'), language: 'eng', description: "Bunny Jumps") } - let!(:music_session_2) { FactoryGirl.create(:music_session, creator: creator_2, genre: Genre.find('ambient'), language: 'spa', description: "Play with us as we jam to beatles and bunnies") } - let!(:music_session_3) { FactoryGirl.create(:music_session, creator: creator_3) } + let!(:music_session_1) { FactoryBot.create(:music_session, creator: creator_1, genre: Genre.find('african'), language: 'eng', description: "Bunny Jumps") } + let!(:music_session_2) { FactoryBot.create(:music_session, creator: creator_2, genre: Genre.find('ambient'), language: 'spa', description: "Play with us as we jam to beatles and bunnies") } + let!(:music_session_3) { FactoryBot.create(:music_session, creator: creator_3) } let(:good_network_score) { 20 } let(:fair_network_score) { 30 } @@ -775,14 +775,14 @@ describe MusicSession do pending "Test with MusicSession.scheduled_index instsead" # add an RSVP for searcher_1 to music_session_1 - searcher_rsvp_slot = FactoryGirl.create(:rsvp_slot, music_session: music_session_1, instrument: Instrument.find('piano')) - searcher_rsvp_request = FactoryGirl.create(:rsvp_request, user: searcher_1) - searcher_rsvp_request_rsvp_slot = FactoryGirl.create(:rsvp_request_rsvp_slot, chosen:true, rsvp_request: searcher_rsvp_request, rsvp_slot: searcher_rsvp_slot) + searcher_rsvp_slot = FactoryBot.create(:rsvp_slot, music_session: music_session_1, instrument: Instrument.find('piano')) + searcher_rsvp_request = FactoryBot.create(:rsvp_request, user: searcher_1) + searcher_rsvp_request_rsvp_slot = FactoryBot.create(:rsvp_request_rsvp_slot, chosen:true, rsvp_request: searcher_rsvp_request, rsvp_slot: searcher_rsvp_slot) # add an invitation to searcher_1 to music_session_2 - FactoryGirl.create(:friendship, user: creator_2, friend: searcher_1) - FactoryGirl.create(:friendship, user: searcher_1, friend: creator_2) - FactoryGirl.create(:invitation, receiver:searcher_1, sender:creator_2, music_session: music_session_2) + FactoryBot.create(:friendship, user: creator_2, friend: searcher_1) + FactoryBot.create(:friendship, user: searcher_1, friend: creator_2) + FactoryBot.create(:invitation, receiver:searcher_1, sender:creator_2, music_session: music_session_2) end @@ -835,19 +835,19 @@ describe MusicSession do end describe "parameters" do - let(:creator_1) { FactoryGirl.create(:user, last_jam_locidispid: 4, last_jam_audio_latency: 8) } - let(:creator_conn_1) { FactoryGirl.create(:connection, user: creator_1, ip_address: '4.4.4.4', locidispid: 4, addr:4) } - let(:creator_2) { FactoryGirl.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 10) } - let(:creator_conn_2) { FactoryGirl.create(:connection, user: creator_2, ip_address: '4.4.4.4', locidispid: 1, addr:1) } - let(:creator_3) { FactoryGirl.create(:user, last_jam_locidispid: 2, last_jam_audio_latency: 12) } - let(:creator_conn_3) { FactoryGirl.create(:connection, user: creator_3, ip_address: '5.5.5.5', locidispid: 2, addr:2) } - let(:searcher_1) { FactoryGirl.create(:user, last_jam_locidispid: 5, last_jam_audio_latency: 6) } - let(:searcher_conn_1) { FactoryGirl.create(:connection, user: searcher_1, ip_address: '8.8.8.8', locidispid: 5, addr:5) } - let(:searcher_2) { FactoryGirl.create(:user, last_jam_locidispid: 3, last_jam_audio_latency: 14) } - let(:searcher_conn_2) { FactoryGirl.create(:connection, user: searcher_2, ip_address: '9.9.9.9', locidispid: 3, addr:3) } + let(:creator_1) { FactoryBot.create(:user, last_jam_locidispid: 4, last_jam_audio_latency: 8) } + let(:creator_conn_1) { FactoryBot.create(:connection, user: creator_1, ip_address: '4.4.4.4', locidispid: 4, addr:4) } + let(:creator_2) { FactoryBot.create(:user, last_jam_locidispid: 1, last_jam_audio_latency: 10) } + let(:creator_conn_2) { FactoryBot.create(:connection, user: creator_2, ip_address: '4.4.4.4', locidispid: 1, addr:1) } + let(:creator_3) { FactoryBot.create(:user, last_jam_locidispid: 2, last_jam_audio_latency: 12) } + let(:creator_conn_3) { FactoryBot.create(:connection, user: creator_3, ip_address: '5.5.5.5', locidispid: 2, addr:2) } + let(:searcher_1) { FactoryBot.create(:user, last_jam_locidispid: 5, last_jam_audio_latency: 6) } + let(:searcher_conn_1) { FactoryBot.create(:connection, user: searcher_1, ip_address: '8.8.8.8', locidispid: 5, addr:5) } + let(:searcher_2) { FactoryBot.create(:user, last_jam_locidispid: 3, last_jam_audio_latency: 14) } + let(:searcher_conn_2) { FactoryBot.create(:connection, user: searcher_2, ip_address: '9.9.9.9', locidispid: 3, addr:3) } - let!(:music_session_1) { FactoryGirl.create(:music_session, :creator => creator_1, genre: Genre.find('african'), language: 'eng', description: "Bunny Jumps" ) } - let!(:music_session_2) { FactoryGirl.create(:music_session, :creator => creator_2, genre: Genre.find('ambient'), language: 'spa', description: "Play with us as we jam to beatles and bunnies") } + let!(:music_session_1) { FactoryBot.create(:music_session, :creator => creator_1, genre: Genre.find('african'), language: 'eng', description: "Bunny Jumps" ) } + let!(:music_session_2) { FactoryBot.create(:music_session, :creator => creator_2, genre: Genre.find('ambient'), language: 'spa', description: "Play with us as we jam to beatles and bunnies") } let(:good_network_score) { 20 } let(:fair_network_score) { 30 } @@ -938,9 +938,9 @@ describe MusicSession do describe "scheduled_rsvp" do - let(:creator_1) { FactoryGirl.create(:user) } - let!(:music_session_1) { FactoryGirl.create(:music_session, :creator => creator_1, description: "Bunny Jumps", :create_type => MusicSession::CREATE_TYPE_IMMEDIATE ) } - let!(:music_session_2) { FactoryGirl.create(:music_session, :creator => FactoryGirl.create(:user), description: "Bunny Jumps", :create_type => MusicSession::CREATE_TYPE_IMMEDIATE ) } + let(:creator_1) { FactoryBot.create(:user) } + let!(:music_session_1) { FactoryBot.create(:music_session, :creator => creator_1, description: "Bunny Jumps", :create_type => MusicSession::CREATE_TYPE_IMMEDIATE ) } + let!(:music_session_2) { FactoryBot.create(:music_session, :creator => FactoryBot.create(:user), description: "Bunny Jumps", :create_type => MusicSession::CREATE_TYPE_IMMEDIATE ) } before(:each) { music_session_2.touch @@ -1009,10 +1009,10 @@ describe MusicSession do it 'selects unscheduled sessions past due date' do interval = MusicSession::UNSTARTED_INTERVAL_DAYS_PURGE - msess1 = FactoryGirl.create(:music_session) + msess1 = FactoryBot.create(:music_session) dd = Time.now - (interval.to_i + 1).days Timecop.travel(dd) - msess2 = FactoryGirl.create(:music_session) + msess2 = FactoryBot.create(:music_session) purging = MusicSession.purgeable_sessions expect(purging.size).to be(1) expect(purging[0].id).to eq(msess2.id) @@ -1022,10 +1022,10 @@ describe MusicSession do [MusicSession::UNSTARTED_INTERVAL_DAYS_PURGE, MusicSession::UNSTARTED_INTERVAL_DAYS_PURGE_RECUR].each do |interval| Timecop.return - msess1 = FactoryGirl.create(:music_session, scheduled_start: Time.now) + msess1 = FactoryBot.create(:music_session, scheduled_start: Time.now) dd = Time.now - (interval.to_i + 1).days Timecop.travel(dd) - msess2 = FactoryGirl.create(:music_session, scheduled_start: Time.now) + msess2 = FactoryBot.create(:music_session, scheduled_start: Time.now) purging = MusicSession.purgeable_sessions expect(purging.size).to be(1) expect(purging[0].id).to eq(msess2.id) diff --git a/ruby/spec/jam_ruby/models/music_sessions_user_history_spec.rb b/ruby/spec/jam_ruby/models/music_sessions_user_history_spec.rb index 0ec167c4d..d7c12bf85 100644 --- a/ruby/spec/jam_ruby/models/music_sessions_user_history_spec.rb +++ b/ruby/spec/jam_ruby/models/music_sessions_user_history_spec.rb @@ -2,11 +2,11 @@ require 'spec_helper' describe MusicSessionUserHistory do - let(:some_user) { FactoryGirl.create(:user) } - let(:some_other_user) { FactoryGirl.create(:user) } - let(:music_session) { FactoryGirl.create(:active_music_session_no_user_history) } - let(:user_history1) { FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => music_session.creator) } - let(:user_history2) { FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => some_user) } + let(:some_user) { FactoryBot.create(:user) } + let(:some_other_user) { FactoryBot.create(:user) } + let(:music_session) { FactoryBot.create(:active_music_session_no_user_history) } + let(:user_history1) { FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => music_session.creator) } + let(:user_history2) { FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => some_user) } after { @@ -147,7 +147,7 @@ describe MusicSessionUserHistory do end it "two histories with same user within bounds of history1" do - user_history3 = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => some_user) + user_history3 = FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => some_user) # if user2 comes and goes 2 times while user one is there, it shouldn't be a false 3 user_history1.session_removed_at = user_history1.created_at + 5 @@ -166,9 +166,9 @@ describe MusicSessionUserHistory do end it "two histories with different user within bounds of history1" do - third_user = FactoryGirl.create(:user); + third_user = FactoryBot.create(:user); - user_history3 = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => third_user) + user_history3 = FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => third_user) # if user2 comes and goes 2 times while user one is there, it shouldn't be a false 3 user_history1.session_removed_at = user_history1.created_at + 5 @@ -187,9 +187,9 @@ describe MusicSessionUserHistory do end it "two overlapping histories with different user within bounds of history1" do - third_user = FactoryGirl.create(:user); + third_user = FactoryBot.create(:user); - user_history3 = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => third_user) + user_history3 = FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => third_user) # if user2 comes and goes 2 times while user one is there, it shouldn't be a false 3 user_history1.session_removed_at = user_history1.created_at + 5 @@ -309,7 +309,7 @@ describe MusicSessionUserHistory do it "same user in same session does not rack up time" do - same_user_history = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => music_session.creator) + same_user_history = FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => music_session.creator) user_history1.session_removed_at = user_history1.created_at + 3*60 same_user_history.created_at = user_history1.created_at + 1*60 @@ -327,7 +327,7 @@ describe MusicSessionUserHistory do user_history1.session_removed_at = user_history1.created_at + 3*60 user_history2.created_at = user_history1.created_at + 1*60 user_history2.session_removed_at = user_history1.created_at + 4*60 - user_history3 = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => some_other_user) + user_history3 = FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => some_other_user) user_history3.created_at = user_history1.created_at + 1*60 user_history3.session_removed_at = user_history1.created_at + 4*60 @@ -344,7 +344,7 @@ describe MusicSessionUserHistory do user_history1.session_removed_at = user_history1.created_at + 7*60 user_history2.created_at = user_history1.created_at + 1*60 user_history2.session_removed_at = user_history1.created_at + 3*60 - user_history3 = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => some_other_user) + user_history3 = FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => some_other_user) user_history3.created_at = user_history1.created_at + 2*60 user_history3.session_removed_at = user_history1.created_at + 4*60 @@ -389,8 +389,8 @@ describe MusicSessionUserHistory do # COME BACK INTO SAME SESSION LATER - user_history1_returns = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => music_session.creator) - user_history2_returns = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => some_user) + user_history1_returns = FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => music_session.creator) + user_history2_returns = FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => some_user) user_history1_returns.created_at = user_history1.created_at + 8*60 user_history1_returns.session_removed_at = user_history1.created_at + 16*60 @@ -410,8 +410,8 @@ describe MusicSessionUserHistory do # AND COME BACK ONCE MORE - user_history1_returns2 = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => music_session.creator) - user_history2_returns2 = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => some_user) + user_history1_returns2 = FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => music_session.creator) + user_history2_returns2 = FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => some_user) user_history1_returns2.created_at = user_history1.created_at + 20*60 user_history1_returns2.session_removed_at = user_history1.created_at + 25*60 @@ -434,7 +434,7 @@ describe MusicSessionUserHistory do user_history1.session_removed_at = user_history1.created_at + 7*60 user_history2.created_at = user_history1.created_at + 1*60 user_history2.session_removed_at = nil - user_history3 = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => some_other_user) + user_history3 = FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => some_other_user) user_history3.created_at = user_history1.created_at + 2*60 user_history3.session_removed_at = nil diff --git a/ruby/spec/jam_ruby/models/musician_search_spec.rb b/ruby/spec/jam_ruby/models/musician_search_spec.rb index 5241e1578..f8c09fae4 100644 --- a/ruby/spec/jam_ruby/models/musician_search_spec.rb +++ b/ruby/spec/jam_ruby/models/musician_search_spec.rb @@ -7,13 +7,13 @@ require 'time_difference' describe 'Musician Search Model' do - let!(:searcher) { FactoryGirl.create(:austin_user) } + let!(:searcher) { FactoryBot.create(:austin_user) } let!(:search) { MusicianSearch.create_search(searcher) } - let!(:austin_user) { FactoryGirl.create(:austin_user) } - let!(:dallas_user) { FactoryGirl.create(:dallas_user) } - let!(:miami_user) { FactoryGirl.create(:miami_user) } - let!(:seattle_user) { FactoryGirl.create(:seattle_user) } + let!(:austin_user) { FactoryBot.create(:austin_user) } + let!(:dallas_user) { FactoryBot.create(:dallas_user) } + let!(:miami_user) { FactoryBot.create(:miami_user) } + let!(:seattle_user) { FactoryBot.create(:seattle_user) } let!(:user_types) { [:austin_user, :dallas_user, :miami_user, :seattle_user] } @@ -50,10 +50,10 @@ describe 'Musician Search Model' do today = Date.today MusicianSearch::AGE_COUNTS.each_with_index do |age, idx| dd = today - age.years - 1.day - @users << FactoryGirl.create(:austin_user, :birth_date => dd) - @users << FactoryGirl.create(:dallas_user, :birth_date => dd) - @users << FactoryGirl.create(:miami_user, :birth_date => dd) - @users << FactoryGirl.create(:seattle_user, :birth_date => dd) + @users << FactoryBot.create(:austin_user, :birth_date => dd) + @users << FactoryBot.create(:dallas_user, :birth_date => dd) + @users << FactoryBot.create(:miami_user, :birth_date => dd) + @users << FactoryBot.create(:seattle_user, :birth_date => dd) end end @@ -89,7 +89,7 @@ describe 'Musician Search Model' do describe "filtering by gig" do before(:all) do user_types.each do |utype| - FactoryGirl.create(utype, :concert_count => MusicianSearch::GIG_COUNTS[1]) + FactoryBot.create(utype, :concert_count => MusicianSearch::GIG_COUNTS[1]) end end @@ -107,7 +107,7 @@ describe 'Musician Search Model' do describe "filtering by studio" do before(:all) do user_types.each do |utype| - FactoryGirl.create(utype, :studio_session_count => MusicianSearch::STUDIO_COUNTS[1]) + FactoryBot.create(utype, :studio_session_count => MusicianSearch::STUDIO_COUNTS[1]) end end @@ -125,7 +125,7 @@ describe 'Musician Search Model' do describe "filters skills" do before(:all) do MusicianSearch::SKILL_VALS.each do |val| - user_types.each { |utype| FactoryGirl.create(utype, :skill_level => val) } + user_types.each { |utype| FactoryBot.create(utype, :skill_level => val) } end end @@ -142,7 +142,7 @@ describe 'Musician Search Model' do it "get expected number per interest" do MusicianSearch::INTEREST_VALS[1..-1].each do |val| - user_types.each { |utype| FactoryGirl.create(utype, val => true, :paid_sessions_hourly_rate=>2300, :paid_sessions_daily_rate=>15000) } + user_types.each { |utype| FactoryBot.create(utype, val => true, :paid_sessions_hourly_rate=>2300, :paid_sessions_daily_rate=>15000) } end search.update_json_value(MusicianSearch::KEY_INTERESTS, MusicianSearch::INTEREST_VALS[1]) expect(search.do_search.count).to eq(user_types.count) @@ -152,7 +152,7 @@ describe 'Musician Search Model' do describe "filters genres" do before(:all) do user_types.each do |utype| - uu = FactoryGirl.create(utype) + uu = FactoryBot.create(utype) uu.update_genres([Genre.first.id, Genre.last.id], GenrePlayer::PROFILE) end end @@ -169,7 +169,7 @@ describe 'Musician Search Model' do { instrument_id: inst.id, proficiency_level: 2, priority: 1 } end user_types[0..2].each do |utype| - uu = FactoryGirl.create(utype) + uu = FactoryBot.create(utype) uu.update_instruments(instruments) end end @@ -211,13 +211,13 @@ describe 'Musician Search Model' do Score.delete_all t = Time.now - 10.minute - @user1 = FactoryGirl.create(:user, created_at: t+1.minute, last_jam_locidispid: 1) - @user2 = FactoryGirl.create(:user, created_at: t+2.minute, last_jam_locidispid: 2) - @user3 = FactoryGirl.create(:user, created_at: t+3.minute, last_jam_locidispid: 3) - @user4 = FactoryGirl.create(:user, created_at: t+4.minute, last_jam_locidispid: 4) - @user5 = FactoryGirl.create(:user, created_at: t+5.minute, last_jam_locidispid: 5) - @user6 = FactoryGirl.create(:user, created_at: t+6.minute) # not geocoded - @user7 = FactoryGirl.create(:user, created_at: t+7.minute, musician: false) # not musician + @user1 = FactoryBot.create(:user, created_at: t+1.minute, last_jam_locidispid: 1) + @user2 = FactoryBot.create(:user, created_at: t+2.minute, last_jam_locidispid: 2) + @user3 = FactoryBot.create(:user, created_at: t+3.minute, last_jam_locidispid: 3) + @user4 = FactoryBot.create(:user, created_at: t+4.minute, last_jam_locidispid: 4) + @user5 = FactoryBot.create(:user, created_at: t+5.minute, last_jam_locidispid: 5) + @user6 = FactoryBot.create(:user, created_at: t+6.minute) # not geocoded + @user7 = FactoryBot.create(:user, created_at: t+7.minute, musician: false) # not musician @musicians = [] @musicians << @user1 diff --git a/ruby/spec/jam_ruby/models/notification_spec.rb b/ruby/spec/jam_ruby/models/notification_spec.rb index a73f7bdf9..773a61335 100644 --- a/ruby/spec/jam_ruby/models/notification_spec.rb +++ b/ruby/spec/jam_ruby/models/notification_spec.rb @@ -12,20 +12,20 @@ describe Notification do Follow.delete_all User.delete_all - @receiver = FactoryGirl.create(:user) - @sender = FactoryGirl.create(:user) - @recording = FactoryGirl.create(:recording) - @session = FactoryGirl.create(:music_session) - @band = FactoryGirl.create(:band) + @receiver = FactoryBot.create(:user) + @sender = FactoryBot.create(:user) + @recording = FactoryBot.create(:recording) + @session = FactoryBot.create(:music_session) + @band = FactoryBot.create(:band) - @slot1 = FactoryGirl.build(:rsvp_slot, :music_session => @session, :instrument => JamRuby::Instrument.find('electric guitar')) + @slot1 = FactoryBot.build(:rsvp_slot, :music_session => @session, :instrument => JamRuby::Instrument.find('electric guitar')) @slot1.save - @slot2 = FactoryGirl.build(:rsvp_slot, :music_session => @session, :instrument => JamRuby::Instrument.find('drums')) + @slot2 = FactoryBot.build(:rsvp_slot, :music_session => @session, :instrument => JamRuby::Instrument.find('drums')) @slot2.save - @friend_request = FactoryGirl.create(:friend_request, user: @sender, friend: @receiver) + @friend_request = FactoryBot.create(:friend_request, user: @sender, friend: @receiver) end def count_publish_to_user_calls @@ -74,7 +74,7 @@ describe Notification do end it "success when online" do - receiver_connection = FactoryGirl.create(:connection, user: @receiver) + receiver_connection = FactoryBot.create(:connection, user: @receiver) calls = count_publish_to_user_calls notification = Notification.send_friend_request(@friend_request.id, @sender.id, @receiver.id) @@ -177,8 +177,8 @@ describe Notification do @session.creator = @sender @session.save! - FactoryGirl.create(:friendship, :user => @receiver, :friend => @sender) - FactoryGirl.create(:friendship, :user => @sender, :friend => @receiver) + FactoryBot.create(:friendship, :user => @receiver, :friend => @sender) + FactoryBot.create(:friendship, :user => @sender, :friend => @receiver) calls = count_publish_to_user_calls Notification.send_musician_session_join(@session, @sender) @@ -188,8 +188,8 @@ describe Notification do end it "does not send email when user is offline and opts out of emails" do - FactoryGirl.create(:friendship, :user => @receiver, :friend => @sender) - FactoryGirl.create(:friendship, :user => @sender, :friend => @receiver) + FactoryBot.create(:friendship, :user => @receiver, :friend => @sender) + FactoryBot.create(:friendship, :user => @sender, :friend => @receiver) @session.creator = @sender @session.save! @@ -207,8 +207,8 @@ describe Notification do describe "send musician recording saved" do it "sends email when user is offline and subscribes to emails" do - FactoryGirl.create(:friendship, :user => @receiver, :friend => @recording.owner) - FactoryGirl.create(:friendship, :user => @recording.owner, :friend => @receiver) + FactoryBot.create(:friendship, :user => @receiver, :friend => @recording.owner) + FactoryBot.create(:friendship, :user => @recording.owner, :friend => @receiver) calls = count_publish_to_user_calls Notification.send_musician_recording_saved(@recording) @@ -218,8 +218,8 @@ describe Notification do end it "does not send email when user is offline and opts out of emails" do - FactoryGirl.create(:friendship, :user => @receiver, :friend => @recording.owner) - FactoryGirl.create(:friendship, :user => @recording.owner, :friend => @receiver) + FactoryBot.create(:friendship, :user => @receiver, :friend => @recording.owner) + FactoryBot.create(:friendship, :user => @recording.owner, :friend => @receiver) @receiver.subscribe_email = false @receiver.save! @@ -233,7 +233,7 @@ describe Notification do end describe "send band session join" do - let(:follower) {FactoryGirl.create(:user)} + let(:follower) {FactoryBot.create(:user)} it "sends email when user is offline and subscribes to emails" do @session.creator = @sender @@ -274,7 +274,7 @@ describe Notification do end describe "send band recording saved" do - let(:follower) {FactoryGirl.create(:user)} + let(:follower) {FactoryBot.create(:user)} it "sends email when user is offline and subscribes to emails" do f = Follow.new @@ -752,7 +752,7 @@ describe Notification do it "sends notice 5 minutes before" do UserMailer.deliveries.length.should == 0 - receiver_connection = FactoryGirl.create(:connection, user: @receiver) + receiver_connection = FactoryBot.create(:connection, user: @receiver) @receiver.reload rsvp = RsvpRequest.create({:session_id => @session.id, :rsvp_slots => [@slot1.id, @slot2.id], :message => "We be jammin!"}, @receiver) @@ -831,7 +831,7 @@ describe Notification do it "success when online" do - receiver_connection = FactoryGirl.create(:connection, user: @receiver) + receiver_connection = FactoryBot.create(:connection, user: @receiver) @receiver.reload message = "Just a test message!" calls = count_publish_to_user_calls @@ -849,7 +849,7 @@ describe Notification do end it "success when online with long message" do - receiver_connection = FactoryGirl.create(:connection, user: @receiver) + receiver_connection = FactoryBot.create(:connection, user: @receiver) @receiver.reload message = "0" * 203 # 200 is clip size calls = count_publish_to_user_calls diff --git a/ruby/spec/jam_ruby/models/online_presence_spec.rb b/ruby/spec/jam_ruby/models/online_presence_spec.rb index db05c67aa..f4409f6f1 100644 --- a/ruby/spec/jam_ruby/models/online_presence_spec.rb +++ b/ruby/spec/jam_ruby/models/online_presence_spec.rb @@ -159,8 +159,8 @@ describe OnlinePresence do describe "with a user" do it_should_behave_like :online_presence_specs do - let(:player1) { FactoryGirl.create(:user) } - let(:player2) { FactoryGirl.create(:user) } + let(:player1) { FactoryBot.create(:user) } + let(:player2) { FactoryBot.create(:user) } end after(:all) { @@ -170,8 +170,8 @@ describe OnlinePresence do describe "with a band" do it_should_behave_like :online_presence_specs do - let(:player1) { FactoryGirl.create(:band) } - let(:player2) { FactoryGirl.create(:band) } + let(:player1) { FactoryBot.create(:band) } + let(:player2) { FactoryBot.create(:band) } end after(:all) { diff --git a/ruby/spec/jam_ruby/models/payment_history_spec.rb b/ruby/spec/jam_ruby/models/payment_history_spec.rb index b28cffec3..b9d0b7969 100644 --- a/ruby/spec/jam_ruby/models/payment_history_spec.rb +++ b/ruby/spec/jam_ruby/models/payment_history_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' describe PaymentHistory do - let(:user) {FactoryGirl.create(:user)} - let(:user2) {FactoryGirl.create(:user)} - let(:jam_track) {FactoryGirl.create(:jam_track)} + let(:user) {FactoryBot.create(:user)} + let(:user2) {FactoryBot.create(:user)} + let(:jam_track) {FactoryBot.create(:jam_track)} before(:each) do diff --git a/ruby/spec/jam_ruby/models/performance_sample_spec.rb b/ruby/spec/jam_ruby/models/performance_sample_spec.rb index 63f03f244..dfb7fbcaf 100644 --- a/ruby/spec/jam_ruby/models/performance_sample_spec.rb +++ b/ruby/spec/jam_ruby/models/performance_sample_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe PerformanceSample do shared_examples_for :performance_sample_specs do - let(:claimed_recording) { FactoryGirl.create(:claimed_recording) } + let(:claimed_recording) { FactoryBot.create(:claimed_recording) } describe "index" do @@ -122,8 +122,8 @@ describe PerformanceSample do describe "with a user" do it_should_behave_like :performance_sample_specs do - let(:player1) { FactoryGirl.create(:user) } - let(:player2) { FactoryGirl.create(:user) } + let(:player1) { FactoryBot.create(:user) } + let(:player2) { FactoryBot.create(:user) } end after(:all) { @@ -138,8 +138,8 @@ describe PerformanceSample do describe "with a band" do it_should_behave_like :performance_sample_specs do - let(:player1) { FactoryGirl.create(:band) } - let(:player2) { FactoryGirl.create(:band) } + let(:player1) { FactoryBot.create(:band) } + let(:player2) { FactoryBot.create(:band) } end after(:all) { diff --git a/ruby/spec/jam_ruby/models/posa_card_spec.rb b/ruby/spec/jam_ruby/models/posa_card_spec.rb index 147101851..f08b650fc 100644 --- a/ruby/spec/jam_ruby/models/posa_card_spec.rb +++ b/ruby/spec/jam_ruby/models/posa_card_spec.rb @@ -2,12 +2,12 @@ require 'spec_helper' describe PosaCard do - let(:user) {FactoryGirl.create(:user)} - let(:card) {FactoryGirl.create(:posa_card)} - let(:card2) {FactoryGirl.create(:posa_card)} - let(:card_lessons) {FactoryGirl.create(:posa_card_lesson_4)} - let(:card_lessons_2) {FactoryGirl.create(:posa_card_lesson_2)} - let(:retailer) {FactoryGirl.create(:retailer)} + let(:user) {FactoryBot.create(:user)} + let(:card) {FactoryBot.create(:posa_card)} + let(:card2) {FactoryBot.create(:posa_card)} + let(:card_lessons) {FactoryBot.create(:posa_card_lesson_4)} + let(:card_lessons_2) {FactoryBot.create(:posa_card_lesson_2)} + let(:retailer) {FactoryBot.create(:retailer)} it "created by factory" do card.touch end diff --git a/ruby/spec/jam_ruby/models/quick_mix_spec.rb b/ruby/spec/jam_ruby/models/quick_mix_spec.rb index 70e6ae6e8..f4a1ad44b 100644 --- a/ruby/spec/jam_ruby/models/quick_mix_spec.rb +++ b/ruby/spec/jam_ruby/models/quick_mix_spec.rb @@ -6,12 +6,12 @@ describe QuickMix do include UsesTempFiles before do - @user = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @music_session = FactoryGirl.create(:active_music_session, :creator => @user, :musician_access => true) - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @recording = FactoryGirl.create(:recording, :music_session => @music_session, :owner => @user) + @user = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @music_session = FactoryBot.create(:active_music_session, :creator => @user, :musician_access => true) + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @recording = FactoryBot.create(:recording, :music_session => @music_session, :owner => @user) end it "should copy from a regular track properly" do diff --git a/ruby/spec/jam_ruby/models/recorded_backing_track_spec.rb b/ruby/spec/jam_ruby/models/recorded_backing_track_spec.rb index 5e93030e1..f1eedf678 100644 --- a/ruby/spec/jam_ruby/models/recorded_backing_track_spec.rb +++ b/ruby/spec/jam_ruby/models/recorded_backing_track_spec.rb @@ -6,13 +6,13 @@ describe RecordedBackingTrack do include UsesTempFiles before do - @user = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @music_session = FactoryGirl.create(:active_music_session, :creator => @user, :musician_access => true) - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @backing_track = FactoryGirl.create(:backing_track, :connection => @connection) - @recording = FactoryGirl.create(:recording, :music_session => @music_session, :owner => @user) + @user = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @music_session = FactoryBot.create(:active_music_session, :creator => @user, :musician_access => true) + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @backing_track = FactoryBot.create(:backing_track, :connection => @connection) + @recording = FactoryBot.create(:recording, :music_session => @music_session, :owner => @user) end it "should copy from a regular track properly" do @@ -53,7 +53,7 @@ describe RecordedBackingTrack do end it "can not be downloaded if no claimed recording" do - user2 = FactoryGirl.create(:user) + user2 = FactoryBot.create(:user) @recorded_backing_track = RecordedBackingTrack.create_from_backing_track(@backing_track, @recording) @recorded_backing_track.can_download?(user2).should be_false @recorded_backing_track.can_download?(@user).should be_false diff --git a/ruby/spec/jam_ruby/models/recorded_track_spec.rb b/ruby/spec/jam_ruby/models/recorded_track_spec.rb index de3e08f2e..2170efa48 100644 --- a/ruby/spec/jam_ruby/models/recorded_track_spec.rb +++ b/ruby/spec/jam_ruby/models/recorded_track_spec.rb @@ -6,12 +6,12 @@ describe RecordedTrack do include UsesTempFiles before do - @user = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @music_session = FactoryGirl.create(:active_music_session, :creator => @user, :musician_access => true) - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @recording = FactoryGirl.create(:recording, :music_session => @music_session, :owner => @user) + @user = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @music_session = FactoryBot.create(:active_music_session, :creator => @user, :musician_access => true) + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @recording = FactoryBot.create(:recording, :music_session => @music_session, :owner => @user) end it "should copy from a regular track properly" do @@ -52,7 +52,7 @@ describe RecordedTrack do end it "can not be downloaded if no claimed recording" do - user2 = FactoryGirl.create(:user) + user2 = FactoryBot.create(:user) @recorded_track = RecordedTrack.create_from_track(@track, @recording) @recorded_track.can_download?(user2).should be_false @recorded_track.can_download?(@user).should be_false diff --git a/ruby/spec/jam_ruby/models/recorded_video_spec.rb b/ruby/spec/jam_ruby/models/recorded_video_spec.rb index b6283ae67..959442b41 100644 --- a/ruby/spec/jam_ruby/models/recorded_video_spec.rb +++ b/ruby/spec/jam_ruby/models/recorded_video_spec.rb @@ -3,11 +3,11 @@ require 'rest-client' describe RecordedVideo do include UsesTempFiles - let (:user) {FactoryGirl.create(:user)} - let (:connection) {FactoryGirl.create(:connection, :user => user)} - let (:music_session){FactoryGirl.create(:active_music_session, :creator => user, :musician_access => true)} - let (:recording) {FactoryGirl.create(:recording, :music_session => music_session, :owner => user)} - let (:video_source) {FactoryGirl.create(:video_source, :connection => connection)} + let (:user) {FactoryBot.create(:user)} + let (:connection) {FactoryBot.create(:connection, :user => user)} + let (:music_session){FactoryBot.create(:active_music_session, :creator => user, :musician_access => true)} + let (:recording) {FactoryBot.create(:recording, :music_session => music_session, :owner => user)} + let (:video_source) {FactoryBot.create(:video_source, :connection => connection)} it "should create from a video source" do recorded_video_source = RecordedVideo.create_from_video_source(video_source, recording) diff --git a/ruby/spec/jam_ruby/models/recording_spec.rb b/ruby/spec/jam_ruby/models/recording_spec.rb index 5c9696f51..d049ab156 100644 --- a/ruby/spec/jam_ruby/models/recording_spec.rb +++ b/ruby/spec/jam_ruby/models/recording_spec.rb @@ -8,11 +8,11 @@ describe Recording do let(:s3_manager) { S3Manager.new(app_config.aws_bucket, app_config.aws_access_key_id, app_config.aws_secret_access_key) } before do - @user = FactoryGirl.create(:user) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @music_session = FactoryGirl.create(:active_music_session, :creator => @user, :musician_access => true) - @connection = FactoryGirl.create(:connection, :user => @user, :music_session => @music_session) - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) + @user = FactoryBot.create(:user) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @music_session = FactoryBot.create(:active_music_session, :creator => @user, :musician_access => true) + @connection = FactoryBot.create(:connection, :user => @user, :music_session => @music_session) + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) end describe "create_immediately" do @@ -36,7 +36,7 @@ describe Recording do end it "one public recording" do - claim = FactoryGirl.create(:claimed_recording) + claim = FactoryBot.create(:claimed_recording) claim.recording.is_done = true claim.recording.save! @@ -46,7 +46,7 @@ describe Recording do end it "one private recording" do - claim = FactoryGirl.create(:claimed_recording, is_public: true) + claim = FactoryBot.create(:claimed_recording, is_public: true) recordings = Recording.popular_recordings recordings.length.should eq(0) @@ -58,13 +58,13 @@ describe Recording do sample_audio='sample.file' in_directory_with_file(sample_audio) - let(:user2) { FactoryGirl.create(:user) } - let(:quick_mix) { FactoryGirl.create(:quick_mix) } + let(:user2) { FactoryBot.create(:user) } + let(:quick_mix) { FactoryBot.create(:quick_mix) } let(:quick_mix2) { - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: user2) - recording.claimed_recordings << FactoryGirl.create(:claimed_recording, user: user2, recording: recording) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: user2) + recording.claimed_recordings << FactoryBot.create(:claimed_recording, user: user2, recording: recording) recording.save! - FactoryGirl.create(:quick_mix, autowire: false, recording: recording, user: user2) } + FactoryBot.create(:quick_mix, autowire: false, recording: recording, user: user2) } let(:recording) { quick_mix.recording } before(:each) do @@ -234,9 +234,9 @@ describe Recording do end it "should allow finding of recorded tracks" do - user2 = FactoryGirl.create(:user) - connection2 = FactoryGirl.create(:connection, :user => user2, :music_session => @music_session) - track2 = FactoryGirl.create(:track, :connection => connection2, :instrument => @instrument) + user2 = FactoryBot.create(:user) + connection2 = FactoryBot.create(:connection, :user => user2, :music_session => @music_session) + track2 = FactoryBot.create(:track, :connection => connection2, :instrument => @instrument) @recording = Recording.start(@music_session, @user) user1_recorded_tracks = @recording.recorded_tracks_for_user(@user) @@ -251,10 +251,10 @@ describe Recording do end it "should allow finding of backing tracks" do - user2 = FactoryGirl.create(:user) - connection2 = FactoryGirl.create(:connection, :user => user2, :music_session => @music_session) - track2 = FactoryGirl.create(:track, :connection => connection2, :instrument => @instrument) - backing_track = FactoryGirl.create(:backing_track, :connection => connection2) + user2 = FactoryBot.create(:user) + connection2 = FactoryBot.create(:connection, :user => user2, :music_session => @music_session) + track2 = FactoryBot.create(:track, :connection => connection2, :instrument => @instrument) + backing_track = FactoryBot.create(:backing_track, :connection => connection2) @recording = Recording.start(@music_session, @user) @@ -310,10 +310,10 @@ describe Recording do end it "should NOT attach the recording to all users in a the music session when recording started" do - @user2 = FactoryGirl.create(:user) - @connection2 = FactoryGirl.create(:connection, :user => @user2) - @instrument2 = FactoryGirl.create(:instrument, :description => 'a great instrument') - @track2 = FactoryGirl.create(:track, :connection => @connection2, :instrument => @instrument2) + @user2 = FactoryBot.create(:user) + @connection2 = FactoryBot.create(:connection, :user => @user2) + @instrument2 = FactoryBot.create(:instrument, :description => 'a great instrument') + @track2 = FactoryBot.create(:track, :connection => @connection2, :instrument => @instrument2) # @music_session.connections << @connection2 @connection2.join_the_session(@music_session, true, nil, @user2, 10) @@ -350,7 +350,7 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @recording.claim(@user, "name", "description", @genre, true) @recording.reload @recording.users.length.should == 1 @@ -370,7 +370,7 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - user2 = FactoryGirl.create(:user) + user2 = FactoryBot.create(:user) expect { @recording.claim(user2, "name", "description", @genre, true) }.to raise_error end @@ -378,9 +378,9 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @claimed_recording = @recording.claim(@user, "name", "description", @genre, true) - @genre2 = FactoryGirl.create(:genre) + @genre2 = FactoryBot.create(:genre) @claimed_recording.update_fields(@user, :name => "name2", :description => "description2", :genre => @genre2.id, :is_public => false) @claimed_recording.reload @claimed_recording.name.should == "name2" @@ -394,9 +394,9 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @claimed_recording = @recording.claim(@user, "name", "description", @genre, true) - @user2 = FactoryGirl.create(:user) + @user2 = FactoryBot.create(:user) expect { @claimed_recording.update_fields(@user2, "name2") }.to raise_error end @@ -412,16 +412,16 @@ describe Recording do end it "should only destroy a single claimed_recording if there are more than one" do - @user2 = FactoryGirl.create(:user) - @connection2 = FactoryGirl.create(:connection, :user => @user2) - @track = FactoryGirl.create(:track, :connection => @connection2, :instrument => @instrument) + @user2 = FactoryBot.create(:user) + @connection2 = FactoryBot.create(:connection, :user => @user2) + @track = FactoryBot.create(:track, :connection => @connection2, :instrument => @instrument) # @music_session.connections << @connection2 @music_session.save @connection2.join_the_session(@music_session, true, nil, @user2, 10) @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @claimed_recording = @recording.claim(@user, "name", "description", @genre, true) expect { @claimed_recordign.discard(@user2) }.to raise_error @claimed_recording = @recording.claim(@user2, "name2", "description2", @genre, true) @@ -440,7 +440,7 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @recording.claim(@user, "name", "description", @genre, true, true) @recording.reload @@ -461,7 +461,7 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @claimed_recording = @recording.claim(@user, "name", "description", @genre, true) @claimed_recording.discard(@user) @claimed_recording.reload @@ -475,7 +475,7 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @recording.claim(@user, "Recording", "Recording Description", @genre, true) uploads = Recording.list_uploads(@user) uploads["uploads"].length.should == 2 # recorded_track and stream_mix @@ -488,7 +488,7 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @recording.claim(@user, "Recording", "Recording Description", @genre, true) @recording.mark_delete uploads = Recording.list_uploads(@user) @@ -499,7 +499,7 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @recording.claim(@user, "Recording", "Recording Description", @genre, true) downloads = Recording.list_downloads(@user) downloads["downloads"].length.should == 0 @@ -513,7 +513,7 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @recording.claim(@user, "Recording", "Recording Description", @genre, true) downloads = Recording.list_downloads(@user) downloads["downloads"].length.should == 0 @@ -535,9 +535,9 @@ describe Recording do describe "chance for everyone to keep or discard" do before(:each) do - @user2 = FactoryGirl.create(:user) - @connection2 = FactoryGirl.create(:connection, :user => @user2, :music_session => @music_session) - @track2 = FactoryGirl.create(:track, :connection => @connection2, :instrument => @instrument) + @user2 = FactoryBot.create(:user) + @connection2 = FactoryBot.create(:connection, :user => @user2, :music_session => @music_session) + @track2 = FactoryBot.create(:track, :connection => @connection2, :instrument => @instrument) @recording = Recording.start(@music_session, @user) @recording.stop @@ -578,7 +578,7 @@ describe Recording do it "set video from source" do - @video_source = FactoryGirl.create(:video_source, :connection => @connection) + @video_source = FactoryBot.create(:video_source, :connection => @connection) @music_session.is_recording?.should be_false @recording = Recording.start(@music_session, @user) @@ -592,14 +592,14 @@ describe Recording do end it "should include video when listing uploads" do - @video_source = FactoryGirl.create(:video_source, :connection => @connection) + @video_source = FactoryBot.create(:video_source, :connection => @connection) @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @recording.claim(@user, "Recording", "Recording Description", @genre, true) - @backing_track = FactoryGirl.create(:backing_track, :connection => @connection) + @backing_track = FactoryBot.create(:backing_track, :connection => @connection) # We should have 2 items; a track and a video: uploads = Recording.list_uploads(@user) @@ -616,11 +616,11 @@ describe Recording do end it "should paginate with video" do - @video_source = FactoryGirl.create(:video_source, :connection => @connection) + @video_source = FactoryBot.create(:video_source, :connection => @connection) @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @recording.claim(@user, "Recording", "Recording Description", @genre, true) # Limit to 1, so we can test pagination: @@ -643,19 +643,19 @@ describe Recording do end it "should only retrieve tracks and videos from user" do - user2 = FactoryGirl.create(:user) # in the jam session - music_session2 = FactoryGirl.create(:active_music_session, :creator => @user, :musician_access => true) - music_session_member2 = FactoryGirl.create(:connection, :user => user2, :music_session => @music_session, :ip_address => "2.2.2.2", :client_id => "2") - connection2 = FactoryGirl.create(:connection, :user => user2, :music_session => @music_session) - track2 = FactoryGirl.create(:track, :connection => connection2, :instrument => @instrument) + user2 = FactoryBot.create(:user) # in the jam session + music_session2 = FactoryBot.create(:active_music_session, :creator => @user, :musician_access => true) + music_session_member2 = FactoryBot.create(:connection, :user => user2, :music_session => @music_session, :ip_address => "2.2.2.2", :client_id => "2") + connection2 = FactoryBot.create(:connection, :user => user2, :music_session => @music_session) + track2 = FactoryBot.create(:track, :connection => connection2, :instrument => @instrument) - video_source = FactoryGirl.create(:video_source, :connection => @connection) - video_source2 = FactoryGirl.create(:video_source, :connection => connection2) + video_source = FactoryBot.create(:video_source, :connection => @connection) + video_source2 = FactoryBot.create(:video_source, :connection => connection2) @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @recording.claim(@user, "Recording", "Recording Description", @genre, true) # We should have 3 items; a track and a video: @@ -696,7 +696,7 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload - @genre = FactoryGirl.create(:genre) + @genre = FactoryBot.create(:genre) @recording.claim(@user, "Recording", "Recording Description", @genre, true) # We should have 2 items; a track and a quick mix: @@ -722,7 +722,7 @@ describe Recording do end describe "discarded_and_stale" do - let(:recording1) { FactoryGirl.create(:recording_with_track) } + let(:recording1) { FactoryBot.create(:recording_with_track) } let(:track1) { recording1.recorded_tracks[0] } it "no results if no recordings" do @@ -808,7 +808,7 @@ describe Recording do describe "that has two tracks, no votes" do - let(:track2) { FactoryGirl.create(:recorded_track, recording: recording1, user: recording1.owner) } + let(:track2) { FactoryBot.create(:recorded_track, recording: recording1, user: recording1.owner) } before(:each) do track1.discard = nil @@ -840,7 +840,7 @@ describe Recording do describe "that has two tracks, two discard" do - let(:track2) { FactoryGirl.create(:recorded_track, recording: recording1, user: recording1.owner) } + let(:track2) { FactoryBot.create(:recorded_track, recording: recording1, user: recording1.owner) } before(:each) do track1.discard = true @@ -871,7 +871,7 @@ describe Recording do describe "that has two tracks, one discard, one keep" do - let(:track2) { FactoryGirl.create(:recorded_track, recording: recording1, user: recording1.owner) } + let(:track2) { FactoryBot.create(:recorded_track, recording: recording1, user: recording1.owner) } before(:each) do track1.discard = true @@ -900,7 +900,7 @@ describe Recording do describe "that has two tracks, two keeps" do - let(:track2) { FactoryGirl.create(:recorded_track, recording: recording1, user: recording1.owner) } + let(:track2) { FactoryBot.create(:recorded_track, recording: recording1, user: recording1.owner) } before(:each) do track1.discard = false @@ -928,7 +928,7 @@ describe Recording do end describe "two recordings" do - let(:recording2) { FactoryGirl.create(:recording_with_track) } + let(:recording2) { FactoryBot.create(:recording_with_track) } let(:track2) { recording2.recorded_tracks[0] } describe "both discard" do @@ -1022,8 +1022,8 @@ describe Recording do describe "two keeps, two discards" do - let(:track1_2) { FactoryGirl.create(:recorded_track, recording: recording1, user: recording1.owner) } - let(:track2_2) { FactoryGirl.create(:recorded_track, recording: recording2, user: recording1.owner) } + let(:track1_2) { FactoryBot.create(:recorded_track, recording: recording1, user: recording1.owner) } + let(:track2_2) { FactoryBot.create(:recorded_track, recording: recording2, user: recording1.owner) } before(:each) do track1.discard = false @@ -1065,7 +1065,7 @@ describe Recording do end describe "delete" do - let(:mix) { FactoryGirl.create(:mix) } + let(:mix) { FactoryBot.create(:mix) } let(:recording) { mix.recording } before(:each) do @@ -1073,11 +1073,11 @@ describe Recording do end it "success" do - FactoryGirl.create(:quick_mix, user: recording.owner, recording: recording, autowire: false) - FactoryGirl.create(:recording_comment, recording: recording, user: recording.owner) - FactoryGirl.create(:recording_like, recording: recording, claimed_recording: recording.claimed_recordings.first, favorite: true) - FactoryGirl.create(:playable_play, playable_id: recording.id, playable_type: 'JamRuby::Recording') - FactoryGirl.create(:recorded_video, user: recording.owner, recording: recording) + FactoryBot.create(:quick_mix, user: recording.owner, recording: recording, autowire: false) + FactoryBot.create(:recording_comment, recording: recording, user: recording.owner) + FactoryBot.create(:recording_like, recording: recording, claimed_recording: recording.claimed_recordings.first, favorite: true) + FactoryBot.create(:playable_play, playable_id: recording.id, playable_type: 'JamRuby::Recording') + FactoryBot.create(:recorded_video, user: recording.owner, recording: recording) recording.reload recording.claimed_recordings.length.should > 0 recording.mixes.length.should > 0 @@ -1114,7 +1114,7 @@ describe Recording do describe "add_timeline" do - let!(:recorded_jam_track_track) { FactoryGirl.create(:recorded_jam_track_track) } + let!(:recorded_jam_track_track) { FactoryBot.create(:recorded_jam_track_track) } let(:recording) { recorded_jam_track_track.recording } let(:timeline_data) { {"sample" => "data"} } let(:good_timeline) { { diff --git a/ruby/spec/jam_ruby/models/recurly_transaction_web_hook_spec.rb b/ruby/spec/jam_ruby/models/recurly_transaction_web_hook_spec.rb index bce945d20..2ff8a8fd2 100644 --- a/ruby/spec/jam_ruby/models/recurly_transaction_web_hook_spec.rb +++ b/ruby/spec/jam_ruby/models/recurly_transaction_web_hook_spec.rb @@ -116,7 +116,7 @@ describe RecurlyTransactionWebHook do describe "sales integrity maintanence" do before(:each) do - @user = FactoryGirl.create(:user, id: '56d5b2c6-2a4b-46e4-a984-ec1fbe83a50d') + @user = FactoryBot.create(:user, id: '56d5b2c6-2a4b-46e4-a984-ec1fbe83a50d') end it "deletes jam_track_right when refunded" do @@ -126,7 +126,7 @@ describe RecurlyTransactionWebHook do sale.recurly_total_in_cents = 216 sale.save! # create a jam_track right, which should be whacked as soon as we craete the web hook - jam_track_right = FactoryGirl.create(:jam_track_right, user: @user, recurly_adjustment_uuid: 'bleh') + jam_track_right = FactoryBot.create(:jam_track_right, user: @user, recurly_adjustment_uuid: 'bleh') shopping_cart = ShoppingCart.create(@user, jam_track_right.jam_track) SaleLineItem.create_from_shopping_cart(sale, shopping_cart, nil, '2da71ad9c657adf9fe618e4f058c78bb', nil) @@ -145,7 +145,7 @@ describe RecurlyTransactionWebHook do sale.recurly_total_in_cents = 216 sale.save! # create a jam_track right, which should be whacked as soon as we craete the web hook - jam_track_right = FactoryGirl.create(:jam_track_right, user: @user, recurly_adjustment_uuid: 'blah') + jam_track_right = FactoryBot.create(:jam_track_right, user: @user, recurly_adjustment_uuid: 'blah') shopping_cart = ShoppingCart.create(@user, jam_track_right.jam_track) SaleLineItem.create_from_shopping_cart(sale, shopping_cart, nil, '2da71ad9c657adf9fe618e4f058c78bb', nil) @@ -189,7 +189,7 @@ describe RecurlyTransactionWebHook do describe "create_from_xml" do before(:each) do - @user = FactoryGirl.create(:user, id: '56d5b2c6-2a4b-46e4-a984-ec1fbe83a50d') + @user = FactoryBot.create(:user, id: '56d5b2c6-2a4b-46e4-a984-ec1fbe83a50d') end it "successful payment" do diff --git a/ruby/spec/jam_ruby/models/retailer_invitation_spec.rb b/ruby/spec/jam_ruby/models/retailer_invitation_spec.rb index 4e1cee8f3..5decd6811 100644 --- a/ruby/spec/jam_ruby/models/retailer_invitation_spec.rb +++ b/ruby/spec/jam_ruby/models/retailer_invitation_spec.rb @@ -2,10 +2,10 @@ require 'spec_helper' describe RetailerInvitation do - let(:retailer) {FactoryGirl.create(:retailer)} + let(:retailer) {FactoryBot.create(:retailer)} it "created by factory" do - FactoryGirl.create(:retailer_invitation) + FactoryBot.create(:retailer_invitation) end it "created by method" do @@ -16,14 +16,14 @@ describe RetailerInvitation do it "works" do RetailerInvitation.index(retailer, {})[:query].count.should eql 0 - FactoryGirl.create(:retailer_invitation) + FactoryBot.create(:retailer_invitation) RetailerInvitation.index(retailer, {})[:query].count.should eql 0 RetailerInvitation.index(retailer, {})[:query].count.should eql 0 - FactoryGirl.create(:retailer_invitation, retailer: retailer, ) + FactoryBot.create(:retailer_invitation, retailer: retailer, ) RetailerInvitation.index(retailer, {})[:query].count.should eql 1 - FactoryGirl.create(:retailer_invitation, retailer: retailer, ) + FactoryBot.create(:retailer_invitation, retailer: retailer, ) RetailerInvitation.index(retailer, {})[:query].count.should eql 2 end diff --git a/ruby/spec/jam_ruby/models/retailer_spec.rb b/ruby/spec/jam_ruby/models/retailer_spec.rb index 96f144b11..07c7d1307 100644 --- a/ruby/spec/jam_ruby/models/retailer_spec.rb +++ b/ruby/spec/jam_ruby/models/retailer_spec.rb @@ -3,27 +3,27 @@ require 'spec_helper' describe Retailer do it "created by factory" do - FactoryGirl.create(:retailer) + FactoryBot.create(:retailer) end it "doesn't match uuid password" do - retailer= FactoryGirl.create(:retailer) + retailer= FactoryBot.create(:retailer) retailer.reload retailer.matches_password('hha').should be false end it "automatic slug creation" do - retailer= FactoryGirl.create(:retailer, slug: nil) + retailer= FactoryBot.create(:retailer, slug: nil) retailer.id.should_not be_blank retailer.slug.should eql retailer.id.to_s end it "has correct associations" do - retailer = FactoryGirl.create(:retailer) + retailer = FactoryBot.create(:retailer) retailer.should eql retailer.user.owned_retailer - teacher = FactoryGirl.create(:teacher, retailer: retailer) + teacher = FactoryBot.create(:teacher, retailer: retailer) retailer.reload retailer.teachers.to_a.should eql [teacher] @@ -32,13 +32,13 @@ describe Retailer do end it "updates" do - retailer = FactoryGirl.create(:retailer) + retailer = FactoryBot.create(:retailer) retailer.update_from_params({name: 'hahah'}) retailer.errors.any?.should be false end it "updates password" do - retailer = FactoryGirl.create(:retailer) + retailer = FactoryBot.create(:retailer) retailer.update_from_params({name: 'hahah', password: 'abc'}) retailer.errors.any?.should be true retailer.errors[:password].should eql ['is too short (minimum is 6 characters)'] diff --git a/ruby/spec/jam_ruby/models/review_spec.rb b/ruby/spec/jam_ruby/models/review_spec.rb index 3deed6f3b..e9603748f 100644 --- a/ruby/spec/jam_ruby/models/review_spec.rb +++ b/ruby/spec/jam_ruby/models/review_spec.rb @@ -6,7 +6,7 @@ describe Review do before(:each) do Review.delete_all User.delete_all - @user = FactoryGirl.create(:user) + @user = FactoryBot.create(:user) end after(:all) do @@ -51,7 +51,7 @@ describe Review do review = Review.create(target:target, rating:3, user:@user) review.valid?.should be_true - review2 = Review.create(target:target, rating:5, user:FactoryGirl.create(:user)) + review2 = Review.create(target:target, rating:5, user:FactoryBot.create(:user)) review2.valid?.should be_true Review.should have(2).items Review.index.should have(2).items @@ -64,7 +64,7 @@ describe Review do avg_orig = ReviewSummary.first.avg_rating # Create some more and verify: - 5.times {Review.create(target:target, rating:5, user:FactoryGirl.create(:user))} + 5.times {Review.create(target:target, rating:5, user:FactoryBot.create(:user))} Review.index.should have(7).items ReviewSummary.should have(1).items @@ -120,7 +120,7 @@ describe Review do it "reduces and queries" do review = Review.create(target:target, rating:3, user:@user) review.valid?.should be_true - review2 = Review.create(target:target, rating:5, user:FactoryGirl.create(:user)) + review2 = Review.create(target:target, rating:5, user:FactoryBot.create(:user)) review2.valid?.should be_true Review.should have(2).items @@ -132,15 +132,15 @@ describe Review do # Create some more and verify: - 5.times {Review.create(target:target, rating:5, user:FactoryGirl.create(:user))} + 5.times {Review.create(target:target, rating:5, user:FactoryBot.create(:user))} ReviewSummary.should have(1).items ReviewSummary.first.wilson_score.should > ws_orig ReviewSummary.first.avg_rating.should > avg_orig # Create some more with a different target and verify: - target2=FactoryGirl.create(:jam_track) - 5.times {Review.create(target:target2, rating:5, user:FactoryGirl.create(:user))} + target2=FactoryBot.create(:jam_track) + 5.times {Review.create(target:target2, rating:5, user:FactoryBot.create(:user))} Review.index.should have(12).items Review.index(target_id: target2).should have(5).items summaries = ReviewSummary.index() @@ -161,7 +161,7 @@ describe Review do end describe "with a jamtrack" do - @jam_track = FactoryGirl.create(:jam_track) + @jam_track = FactoryBot.create(:jam_track) it_behaves_like :review, @jam_track, "jam_track" end diff --git a/ruby/spec/jam_ruby/models/rsvp_request_spec.rb b/ruby/spec/jam_ruby/models/rsvp_request_spec.rb index efc991945..6aa109beb 100644 --- a/ruby/spec/jam_ruby/models/rsvp_request_spec.rb +++ b/ruby/spec/jam_ruby/models/rsvp_request_spec.rb @@ -12,29 +12,29 @@ describe RsvpRequest do MusicSession.delete_all User.delete_all - @session_invitee = FactoryGirl.create(:user) + @session_invitee = FactoryBot.create(:user) @session_invitee.save - @non_session_invitee = FactoryGirl.create(:user) + @non_session_invitee = FactoryBot.create(:user) @non_session_invitee.save - @session_creator = FactoryGirl.create(:user) + @session_creator = FactoryBot.create(:user) @session_creator.save # session invitations require sender and receiver to be friends - FactoryGirl.create(:friendship, :user => @session_invitee, :friend => @session_creator) - FactoryGirl.create(:friendship, :user => @session_creator, :friend => @session_invitee) + FactoryBot.create(:friendship, :user => @session_invitee, :friend => @session_creator) + FactoryBot.create(:friendship, :user => @session_creator, :friend => @session_invitee) - @music_session = FactoryGirl.build(:music_session, :creator => @session_creator) + @music_session = FactoryBot.build(:music_session, :creator => @session_creator) @music_session.save - @slot1 = FactoryGirl.build(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('electric guitar')) + @slot1 = FactoryBot.build(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('electric guitar')) @slot1.save! - @slot2 = FactoryGirl.build(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('drums')) + @slot2 = FactoryBot.build(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('drums')) @slot2.save! - @invitation = FactoryGirl.build(:invitation, :sender => @session_creator, :receiver => @session_invitee, :music_session => @music_session) + @invitation = FactoryBot.build(:invitation, :sender => @session_creator, :receiver => @session_invitee, :music_session => @music_session) @invitation.save! end @@ -149,7 +149,7 @@ describe RsvpRequest do @music_session.open_rsvps = true @music_session.save - user2 = FactoryGirl.create(:user) + user2 = FactoryBot.create(:user) RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => [@slot1.id, @slot2.id], :message => "Let's Jam!"}, @non_session_invitee) RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => [@slot1.id], :message => "Let's Jam 2!"}, user2) @@ -163,7 +163,7 @@ describe RsvpRequest do @music_session.open_rsvps = true @music_session.save - user2 = FactoryGirl.create(:user) + user2 = FactoryBot.create(:user) RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => [@slot1.id, @slot2.id], :message => "Let's Jam!"}, @non_session_invitee) RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => [@slot1.id], :message => "Let's Jam 2!"}, user2) @@ -183,13 +183,13 @@ describe RsvpRequest do rs2 = RsvpRequestRsvpSlot.find_by_rsvp_request_id_and_rsvp_slot_id(approved_rsvp.id, @slot2.id) RsvpRequest.update({:id => approved_rsvp.id, :session_id => @music_session.id, :rsvp_responses => [{:request_slot_id => rs1.id, :accept => true}, {:request_slot_id => rs2.id, :accept => false}]}, @session_creator) - user2 = FactoryGirl.create(:user) + user2 = FactoryBot.create(:user) declined_rsvp = RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => [@slot2.id]}, user2) rs2 = RsvpRequestRsvpSlot.find_by_rsvp_request_id_and_rsvp_slot_id(declined_rsvp, @slot2.id) RsvpRequest.update({:id => declined_rsvp.id, :session_id => @music_session.id, :rsvp_responses => [{:request_slot_id => rs2.id, :accept => false}]}, @session_creator) - user3 = FactoryGirl.create(:user) + user3 = FactoryBot.create(:user) pending_rsvp = RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => [@slot2.id]}, user3) rsvps = RsvpRequest.index(@music_session, nil, {:status => "pending"}) @@ -234,7 +234,7 @@ describe RsvpRequest do @slot2.delete - slot2 = FactoryGirl.build(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('electric guitar')) + slot2 = FactoryBot.build(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('electric guitar')) slot2.save! rsvp1 = RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => [@slot1.id], :message => "Let's Jam!"}, @session_invitee) @@ -395,7 +395,7 @@ describe RsvpRequest do end it "should not allow anyone else to cancel" do - user = FactoryGirl.create(:user) + user = FactoryBot.create(:user) rsvp = RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => [@slot1.id, @slot2.id], :message => "Let's Jam!"}, @session_invitee) @@ -411,7 +411,7 @@ describe RsvpRequest do describe "instrument_list" do it "single instrument" do @slot1.valid? - rsvp_request = FactoryGirl.create(:rsvp_request, rsvp_slots: [@slot1], user: @session_invitee) + rsvp_request = FactoryBot.create(:rsvp_request, rsvp_slots: [@slot1], user: @session_invitee) rsvp_request.instrument_list.should == [ JamRuby::Instrument.find('electric guitar')] rsvp_request.rsvp_slots.should eq([@slot1]) rsvp_request = RsvpRequest.find(rsvp_request.id) @@ -419,7 +419,7 @@ describe RsvpRequest do end it "multiple instruments" do - rsvp_request = FactoryGirl.create(:rsvp_request, rsvp_slots: [@slot1, @slot2], user: @session_invitee) + rsvp_request = FactoryBot.create(:rsvp_request, rsvp_slots: [@slot1, @slot2], user: @session_invitee) rsvp_request.instrument_list.should == [ @slot1.instrument, @slot2.instrument ] end end diff --git a/ruby/spec/jam_ruby/models/rsvp_slot_spec.rb b/ruby/spec/jam_ruby/models/rsvp_slot_spec.rb index 868bc24ea..526bd4b52 100644 --- a/ruby/spec/jam_ruby/models/rsvp_slot_spec.rb +++ b/ruby/spec/jam_ruby/models/rsvp_slot_spec.rb @@ -12,22 +12,22 @@ describe RsvpSlot do MusicSession.delete_all User.delete_all - @session_invitee = FactoryGirl.create(:user) + @session_invitee = FactoryBot.create(:user) - @session_creator = FactoryGirl.create(:user) + @session_creator = FactoryBot.create(:user) # session invitations require sender and receiver to be friends - FactoryGirl.create(:friendship, :user => @session_invitee, :friend => @session_creator) - FactoryGirl.create(:friendship, :user => @session_creator, :friend => @session_invitee) + FactoryBot.create(:friendship, :user => @session_invitee, :friend => @session_creator) + FactoryBot.create(:friendship, :user => @session_creator, :friend => @session_invitee) - @music_session = FactoryGirl.build(:music_session, :creator => @session_creator) + @music_session = FactoryBot.build(:music_session, :creator => @session_creator) @music_session.save - @slot1 = FactoryGirl.create(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('electric guitar')) + @slot1 = FactoryBot.create(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('electric guitar')) - @slot2 = FactoryGirl.create(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('drums')) + @slot2 = FactoryBot.create(:rsvp_slot, :music_session => @music_session, :instrument => JamRuby::Instrument.find('drums')) - @invitation = FactoryGirl.create(:invitation, :sender => @session_creator, :receiver => @session_invitee, :music_session => @music_session) + @invitation = FactoryBot.create(:invitation, :sender => @session_creator, :receiver => @session_invitee, :music_session => @music_session) end describe "index" do @@ -72,13 +72,13 @@ describe RsvpSlot do describe "validators" do it "require instrument if not unstructured" do - rsvp_slot = FactoryGirl.build(:rsvp_slot, instrument: nil) + rsvp_slot = FactoryBot.build(:rsvp_slot, instrument: nil) rsvp_slot.valid?.should be_false rsvp_slot.errors[:instrument].should == ["can't be blank"] end it "not require instrument if unstructured" do - rsvp_slot = FactoryGirl.build(:rsvp_slot, is_unstructured_rsvp: true, instrument: nil) + rsvp_slot = FactoryBot.build(:rsvp_slot, is_unstructured_rsvp: true, instrument: nil) rsvp_slot.valid?.should be_true end end diff --git a/ruby/spec/jam_ruby/models/sale_line_item_spec.rb b/ruby/spec/jam_ruby/models/sale_line_item_spec.rb index 4d0340259..9ccac0fe3 100644 --- a/ruby/spec/jam_ruby/models/sale_line_item_spec.rb +++ b/ruby/spec/jam_ruby/models/sale_line_item_spec.rb @@ -3,10 +3,10 @@ require 'spec_helper' describe SaleLineItem do - let(:user) {FactoryGirl.create(:user)} - let(:user2) {FactoryGirl.create(:user)} - let(:jam_track) {FactoryGirl.create(:jam_track)} - let(:gift_card) {FactoryGirl.create(:gift_card_type, card_type: GiftCardType::JAM_TRACKS_10)} + let(:user) {FactoryBot.create(:user)} + let(:user2) {FactoryBot.create(:user)} + let(:jam_track) {FactoryBot.create(:jam_track)} + let(:gift_card) {FactoryBot.create(:gift_card_type, card_type: GiftCardType::JAM_TRACKS_10)} describe "associations" do @@ -14,7 +14,7 @@ describe SaleLineItem do sale = Sale.create_jam_track_sale(user) shopping_cart = ShoppingCart.create(user, jam_track) sale_line_item = SaleLineItem.create_from_shopping_cart(sale, shopping_cart, 'some_recurly_uuid', nil, nil) - transaction = FactoryGirl.create(:recurly_transaction_web_hook, subscription_id: 'some_recurly_uuid') + transaction = FactoryBot.create(:recurly_transaction_web_hook, subscription_id: 'some_recurly_uuid') sale_line_item.reload sale_line_item.recurly_transactions.should eq([transaction]) @@ -28,7 +28,7 @@ describe SaleLineItem do sale = Sale.create_jam_track_sale(user) shopping_cart = ShoppingCart.create(user, jam_track) sale_line_item = SaleLineItem.create_from_shopping_cart(sale, shopping_cart, 'some_recurly_uuid', nil, nil) - transaction = FactoryGirl.create(:recurly_transaction_web_hook, subscription_id: 'some_recurly_uuid') + transaction = FactoryBot.create(:recurly_transaction_web_hook, subscription_id: 'some_recurly_uuid') sale_line_item.reload sale_line_item.state.should eq({ @@ -43,7 +43,7 @@ describe SaleLineItem do sale = Sale.create_jam_track_sale(user) shopping_cart = ShoppingCart.create(user, gift_card) sale_line_item = SaleLineItem.create_from_shopping_cart(sale, shopping_cart, 'some_recurly_uuid', nil, nil) - transaction = FactoryGirl.create(:recurly_transaction_web_hook, subscription_id: 'some_recurly_uuid') + transaction = FactoryBot.create(:recurly_transaction_web_hook, subscription_id: 'some_recurly_uuid') sale_line_item.reload sale_line_item.state.should eq({ diff --git a/ruby/spec/jam_ruby/models/sale_spec.rb b/ruby/spec/jam_ruby/models/sale_spec.rb index 5db4b304a..7fd52ca8a 100644 --- a/ruby/spec/jam_ruby/models/sale_spec.rb +++ b/ruby/spec/jam_ruby/models/sale_spec.rb @@ -2,14 +2,14 @@ require 'spec_helper' describe Sale do - let(:user) { FactoryGirl.create(:user) } - let(:user2) { FactoryGirl.create(:user) } - let(:jam_track) { FactoryGirl.create(:jam_track) } - let(:jam_track2) { FactoryGirl.create(:jam_track) } - let(:jam_track3) { FactoryGirl.create(:jam_track) } + let(:user) { FactoryBot.create(:user) } + let(:user2) { FactoryBot.create(:user) } + let(:jam_track) { FactoryBot.create(:jam_track) } + let(:jam_track2) { FactoryBot.create(:jam_track) } + let(:jam_track3) { FactoryBot.create(:jam_track) } let(:gift_card) { GiftCardType.jam_track_5 } - let(:posa_card) {FactoryGirl.create(:posa_card)} - let(:retailer) {FactoryGirl.create(:retailer)} + let(:posa_card) {FactoryBot.create(:posa_card)} + let(:retailer) {FactoryBot.create(:retailer)} after(:each) { Timecop.return @@ -101,11 +101,11 @@ describe Sale do describe "place_order" do - let(:user) { FactoryGirl.create(:user) } - let(:jamtrack) { FactoryGirl.create(:jam_track) } - let(:jamtrack2) { FactoryGirl.create(:jam_track) } - let(:jamtrack3) { FactoryGirl.create(:jam_track) } - let(:jamtrack4) { FactoryGirl.create(:jam_track) } + let(:user) { FactoryBot.create(:user) } + let(:jamtrack) { FactoryBot.create(:jam_track) } + let(:jamtrack2) { FactoryBot.create(:jam_track) } + let(:jamtrack3) { FactoryBot.create(:jam_track) } + let(:jamtrack4) { FactoryBot.create(:jam_track) } let(:jam_track_price_in_cents) { (jamtrack.price * 100).to_i } let(:gift_card_price_in_cents) { (gift_card.price * 100).to_i } let(:client) { RecurlyClient.new } @@ -375,7 +375,7 @@ describe Sale do end it "for a free jam track with an affiliate association" do - partner = FactoryGirl.create(:affiliate_partner) + partner = FactoryBot.create(:affiliate_partner) user.affiliate_referral = partner user.save! @@ -518,7 +518,7 @@ describe Sale do it "for a normally priced jam track with an affiliate association" do user.has_redeemable_jamtrack = false - partner = FactoryGirl.create(:affiliate_partner) + partner = FactoryBot.create(:affiliate_partner) user.affiliate_referral = partner user.save! shopping_cart = ShoppingCart.create user, jamtrack, 1, false @@ -660,16 +660,16 @@ describe Sale do pending "Lessons paused" } - let(:teacher_user) { FactoryGirl.create(:teacher_user) } + let(:teacher_user) { FactoryBot.create(:teacher_user) } let(:teacher) { teacher_user.teacher } - let(:lesson_booking_slot_single1) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_single2) { FactoryGirl.build(:lesson_booking_slot_single) } - let(:lesson_booking_slot_recurring1) { FactoryGirl.build(:lesson_booking_slot_recurring) } - let(:lesson_booking_slot_recurring2) { FactoryGirl.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_single1) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_single2) { FactoryBot.build(:lesson_booking_slot_single) } + let(:lesson_booking_slot_recurring1) { FactoryBot.build(:lesson_booking_slot_recurring) } + let(:lesson_booking_slot_recurring2) { FactoryBot.build(:lesson_booking_slot_recurring) } let(:valid_single_slots) { [lesson_booking_slot_single1, lesson_booking_slot_single2] } let(:valid_recurring_slots) { [lesson_booking_slot_recurring1, lesson_booking_slot_recurring2] } - let(:affiliate_partner) { FactoryGirl.create(:affiliate_partner) } - let(:affiliate_partner2) { FactoryGirl.create(:affiliate_partner, lesson_rate: 0.30) } + let(:affiliate_partner) { FactoryBot.create(:affiliate_partner) } + let(:affiliate_partner2) { FactoryBot.create(:affiliate_partner, lesson_rate: 0.30) } describe "single" do it "can succeed" do @@ -682,7 +682,7 @@ describe Sale do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -737,7 +737,7 @@ describe Sale do # teacher & student get into session start = lesson_session.scheduled_start end_time = lesson_session.scheduled_start + (60 * lesson_session.duration) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher_user, history: lesson_session.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson_session.music_session.session_removed_at = end_time lesson_session.music_session.save! @@ -950,8 +950,8 @@ describe Sale do describe "check_integrity_of_jam_track_sales" do - let(:user) { FactoryGirl.create(:user) } - let(:jam_track) { FactoryGirl.create(:jam_track) } + let(:user) { FactoryBot.create(:user) } + let(:jam_track) { FactoryBot.create(:jam_track) } it "empty" do check_integrity = Sale.check_integrity_of_jam_track_sales @@ -979,7 +979,7 @@ describe Sale do sale.save! shopping_cart = ShoppingCart.create(user, jam_track) SaleLineItem.create_from_shopping_cart(sale, shopping_cart, nil, 'some_recurly_invoice_id', nil) - FactoryGirl.create(:recurly_transaction_web_hook, transaction_type: RecurlyTransactionWebHook::VOID, invoice_id: 'some_recurly_invoice_id') + FactoryBot.create(:recurly_transaction_web_hook, transaction_type: RecurlyTransactionWebHook::VOID, invoice_id: 'some_recurly_invoice_id') check_integrity = Sale.check_integrity_of_jam_track_sales r = check_integrity[0] diff --git a/ruby/spec/jam_ruby/models/school_invitation_spec.rb b/ruby/spec/jam_ruby/models/school_invitation_spec.rb index b851d434f..bc2f60c82 100644 --- a/ruby/spec/jam_ruby/models/school_invitation_spec.rb +++ b/ruby/spec/jam_ruby/models/school_invitation_spec.rb @@ -2,10 +2,10 @@ require 'spec_helper' describe SchoolInvitation do - let(:school) {FactoryGirl.create(:school)} + let(:school) {FactoryBot.create(:school)} it "created by factory" do - FactoryGirl.create(:school_invitation) + FactoryBot.create(:school_invitation) end it "created by method" do @@ -16,15 +16,15 @@ describe SchoolInvitation do it "works" do SchoolInvitation.index(school, {as_teacher: true})[:query].count.should eql 0 - FactoryGirl.create(:school_invitation) + FactoryBot.create(:school_invitation) SchoolInvitation.index(school, {as_teacher: true})[:query].count.should eql 0 SchoolInvitation.index(school, {as_teacher: false})[:query].count.should eql 0 - FactoryGirl.create(:school_invitation, school: school, as_teacher: true) + FactoryBot.create(:school_invitation, school: school, as_teacher: true) SchoolInvitation.index(school, {as_teacher: true})[:query].count.should eql 1 SchoolInvitation.index(school, {as_teacher: false})[:query].count.should eql 0 - FactoryGirl.create(:school_invitation, school: school, as_teacher: false) + FactoryBot.create(:school_invitation, school: school, as_teacher: false) SchoolInvitation.index(school, {as_teacher: true})[:query].count.should eql 1 SchoolInvitation.index(school, {as_teacher: false})[:query].count.should eql 1 diff --git a/ruby/spec/jam_ruby/models/school_spec.rb b/ruby/spec/jam_ruby/models/school_spec.rb index 5b8940c81..986e9fad4 100644 --- a/ruby/spec/jam_ruby/models/school_spec.rb +++ b/ruby/spec/jam_ruby/models/school_spec.rb @@ -3,16 +3,16 @@ require 'spec_helper' describe School do it "created by factory" do - FactoryGirl.create(:school) + FactoryBot.create(:school) end it "has correct associations" do - school = FactoryGirl.create(:school) + school = FactoryBot.create(:school) school.should eql school.user.owned_school - student = FactoryGirl.create(:user, school: school) - teacher = FactoryGirl.create(:teacher, school: school) + student = FactoryBot.create(:user, school: school) + teacher = FactoryBot.create(:teacher, school: school) school.reload school.students.to_a.should eql [student] @@ -23,7 +23,7 @@ describe School do end it "updates" do - school = FactoryGirl.create(:school) + school = FactoryBot.create(:school) school.update_from_params({name: 'hahah', scheduling_communication: 'school', correspondence_email: 'bobby@jamkazam.com'}) school.errors.any?.should be_false end diff --git a/ruby/spec/jam_ruby/models/score_history_spec.rb b/ruby/spec/jam_ruby/models/score_history_spec.rb index 4fd1a6b47..93683b151 100644 --- a/ruby/spec/jam_ruby/models/score_history_spec.rb +++ b/ruby/spec/jam_ruby/models/score_history_spec.rb @@ -22,8 +22,8 @@ describe ScoreHistory do Country.count.should == 1 JamCompany.count.should == 4 - user1 = FactoryGirl.create(:user) - user2 = FactoryGirl.create(:user) + user1 = FactoryBot.create(:user) + user2 = FactoryBot.create(:user) score1, score2 = create_score(austin, dallas, { auserid: user1.id, buserid: user2.id } ) Score.count.should == 2 diff --git a/ruby/spec/jam_ruby/models/score_spec.rb b/ruby/spec/jam_ruby/models/score_spec.rb index b7daca9d7..9907f45d8 100644 --- a/ruby/spec/jam_ruby/models/score_spec.rb +++ b/ruby/spec/jam_ruby/models/score_spec.rb @@ -26,14 +26,14 @@ describe Score do ADDRF = 0x06070809 NODEF = 'fnodeid' - let(:user1) { FactoryGirl.create(:user, last_jam_locidispid: LOCA, last_jam_audio_latency: 13) } - let(:user2) { FactoryGirl.create(:user, last_jam_locidispid: LOCB, last_jam_audio_latency: 17) } + let(:user1) { FactoryBot.create(:user, last_jam_locidispid: LOCA, last_jam_audio_latency: 13) } + let(:user2) { FactoryBot.create(:user, last_jam_locidispid: LOCB, last_jam_audio_latency: 17) } let(:score_with_user) { s1, s2 = Score.createx(LOCA, NODEA, ADDRA, LOCB, NODEB, ADDRB, 20, nil, 'foo', { auserid: user1.id, buserid: user2.id }); s1 } let(:score_with_user_reversed) { s1, s2 = Score.createx(LOCB, NODEB, ADDRB, LOCA, NODEA, ADDRA, 22, nil, 'foo', { auserid: user2.id, buserid: user1.id }); s1 } - let(:latency_tester1) { FactoryGirl.create(:latency_tester) } - let(:latency_tester2) { FactoryGirl.create(:latency_tester) } + let(:latency_tester1) { FactoryBot.create(:latency_tester) } + let(:latency_tester2) { FactoryBot.create(:latency_tester) } let(:score_with_latency_tester) { s1, s2 = Score.createx(LOCA, NODEA, ADDRA, LOCB, NODEB, ADDRB, 20, nil, 'foo', { alatencytestid: latency_tester1.id, blatencytestid: latency_tester2.id}); s1 } @@ -132,12 +132,12 @@ describe Score do end it "test shortcut for making scores from connections" do - user1 = FactoryGirl.create(:user) - conn1 = FactoryGirl.create(:connection, user: user1, addr: ADDRD, locidispid: LOCD) - user2 = FactoryGirl.create(:user) - conn2 = FactoryGirl.create(:connection, user: user2, addr: ADDRE, locidispid: LOCE) - user3 = FactoryGirl.create(:user) - conn3 = FactoryGirl.create(:connection, user: user3, addr: ADDRF, locidispid: LOCF) + user1 = FactoryBot.create(:user) + conn1 = FactoryBot.create(:connection, user: user1, addr: ADDRD, locidispid: LOCD) + user2 = FactoryBot.create(:user) + conn2 = FactoryBot.create(:connection, user: user2, addr: ADDRE, locidispid: LOCE) + user3 = FactoryBot.create(:user) + conn3 = FactoryBot.create(:connection, user: user3, addr: ADDRF, locidispid: LOCF) Score.findx(LOCD, LOCE).should == -1 Score.findx(LOCE, LOCD).should == -1 @@ -425,8 +425,8 @@ describe Score do end # create two new users, in the same locations as user1 and user2, but with lower audio gear latency. - user3 = FactoryGirl.create(:user, last_jam_locidispid: user1.last_jam_locidispid, last_jam_audio_latency: 9) - user4 = FactoryGirl.create(:user, last_jam_locidispid: user2.last_jam_locidispid, last_jam_audio_latency: 15) + user3 = FactoryBot.create(:user, last_jam_locidispid: user1.last_jam_locidispid, last_jam_audio_latency: 9) + user4 = FactoryBot.create(:user, last_jam_locidispid: user2.last_jam_locidispid, last_jam_audio_latency: 15) result = Score.connection.execute('SELECT * FROM current_scores') # where scorer = 0 removed result.check diff --git a/ruby/spec/jam_ruby/models/search_spec.rb b/ruby/spec/jam_ruby/models/search_spec.rb index 21fbe8d42..fce6622f5 100644 --- a/ruby/spec/jam_ruby/models/search_spec.rb +++ b/ruby/spec/jam_ruby/models/search_spec.rb @@ -7,9 +7,9 @@ describe Search do def create_peachy_data - @user = FactoryGirl.create(:user, first_name: "Peach", last_name: "Pit", email: "user@example.com", musician: true, city: "Apex", state: "NC", country:"US") - @fan = FactoryGirl.create(:user, first_name: "Peach Peach", last_name: "Pit", email: "fan@example.com", musician: false, city: "Apex", state: "NC", country:"US") - @band = FactoryGirl.create(:band, name: "Peach pit", website: "www.bands.com", biography: "zomg we rock", city: "Apex", state: "NC", country:"US") + @user = FactoryBot.create(:user, first_name: "Peach", last_name: "Pit", email: "user@example.com", musician: true, city: "Apex", state: "NC", country:"US") + @fan = FactoryBot.create(:user, first_name: "Peach Peach", last_name: "Pit", email: "fan@example.com", musician: false, city: "Apex", state: "NC", country:"US") + @band = FactoryBot.create(:band, name: "Peach pit", website: "www.bands.com", biography: "zomg we rock", city: "Apex", state: "NC", country:"US") end def assert_peachy_data @@ -38,9 +38,9 @@ describe Search do # assert_peachy_data # end - let(:user1) { FactoryGirl.create(:user, :first_name => Faker::Name.first_name, :last_name => Faker::Name.last_name) } - let(:user2) { FactoryGirl.create(:user, :first_name => Faker::Name.first_name, :last_name => Faker::Name.last_name) } - let(:user3) { FactoryGirl.create(:user, :first_name => Faker::Name.first_name, :last_name => Faker::Name.last_name) } + let(:user1) { FactoryBot.create(:user, :first_name => Faker::Name.first_name, :last_name => Faker::Name.last_name) } + let(:user2) { FactoryBot.create(:user, :first_name => Faker::Name.first_name, :last_name => Faker::Name.last_name) } + let(:user3) { FactoryBot.create(:user, :first_name => Faker::Name.first_name, :last_name => Faker::Name.last_name) } it 'find autocomplete friend musicians' do Friendship.save_using_models(user1, user2) diff --git a/ruby/spec/jam_ruby/models/share_token_spec.rb b/ruby/spec/jam_ruby/models/share_token_spec.rb index 4163e1bdf..00251165d 100644 --- a/ruby/spec/jam_ruby/models/share_token_spec.rb +++ b/ruby/spec/jam_ruby/models/share_token_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' describe ShareToken do - let(:user) { FactoryGirl.create(:user) } - let(:music_session) {FactoryGirl.create(:active_music_session) } - let(:claimed_recording) {FactoryGirl.create(:claimed_recording) } + let(:user) { FactoryBot.create(:user) } + let(:music_session) {FactoryBot.create(:active_music_session) } + let(:claimed_recording) {FactoryBot.create(:claimed_recording) } before(:each) do ShareToken.delete_all diff --git a/ruby/spec/jam_ruby/models/shopping_cart_spec.rb b/ruby/spec/jam_ruby/models/shopping_cart_spec.rb index 7ac7911be..a3abcbf75 100644 --- a/ruby/spec/jam_ruby/models/shopping_cart_spec.rb +++ b/ruby/spec/jam_ruby/models/shopping_cart_spec.rb @@ -2,16 +2,16 @@ require 'spec_helper' describe ShoppingCart do - let(:user) { FactoryGirl.create(:user) } - let(:jam_track) { FactoryGirl.create(:jam_track) } - let(:jam_track2) { FactoryGirl.create(:jam_track) } - let(:jam_track3) { FactoryGirl.create(:jam_track) } - let(:jam_track4) { FactoryGirl.create(:jam_track) } - let(:jam_track5) { FactoryGirl.create(:jam_track) } - let(:jam_track6) { FactoryGirl.create(:jam_track) } - let(:jam_track7) { FactoryGirl.create(:jam_track) } - let(:gift_card) {FactoryGirl.create(:gift_card_type)} - let(:gift_card2) {FactoryGirl.create(:gift_card_type)} + let(:user) { FactoryBot.create(:user) } + let(:jam_track) { FactoryBot.create(:jam_track) } + let(:jam_track2) { FactoryBot.create(:jam_track) } + let(:jam_track3) { FactoryBot.create(:jam_track) } + let(:jam_track4) { FactoryBot.create(:jam_track) } + let(:jam_track5) { FactoryBot.create(:jam_track) } + let(:jam_track6) { FactoryBot.create(:jam_track) } + let(:jam_track7) { FactoryBot.create(:jam_track) } + let(:gift_card) {FactoryBot.create(:gift_card_type)} + let(:gift_card2) {FactoryBot.create(:gift_card_type)} before(:each) do ShoppingCart.delete_all diff --git a/ruby/spec/jam_ruby/models/teacher_distribution_spec.rb b/ruby/spec/jam_ruby/models/teacher_distribution_spec.rb index dbf54d562..a6d306228 100644 --- a/ruby/spec/jam_ruby/models/teacher_distribution_spec.rb +++ b/ruby/spec/jam_ruby/models/teacher_distribution_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe TeacherDistribution do - let(:teacher) {FactoryGirl.create(:teacher_user)} + let(:teacher) {FactoryBot.create(:teacher_user)} describe "index" do @@ -11,11 +11,11 @@ describe TeacherDistribution do end it "returns single" do - distribution = FactoryGirl.create(:teacher_distribution, teacher: teacher) + distribution = FactoryBot.create(:teacher_distribution, teacher: teacher) TeacherDistribution.index(teacher, {})[:query].count.should eql 1 - distribution = FactoryGirl.create(:teacher_distribution) # some random teacher + distribution = FactoryBot.create(:teacher_distribution) # some random teacher TeacherDistribution.index(teacher, {})[:query].count.should eql 1 end diff --git a/ruby/spec/jam_ruby/models/teacher_payment_spec.rb b/ruby/spec/jam_ruby/models/teacher_payment_spec.rb index 85f7d5a21..fce128c45 100644 --- a/ruby/spec/jam_ruby/models/teacher_payment_spec.rb +++ b/ruby/spec/jam_ruby/models/teacher_payment_spec.rb @@ -3,25 +3,25 @@ require 'spec_helper' describe TeacherPayment do - let(:user) { FactoryGirl.create(:user) } - let(:user2) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } + let(:user2) { FactoryBot.create(:user) } let(:teacher1_auth) { UserAuthorization.create(provider: 'stripe_connect', uid: stripe_account1_id, token: 'abc', refresh_token: 'abc', token_expiration: Date.today + 365, secret: 'secret') } let(:teacher2_auth) { UserAuthorization.create(provider: 'stripe_connect', uid: stripe_account2_id, token: 'abc', refresh_token: 'abc', token_expiration: Date.today + 365, secret: 'secret') } - let(:teacher) { FactoryGirl.create(:user) } - let(:teacher2) { FactoryGirl.create(:user) } - let(:teacher_obj) { FactoryGirl.create(:teacher, user: teacher) } - let(:teacher_obj2) { FactoryGirl.create(:teacher, user: teacher2) } + let(:teacher) { FactoryBot.create(:user) } + let(:teacher2) { FactoryBot.create(:user) } + let(:teacher_obj) { FactoryBot.create(:teacher, user: teacher) } + let(:teacher_obj2) { FactoryBot.create(:teacher, user: teacher2) } - let(:school_teacher) { FactoryGirl.create(:user) } - let(:school_owner_teacher) { FactoryGirl.create(:teacher, user: school_teacher) } + let(:school_teacher) { FactoryBot.create(:user) } + let(:school_owner_teacher) { FactoryBot.create(:teacher, user: school_teacher) } let(:test_drive_lesson) { testdrive_lesson(user, teacher) } let(:test_drive_lesson2) { testdrive_lesson(user2, teacher2) } - let(:test_drive_distribution) { FactoryGirl.create(:teacher_distribution, lesson_session: test_drive_lesson, teacher: teacher, teacher_payment: nil, ready: false) } - let(:test_drive_distribution2) { FactoryGirl.create(:teacher_distribution, lesson_session: test_drive_lesson2, teacher: teacher2, teacher_payment: nil, ready: false) } + let(:test_drive_distribution) { FactoryBot.create(:teacher_distribution, lesson_session: test_drive_lesson, teacher: teacher, teacher_payment: nil, ready: false) } + let(:test_drive_distribution2) { FactoryBot.create(:teacher_distribution, lesson_session: test_drive_lesson2, teacher: teacher2, teacher_payment: nil, ready: false) } let(:normal_lesson_session) { normal_lesson(user, teacher) } - let(:normal_distribution) { FactoryGirl.create(:teacher_distribution, lesson_session: normal_lesson_session, teacher: teacher, teacher_payment: nil, ready: false) } - let(:school) { FactoryGirl.create(:school, user: school_teacher) } + let(:normal_distribution) { FactoryBot.create(:teacher_distribution, lesson_session: normal_lesson_session, teacher: teacher, teacher_payment: nil, ready: false) } + let(:school) { FactoryBot.create(:school, user: school_teacher) } describe "pending_teacher_payments" do diff --git a/ruby/spec/jam_ruby/models/teacher_spec.rb b/ruby/spec/jam_ruby/models/teacher_spec.rb index 3a567d0d5..e1665b112 100644 --- a/ruby/spec/jam_ruby/models/teacher_spec.rb +++ b/ruby/spec/jam_ruby/models/teacher_spec.rb @@ -2,24 +2,24 @@ require 'spec_helper' describe Teacher do - let(:user) { FactoryGirl.create(:user) } - let(:genre1) { FactoryGirl.create(:genre) } - let(:genre2) { FactoryGirl.create(:genre) } - let(:subject1) { FactoryGirl.create(:subject) } - let(:subject2) { FactoryGirl.create(:subject) } - let(:language1) { FactoryGirl.create(:language) } - let(:language2) { FactoryGirl.create(:language) } - let(:instrument1) { FactoryGirl.create(:instrument, :description => 'a great instrument')} - let(:instrument2) { FactoryGirl.create(:instrument, :description => 'an ok instrument')} + let(:user) { FactoryBot.create(:user) } + let(:genre1) { FactoryBot.create(:genre) } + let(:genre2) { FactoryBot.create(:genre) } + let(:subject1) { FactoryBot.create(:subject) } + let(:subject2) { FactoryBot.create(:subject) } + let(:language1) { FactoryBot.create(:language) } + let(:language2) { FactoryBot.create(:language) } + let(:instrument1) { FactoryBot.create(:instrument, :description => 'a great instrument')} + let(:instrument2) { FactoryBot.create(:instrument, :description => 'an ok instrument')} describe "match_teacher" do it "works" do Teacher.match_teacher(user).should be_nil - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now) Teacher.match_teacher(user).should eql teacher - teacher2 = FactoryGirl.create(:teacher, ready_for_session_at: nil) + teacher2 = FactoryBot.create(:teacher, ready_for_session_at: nil) Teacher.match_teacher(user).should eql teacher teacher.ready_for_session_at = nil @@ -31,7 +31,7 @@ describe Teacher do end describe "index" do it "no params" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teachers = Teacher.index(nil)[:query] teachers.length.should eq 1 teachers[0].should eq(teacher.user) @@ -39,17 +39,17 @@ describe Teacher do it "sorting" do - teacher3 = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher3 = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teacher3.user.email = 'phantom+dogpound@jamkazam.com' teacher3.user.save! - teacher2 = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher2 = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teacher2.random_order = 1 teacher2.save! - teacher1 = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher1 = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teacher1.random_order = 2 teacher1.save! @@ -64,7 +64,7 @@ describe Teacher do query = Teacher.index(nil, {})[:query] query.count.should eql 0 - teacher3 = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher3 = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teacher3.teachers_instruments.count.should eql 0 teacher3.teachers_instruments << TeacherInstrument.new teacher3.teachers_instruments[0].teacher = teacher3 @@ -81,7 +81,7 @@ describe Teacher do it "instruments" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now) #teachers = Teacher.index(nil, {instruments: ['acoustic guitar']})[:query] #teachers.length.should eq 0 @@ -99,7 +99,7 @@ describe Teacher do end it "subjects" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teachers = Teacher.index(nil, {subjects: ['music-theory']})[:query] teachers.length.should eq 0 @@ -111,7 +111,7 @@ describe Teacher do end it "genres" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teachers = Teacher.index(nil, {genres: ['ambient']})[:query] teachers.length.should eq 0 @@ -124,7 +124,7 @@ describe Teacher do it "languages" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teachers = Teacher.index(nil, {languages: ['EN']})[:query] teachers.length.should eq 0 @@ -136,7 +136,7 @@ describe Teacher do end it "country" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teachers = Teacher.index(nil, {country: 'DO'})[:query] teachers.length.should eq 0 @@ -148,7 +148,7 @@ describe Teacher do end it "region" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teachers = Teacher.index(nil, {region: 'HE'})[:query] teachers.length.should eq 0 @@ -160,7 +160,7 @@ describe Teacher do end it "years_teaching" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now, years_teaching: 5) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now, years_teaching: 5) teachers = Teacher.index(nil, {years_teaching: 10})[:query] teachers.length.should eq 0 @@ -170,7 +170,7 @@ describe Teacher do end it "teaches beginner/intermediate/advanced" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teachers = Teacher.index(nil, {teaches_beginner: true})[:query] teachers.length.should eq 0 @@ -193,7 +193,7 @@ describe Teacher do end it "student_age" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now) teachers = Teacher.index(nil, {student_age: 5})[:query] teachers.length.should eq 1 @@ -245,8 +245,8 @@ describe Teacher do end it "student only sees guitar center teachers" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now, random_order: 1) - gc_teacher = FactoryGirl.create(:teacher, school: @gc_school, ready_for_session_at: Time.now, random_order: 2) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now, random_order: 1) + gc_teacher = FactoryBot.create(:teacher, school: @gc_school, ready_for_session_at: Time.now, random_order: 2) # TODO: perhaps GC teachers should not come back to non-GC users. Not sure yet. query = Teacher.index(user, {})[:query] @@ -317,7 +317,7 @@ describe Teacher do end it "basics" do - teacher_user = FactoryGirl.create(:teacher_user) + teacher_user = FactoryBot.create(:teacher_user) teacher = Teacher.save_teacher( teacher_user, instruments: [instrument1.id, instrument2.id], diff --git a/ruby/spec/jam_ruby/models/temp_token_spec.rb b/ruby/spec/jam_ruby/models/temp_token_spec.rb index 1a55ce67d..16e63b7e4 100644 --- a/ruby/spec/jam_ruby/models/temp_token_spec.rb +++ b/ruby/spec/jam_ruby/models/temp_token_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe TempToken do - let(:temp_token){ FactoryGirl.create(:temp_token) } + let(:temp_token){ FactoryBot.create(:temp_token) } it "generates token key" do expect(temp_token.token).not_to eq(nil) diff --git a/ruby/spec/jam_ruby/models/test_drive_package_choice_spec.rb b/ruby/spec/jam_ruby/models/test_drive_package_choice_spec.rb index 9e7eb4de4..5891e19b0 100644 --- a/ruby/spec/jam_ruby/models/test_drive_package_choice_spec.rb +++ b/ruby/spec/jam_ruby/models/test_drive_package_choice_spec.rb @@ -4,11 +4,11 @@ describe TestDrivePackageChoice do it "works" do - choice = FactoryGirl.create(:test_drive_package_choice) + choice = FactoryBot.create(:test_drive_package_choice) choice.test_drive_package.package_type.should eql '4' choice.test_drive_package.test_drive_package_teachers.count.should eql 4 - teacher_choice = FactoryGirl.create(:test_drive_package_choice_teacher, test_drive_package_choice: choice) + teacher_choice = FactoryBot.create(:test_drive_package_choice_teacher, test_drive_package_choice: choice) teacher_choice.test_drive_package_choice.should eql choice end end \ No newline at end of file diff --git a/ruby/spec/jam_ruby/models/text_message.spec.rb b/ruby/spec/jam_ruby/models/text_message.spec.rb index 7b612b3ac..ee3d4e17e 100644 --- a/ruby/spec/jam_ruby/models/text_message.spec.rb +++ b/ruby/spec/jam_ruby/models/text_message.spec.rb @@ -5,8 +5,8 @@ describe TextMessage do before do TextMessage.delete_all User.delete_all - @target_user = FactoryGirl.create(:user) - @source_user = FactoryGirl.create(:user) + @target_user = FactoryBot.create(:user) + @source_user = FactoryBot.create(:user) @msg = TextMessage.new(:target_user_id => @target_user.id, :source_user_id => @source_user.id) end diff --git a/ruby/spec/jam_ruby/models/track_spec.rb b/ruby/spec/jam_ruby/models/track_spec.rb index 4db0f59a5..0cc4d2237 100644 --- a/ruby/spec/jam_ruby/models/track_spec.rb +++ b/ruby/spec/jam_ruby/models/track_spec.rb @@ -2,13 +2,13 @@ require 'spec_helper' describe Track do - let (:user) {FactoryGirl.create(:user) } - let (:music_session) { FactoryGirl.create(:active_music_session, :creator => user)} - let (:connection) { FactoryGirl.create(:connection, :user => user, :music_session => music_session) } - let (:track) { FactoryGirl.create(:track, :connection => connection)} - let (:track2) { FactoryGirl.create(:track, :connection => connection)} - let (:backing_track) { FactoryGirl.create(:backing_track, :connection => connection)} - let (:msuh) {FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => user, :client_id => connection.client_id) } + let (:user) {FactoryBot.create(:user) } + let (:music_session) { FactoryBot.create(:active_music_session, :creator => user)} + let (:connection) { FactoryBot.create(:connection, :user => user, :music_session => music_session) } + let (:track) { FactoryBot.create(:track, :connection => connection)} + let (:track2) { FactoryBot.create(:track, :connection => connection)} + let (:backing_track) { FactoryBot.create(:backing_track, :connection => connection)} + let (:msuh) {FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => user, :client_id => connection.client_id) } let (:track_hash) { {:client_track_id => 'client_guid', :sound => 'stereo', :instrument_id => 'drums'} } let (:backing_track_hash) { {:client_track_id => 'client_guid', :filename => "blah.wav"} } diff --git a/ruby/spec/jam_ruby/models/user_asset_spec.rb b/ruby/spec/jam_ruby/models/user_asset_spec.rb index be44ab205..da8607ac0 100644 --- a/ruby/spec/jam_ruby/models/user_asset_spec.rb +++ b/ruby/spec/jam_ruby/models/user_asset_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' describe UserAsset do - let (:user) {FactoryGirl.create(:user) } - let (:user_asset){ FactoryGirl.create(:user_asset, asset_type: "image", filename: "my_image.jpg") } + let (:user) {FactoryBot.create(:user) } + let (:user_asset){ FactoryBot.create(:user_asset, asset_type: "image", filename: "my_image.jpg") } it "is invalid without filename" do expect(user_asset.valid?).to be(true) diff --git a/ruby/spec/jam_ruby/models/user_blacklist_spec.rb b/ruby/spec/jam_ruby/models/user_blacklist_spec.rb index 48668d123..b6a54d650 100644 --- a/ruby/spec/jam_ruby/models/user_blacklist_spec.rb +++ b/ruby/spec/jam_ruby/models/user_blacklist_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe UserBlacklist do - let(:user) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } describe "#banned" do it "returns false if no ban" do @@ -10,19 +10,19 @@ describe UserBlacklist do end it "returns true if banned" do - FactoryGirl.create(:user_blacklist, user: user) + FactoryBot.create(:user_blacklist, user: user) UserBlacklist.banned(user).should eq true end it "returns false if whitelisted" do - FactoryGirl.create(:user_whitelist, user: user) + FactoryBot.create(:user_whitelist, user: user) UserBlacklist.banned(user).should eq false end it "returns false if whitelisted and blacklisted too" do - FactoryGirl.create(:user_blacklist, user: user) - FactoryGirl.create(:user_whitelist, user: user) + FactoryBot.create(:user_blacklist, user: user) + FactoryBot.create(:user_whitelist, user: user) UserBlacklist.banned(user).should eq false end end diff --git a/ruby/spec/jam_ruby/models/user_location_spec.rb b/ruby/spec/jam_ruby/models/user_location_spec.rb index cac682d9d..cd4de39f3 100644 --- a/ruby/spec/jam_ruby/models/user_location_spec.rb +++ b/ruby/spec/jam_ruby/models/user_location_spec.rb @@ -10,8 +10,8 @@ X If no profile location is provided, and the user creates/joins a music session =end before do - # @geocode1 = FactoryGirl.create(:geocoder) - # @geocode2 = FactoryGirl.create(:geocoder) + # @geocode1 = FactoryBot.create(:geocoder) + # @geocode2 = FactoryBot.create(:geocoder) # @user = User.new(first_name: "Example", last_name: "User", email: "user@example.com", # password: "foobar", password_confirmation: "foobar", # city: "Apex", state: "NC", country: "US", diff --git a/ruby/spec/jam_ruby/models/user_search_spec.rb b/ruby/spec/jam_ruby/models/user_search_spec.rb index d9c70f743..33505d9d7 100644 --- a/ruby/spec/jam_ruby/models/user_search_spec.rb +++ b/ruby/spec/jam_ruby/models/user_search_spec.rb @@ -3,13 +3,13 @@ require 'spec_helper' describe User do before(:each) do - @user = FactoryGirl.create(:user, first_name: "Example", last_name: "User", email: "user@example.com", + @user = FactoryBot.create(:user, first_name: "Example", last_name: "User", email: "user@example.com", password: "foobar", password_confirmation: "foobar", musician: true, email_confirmed: true, city: "Apex", state: "NC", country: "US") end it "should allow search of one user" do - uu = FactoryGirl.create(:user, :musician => false) + uu = FactoryBot.create(:user, :musician => false) ws = Search.musician_search("Example User").results ws.length.should == 1 user_result = ws[0] @@ -21,7 +21,7 @@ describe User do end it "should allow search of one fan" do - uu = FactoryGirl.create(:user, :musician => false) + uu = FactoryBot.create(:user, :musician => false) ws = Search.fan_search(uu.name).results expect(ws.length).to be(1) expect(ws[0].id).to eq(uu.id) @@ -60,7 +60,7 @@ describe User do end it "should tokenize correctly" do - @user2 = FactoryGirl.create(:user, first_name: "peaches", last_name: "test", email: "peach@example.com", + @user2 = FactoryBot.create(:user, first_name: "peaches", last_name: "test", email: "peach@example.com", password: "foobar", password_confirmation: "foobar", musician: true, email_confirmed: true, city: "Apex", state: "NC", country: "US") ws = Search.musician_search("pea").results @@ -70,7 +70,7 @@ describe User do end it "users who have signed up, but not confirmed should show up in search index due to VRFS-378" do - @user3 = FactoryGirl.create(:user, first_name: "unconfirmed", last_name: "unconfirmed", email: "unconfirmed@example.com", + @user3 = FactoryBot.create(:user, first_name: "unconfirmed", last_name: "unconfirmed", email: "unconfirmed@example.com", password: "foobar", password_confirmation: "foobar", musician: true, email_confirmed: false, city: "Apex", state: "NC", country: "US") ws = Search.musician_search("unconfirmed").results diff --git a/ruby/spec/jam_ruby/models/user_spec.rb b/ruby/spec/jam_ruby/models/user_spec.rb index 3a0a37c1b..d3f1a9d0d 100644 --- a/ruby/spec/jam_ruby/models/user_spec.rb +++ b/ruby/spec/jam_ruby/models/user_spec.rb @@ -11,7 +11,7 @@ describe User do # password: "foobar", password_confirmation: "foobar", city: "Apex", state: "NC", country: "US", terms_of_service: true, musician: true) @user = User.new(first_name: "Example", last_name: "User", email: "user@example.com", password: "foobar", password_confirmation: "foobar", city: "Apex", state: "NC", country: "US", terms_of_service: true) - @user.musician_instruments << FactoryGirl.build(:musician_instrument, player: @user) + @user.musician_instruments << FactoryBot.build(:musician_instrument, player: @user) @recurly = RecurlyClient.new end @@ -480,7 +480,7 @@ describe User do end it "existing email of another user" do - another_user = FactoryGirl.create(:user) + another_user = FactoryBot.create(:user) @user.begin_update_email(another_user.email, "foobar", "http://www.jamkazam.com/confirm_email_update?token=") @user.errors[:update_email][0].should == ValidationMessages::EMAIL_ALREADY_TAKEN @@ -582,7 +582,7 @@ describe User do user: @user @user.save! - @user2 = FactoryGirl.create(:user) + @user2 = FactoryBot.create(:user) @user2.user_authorizations.build provider: 'facebook', uid: '1', token: '1', @@ -678,12 +678,12 @@ describe User do describe "recent history" do it "should only retrieve recordings with a claimed recording" do - user = FactoryGirl.create(:user) - claimed_recording = FactoryGirl.create(:claimed_recording, :user => user) + user = FactoryBot.create(:user) + claimed_recording = FactoryBot.create(:claimed_recording, :user => user) claimed_recording.recording.owner = user claimed_recording.recording.save! - recording = FactoryGirl.create(:recording, :owner => user) + recording = FactoryBot.create(:recording, :owner => user) Recording.where(:owner_id => user.id).size.should == 2 @@ -697,7 +697,7 @@ describe User do end it "should not retrieve excluded session" do - music_session = FactoryGirl.create(:music_session) + music_session = FactoryBot.create(:music_session) history = music_session.creator.recent_history(nil, nil) history.size.should == 1 @@ -707,7 +707,7 @@ describe User do end describe "age" do - let(:user) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } it "should calculate age based on birth_date" do user.birth_date = Time.now - 10.years @@ -722,7 +722,7 @@ describe User do end describe "mods_merge" do - let(:user) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } it "allow empty merge" do user.mod_merge({}) @@ -769,7 +769,7 @@ describe User do end describe "sync_stripe_customer" do - let(:user) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } let(:token1) { create_stripe_token } let(:token2) { create_stripe_token(2018) } @@ -804,13 +804,13 @@ describe User do end describe "can_buy_test_drive?" do - let(:user) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } after { Timecop.return } it "works" do user.can_buy_test_drive?.should be true - FactoryGirl.create(:test_drive_purchase, user: user) + FactoryBot.create(:test_drive_purchase, user: user) user.can_buy_test_drive?.should be false Timecop.freeze(Date.today + 366) user.can_buy_test_drive?.should be true @@ -823,8 +823,8 @@ describe User do pending "Lessons paused" } - let(:user) { FactoryGirl.create(:user) } - let(:teacher) { FactoryGirl.create(:teacher) } + let(:user) { FactoryBot.create(:user) } + let(:teacher) { FactoryBot.create(:teacher) } it "works" do user.has_rated_teacher(teacher).should eql false review = Review.create(target:teacher, rating:3, user: user) @@ -840,8 +840,8 @@ describe User do before { pending "Lessons paused" } - let(:user) { FactoryGirl.create(:user) } - let(:teacher) { FactoryGirl.create(:teacher_user) } + let(:user) { FactoryBot.create(:user) } + let(:teacher) { FactoryBot.create(:teacher_user) } it "works" do user.recent_test_drive_teachers.all.length.should eql 0 @@ -854,7 +854,7 @@ describe User do describe "update_name" do - let(:user) {FactoryGirl.create(:user)} + let(:user) {FactoryBot.create(:user)} it "typical 2 bits" do user.update_name("Seth Call") @@ -866,8 +866,8 @@ describe User do end describe "uncollectables" do - let(:user) {FactoryGirl.create(:user)} - let(:teacher) {FactoryGirl.create(:teacher_user)} + let(:user) {FactoryBot.create(:user)} + let(:teacher) {FactoryBot.create(:teacher_user)} before(:each) do pending "Lessons paused" @@ -929,11 +929,11 @@ describe User do end end describe "handle_test_drive_package" do - let(:user) {FactoryGirl.create(:user)} + let(:user) {FactoryBot.create(:user)} it "4-count" do package_size = 4 - package = FactoryGirl.create(:test_drive_package, :four_pack) + package = FactoryBot.create(:test_drive_package, :four_pack) detail = {} teachers = [] detail[:teachers] = teachers @@ -953,7 +953,7 @@ describe User do end end describe "onboarding_status" do - let(:user) {FactoryGirl.create(:user)} + let(:user) {FactoryBot.create(:user)} before(:each) {UserMailer.deliveries.clear} @@ -1009,7 +1009,7 @@ describe User do it "assigned" do user.send_onboarding_survey.should be_false - user.onboarder = FactoryGirl.create(:user, is_onboarder:true) + user.onboarder = FactoryBot.create(:user, is_onboarder:true) user.save! user.reload user.send_onboarding_survey.should be_false @@ -1019,7 +1019,7 @@ describe User do end describe "send_onboarding_surveys" do - let(:user) {FactoryGirl.create(:user)} + let(:user) {FactoryBot.create(:user)} it "works" do UserMailer.deliveries.clear @@ -1041,7 +1041,7 @@ describe User do describe "send_take_lesson_poke" do - let(:user) {FactoryGirl.create(:user)} + let(:user) {FactoryBot.create(:user)} before(:each) { UserMailer.deliveries.clear } @@ -1051,7 +1051,7 @@ describe User do it "works" do - teacher = FactoryGirl.create(:teacher, ready_for_session_at: Time.now) + teacher = FactoryBot.create(:teacher, ready_for_session_at: Time.now) User.send_take_lesson_poke UserMailer.deliveries.count.should eql 0 @@ -1062,7 +1062,7 @@ describe User do UserMailer.deliveries.count.should eql 0 UserMailer.deliveries.clear - posa_card = FactoryGirl.create(:amazon_test_drive_free_2) + posa_card = FactoryBot.create(:amazon_test_drive_free_2) posa_card.claim(user) User.send_take_lesson_poke @@ -1133,7 +1133,7 @@ describe User do end describe "permanently_delete" do - let(:user) {FactoryGirl.create(:user)} + let(:user) {FactoryBot.create(:user)} before(:each) { UserMailer.deliveries.clear } diff --git a/ruby/spec/jam_ruby/models/user_subscriptions_spec.rb b/ruby/spec/jam_ruby/models/user_subscriptions_spec.rb index c6f2e4a79..c1716f558 100644 --- a/ruby/spec/jam_ruby/models/user_subscriptions_spec.rb +++ b/ruby/spec/jam_ruby/models/user_subscriptions_spec.rb @@ -3,7 +3,7 @@ require 'webmock/rspec' describe "User Subscriptions" do - let(:user1) {FactoryGirl.create(:user)} + let(:user1) {FactoryBot.create(:user)} let(:client) { RecurlyClient.new } it "empty results" do @@ -73,9 +73,9 @@ end describe 'Subscription transactions sync' do let(:client) { RecurlyClient.new } - let(:affiliate_partner) { FactoryGirl.create(:affiliate_partner) } - let(:user) { FactoryGirl.create(:user, affiliate_referral: affiliate_partner) } - let(:user2) { FactoryGirl.create(:user, affiliate_referral: affiliate_partner) } + let(:affiliate_partner) { FactoryBot.create(:affiliate_partner) } + let(:user) { FactoryBot.create(:user, affiliate_referral: affiliate_partner) } + let(:user2) { FactoryBot.create(:user, affiliate_referral: affiliate_partner) } let(:transaction_response){ transaction_response_xml(user) } diff --git a/ruby/spec/jam_ruby/models/user_sync_spec.rb b/ruby/spec/jam_ruby/models/user_sync_spec.rb index b015e77f5..990fd36b0 100644 --- a/ruby/spec/jam_ruby/models/user_sync_spec.rb +++ b/ruby/spec/jam_ruby/models/user_sync_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe UserSync do - let(:user1) {FactoryGirl.create(:user)} - let(:user2) {FactoryGirl.create(:user)} + let(:user1) {FactoryBot.create(:user)} + let(:user2) {FactoryBot.create(:user)} before(:each) do @@ -23,10 +23,10 @@ describe UserSync do describe "backing_tracks" do let!(:recording1) { - recording = FactoryGirl.create(:recording, owner: user1, band: nil, duration:1) - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: recording.owner, fully_uploaded:false) - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: user2, fully_uploaded:false) - recording.recorded_backing_tracks << FactoryGirl.create(:recorded_backing_track, recording: recording, user: recording.owner, fully_uploaded:false) + recording = FactoryBot.create(:recording, owner: user1, band: nil, duration:1) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: recording.owner, fully_uploaded:false) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: user2, fully_uploaded:false) + recording.recorded_backing_tracks << FactoryBot.create(:recorded_backing_track, recording: recording, user: recording.owner, fully_uploaded:false) recording.save! recording.reload recording @@ -64,10 +64,10 @@ describe UserSync do end it "one mix and quick mix" do - mix = FactoryGirl.create(:mix) + mix = FactoryBot.create(:mix) mix.recording.duration = 1 mix.recording.save! - quick_mix = FactoryGirl.create(:quick_mix_completed, recording:mix.recording, user: mix.recording.recorded_tracks[0].user, autowire:false) + quick_mix = FactoryBot.create(:quick_mix_completed, recording:mix.recording, user: mix.recording.recorded_tracks[0].user, autowire:false) data = UserSync.index({user_id: mix.recording.recorded_tracks[0].user.id}) data[:next].should be_nil @@ -86,10 +86,10 @@ describe UserSync do # https://jamkazam.atlassian.net/browse/VRFS-2450 it "no longer returned after fully uploaded and unclaimed" do - mix = FactoryGirl.create(:mix) + mix = FactoryBot.create(:mix) mix.recording.duration = 1 mix.recording.save! - quick_mix = FactoryGirl.create(:quick_mix_completed, recording:mix.recording, user: mix.recording.recorded_tracks[0].user, autowire:false, fully_uploaded: true) + quick_mix = FactoryBot.create(:quick_mix_completed, recording:mix.recording, user: mix.recording.recorded_tracks[0].user, autowire:false, fully_uploaded: true) mix.recording.recorded_tracks[0].fully_uploaded = true mix.recording.recorded_tracks[0].save! mix.recording.claimed_recordings[0].discarded = true @@ -101,8 +101,8 @@ describe UserSync do end it "two mixes, one not belonging to querier" do - mix1 = FactoryGirl.create(:mix) - mix2 = FactoryGirl.create(:mix) + mix1 = FactoryBot.create(:mix) + mix2 = FactoryBot.create(:mix) mix1.recording.duration = 1 mix1.recording.save! mix2.recording.duration = 1 @@ -129,9 +129,9 @@ describe UserSync do describe "one recording with two users" do let!(:recording1) { - recording = FactoryGirl.create(:recording, owner: user1, band: nil, duration:1) - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: recording.owner, fully_uploaded:false) - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: user2, fully_uploaded:false) + recording = FactoryBot.create(:recording, owner: user1, band: nil, duration:1) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: recording.owner, fully_uploaded:false) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: user2, fully_uploaded:false) recording.save! recording.reload recording @@ -180,7 +180,7 @@ describe UserSync do end it "one user decides to keep the recording" do - claimed_recording = FactoryGirl.create(:claimed_recording, user: user1, recording: recording1, discarded:false) + claimed_recording = FactoryBot.create(:claimed_recording, user: user1, recording: recording1, discarded:false) claimed_recording.recording.should == recording1 data = UserSync.index({user_id: user1.id}) @@ -200,7 +200,7 @@ describe UserSync do it "one user decides to discard the recording" do - FactoryGirl.create(:claimed_recording, user: user1, recording: recording1, discarded:true) + FactoryBot.create(:claimed_recording, user: user1, recording: recording1, discarded:true) data = UserSync.index({user_id: user1.id}) data[:next].should be_nil @@ -235,11 +235,11 @@ describe UserSync do describe "one recording with multi-track users" do let!(:recording1) { - recording = FactoryGirl.create(:recording, owner: user1, band: nil, duration:1) - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: recording.owner, fully_uploaded:false) - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: recording.owner, fully_uploaded:false) - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: user2, fully_uploaded:false) - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: user2, fully_uploaded:false) + recording = FactoryBot.create(:recording, owner: user1, band: nil, duration:1) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: recording.owner, fully_uploaded:false) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: recording.owner, fully_uploaded:false) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: user2, fully_uploaded:false) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: user2, fully_uploaded:false) recording.save! recording.reload recording @@ -257,7 +257,7 @@ describe UserSync do it "one user decides to keep the recording" do - claimed_recording = FactoryGirl.create(:claimed_recording, user: user1, recording: recording1, discarded:false) + claimed_recording = FactoryBot.create(:claimed_recording, user: user1, recording: recording1, discarded:false) claimed_recording.recording.should == recording1 data = UserSync.index({user_id: user1.id}) @@ -284,10 +284,10 @@ describe UserSync do describe "pagination" do let!(:recording1) { - recording = FactoryGirl.create(:recording, owner: user1, band: nil, duration:1) - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: recording.owner) - recording.recorded_tracks << FactoryGirl.create(:recorded_track, recording: recording, user: user2) - claimed_recording = FactoryGirl.create(:claimed_recording, user: recording.owner, recording: recording, discarded:false) + recording = FactoryBot.create(:recording, owner: user1, band: nil, duration:1) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: recording.owner) + recording.recorded_tracks << FactoryBot.create(:recorded_track, recording: recording, user: user2) + claimed_recording = FactoryBot.create(:claimed_recording, user: recording.owner, recording: recording, discarded:false) recording.save! recording.reload recording @@ -337,10 +337,10 @@ describe UserSync do end it "does not return deleted recordings" do - mix = FactoryGirl.create(:mix) + mix = FactoryBot.create(:mix) mix.recording.duration = 1 mix.recording.save! - quick_mix = FactoryGirl.create(:quick_mix_completed, recording:mix.recording, user: mix.recording.recorded_tracks[0].user, autowire:false) + quick_mix = FactoryBot.create(:quick_mix_completed, recording:mix.recording, user: mix.recording.recorded_tracks[0].user, autowire:false) mix.recording.mark_delete data = UserSync.index({user_id: mix.recording.recorded_tracks[0].user.id}) @@ -352,8 +352,8 @@ describe UserSync do describe "deletable" do describe "one mix and one quick mix" do - let!(:mix) { m = FactoryGirl.create(:mix); m.recording.duration = 1; m.recording.save!; m} - let!(:quick_mix) { FactoryGirl.create(:quick_mix_completed, recording:mix.recording, user: mix.recording.recorded_tracks[0].user, autowire:false) } + let!(:mix) { m = FactoryBot.create(:mix); m.recording.duration = 1; m.recording.save!; m} + let!(:quick_mix) { FactoryBot.create(:quick_mix_completed, recording:mix.recording, user: mix.recording.recorded_tracks[0].user, autowire:false) } it "unknown id" do recording_ids = ['1'] @@ -405,11 +405,11 @@ describe UserSync do describe "two recordings" do - let!(:mix) { m = FactoryGirl.create(:mix); m.recording.duration = 1; m.recording.save!; m} - let!(:quick_mix) { FactoryGirl.create(:quick_mix_completed, recording:mix.recording, user: mix.recording.recorded_tracks[0].user, autowire:false) } + let!(:mix) { m = FactoryBot.create(:mix); m.recording.duration = 1; m.recording.save!; m} + let!(:quick_mix) { FactoryBot.create(:quick_mix_completed, recording:mix.recording, user: mix.recording.recorded_tracks[0].user, autowire:false) } - let!(:mix2) { m = FactoryGirl.create(:mix); m.recording.duration = 1; m.recording.save!; m} - let!(:quick_mix2) { FactoryGirl.create(:quick_mix_completed, recording:mix2.recording, user: mix2.recording.recorded_tracks[0].user, autowire:false) } + let!(:mix2) { m = FactoryBot.create(:mix); m.recording.duration = 1; m.recording.save!; m} + let!(:quick_mix2) { FactoryBot.create(:quick_mix_completed, recording:mix2.recording, user: mix2.recording.recorded_tracks[0].user, autowire:false) } before(:each) do # fix up the user associated with the second mix/recording to be same as 1st @@ -463,7 +463,7 @@ describe UserSync do it "resolved recordings" do # start with a recording with a fully uploaded recorded_track, and no claim - recording = FactoryGirl.create(:recording_with_track, owner: user1) + recording = FactoryBot.create(:recording_with_track, owner: user1) recording.duration = 1 recording.save! @@ -496,14 +496,14 @@ describe UserSync do # claim the recording, and make the track not fully uploaded recording.recorded_tracks[0].fully_uploaded = false recording.all_discarded = false - claim = FactoryGirl.create(:claimed_recording, user: user1, recording: recording) + claim = FactoryBot.create(:claimed_recording, user: user1, recording: recording) recording.save! result = UserSync.deletables(user_id: user1.id, recording_ids: recording_ids) result.should eq([]) # create a mix while still claiming the recording - mix = FactoryGirl.create(:mix, autowire:false, recording:recording) + mix = FactoryBot.create(:mix, autowire:false, recording:recording) result = UserSync.deletables(user_id: user1.id, recording_ids: recording_ids) result.should eq([]) @@ -518,7 +518,7 @@ describe UserSync do result.should eq(recording_ids) # if we make a quick mix, but still have no claim, we still should still need to delete the recording - quick_mix = FactoryGirl.create(:quick_mix, autowire:false, user: user1, recording: recording, fully_uploaded: true) + quick_mix = FactoryBot.create(:quick_mix, autowire:false, user: user1, recording: recording, fully_uploaded: true) result = UserSync.deletables(user_id: user1.id, recording_ids: recording_ids) result.should eq(recording_ids) diff --git a/ruby/spec/jam_ruby/models/video_source_spec.rb b/ruby/spec/jam_ruby/models/video_source_spec.rb index 166443c22..e48456d1a 100644 --- a/ruby/spec/jam_ruby/models/video_source_spec.rb +++ b/ruby/spec/jam_ruby/models/video_source_spec.rb @@ -2,10 +2,10 @@ require 'spec_helper' describe VideoSource do - let (:user) {FactoryGirl.create(:user) } - let (:music_session) { FactoryGirl.create(:active_music_session, :creator => user)} - let (:connection) { FactoryGirl.create(:connection, :user => user, :music_session => music_session) } - let (:msuh) {FactoryGirl.create(:music_session_user_history, :history => music_session.music_session, :user => user, :client_id => connection.client_id) } + let (:user) {FactoryBot.create(:user) } + let (:music_session) { FactoryBot.create(:active_music_session, :creator => user)} + let (:connection) { FactoryBot.create(:connection, :user => user, :music_session => music_session) } + let (:msuh) {FactoryBot.create(:music_session_user_history, :history => music_session.music_session, :user => user, :client_id => connection.client_id) } before(:each) do @@ -14,7 +14,7 @@ describe VideoSource do describe "simple create" do it "create a video source" do - video_source = FactoryGirl.create(:video_source, :connection => connection) + video_source = FactoryBot.create(:video_source, :connection => connection) video_source.should_not be_nil end end diff --git a/ruby/spec/jam_ruby/mq_router_spec.rb b/ruby/spec/jam_ruby/mq_router_spec.rb index 662f16d2e..f0b3f6511 100644 --- a/ruby/spec/jam_ruby/mq_router_spec.rb +++ b/ruby/spec/jam_ruby/mq_router_spec.rb @@ -8,13 +8,13 @@ describe MQRouter do it "user_publish_to_session works (but faking MQ)" do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1) + music_session = FactoryBot.create(:active_music_session, :creator => user1) - music_session_member1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") - music_session_member2 = FactoryGirl.create(:connection, :user => user2, :music_session => music_session, :ip_address => "2.2.2.2", :client_id => "2") + music_session_member1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") + music_session_member2 = FactoryBot.create(:connection, :user => user2, :music_session => music_session, :ip_address => "2.2.2.2", :client_id => "2") @mq_router.should_receive(:publish_to_session).with(music_session.id, [music_session_member2.client_id], "a message", :client_id => music_session_member1.client_id) @@ -36,13 +36,13 @@ describe MQRouter do it "user_publish_to_session works (checking exchange callbacks)" do - user1 = FactoryGirl.create(:user) # in the jam session - user2 = FactoryGirl.create(:user) # in the jam session + user1 = FactoryBot.create(:user) # in the jam session + user2 = FactoryBot.create(:user) # in the jam session - music_session = FactoryGirl.create(:active_music_session, :creator => user1) + music_session = FactoryBot.create(:active_music_session, :creator => user1) - music_session_member1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") - music_session_member2 = FactoryGirl.create(:connection, :user => user2, :music_session => music_session, :ip_address => "2.2.2.2", :client_id => "2") + music_session_member1 = FactoryBot.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1") + music_session_member2 = FactoryBot.create(:connection, :user => user2, :music_session => music_session, :ip_address => "2.2.2.2", :client_id => "2") # this is necessary because other tests will call EM.schedule indirectly as they fiddle with AR models, since some of our diff --git a/ruby/spec/jam_ruby/recurly_client_spec.rb b/ruby/spec/jam_ruby/recurly_client_spec.rb index a1e85ed92..c43e4b46d 100644 --- a/ruby/spec/jam_ruby/recurly_client_spec.rb +++ b/ruby/spec/jam_ruby/recurly_client_spec.rb @@ -1,17 +1,17 @@ require 'spec_helper' require "jam_ruby/recurly_client" describe RecurlyClient do - let(:jamtrack) { FactoryGirl.create(:jam_track, plan_code: 'jamtrack-acdc-backinblack') } + let(:jamtrack) { FactoryBot.create(:jam_track, plan_code: 'jamtrack-acdc-backinblack') } before :all do @client = RecurlyClient.new - @jamtrack = FactoryGirl.create(:jam_track, plan_code: 'jamtrack-acdc-backinblack') + @jamtrack = FactoryBot.create(:jam_track, plan_code: 'jamtrack-acdc-backinblack') end before(:each) do pending "We have to re-create the Jamkazam test environment in Recurly because it got deleted" - @user = FactoryGirl.create(:user) + @user = FactoryBot.create(:user) @billing_info = {} @billing_info[:first_name] = @user.first_name @billing_info[:last_name] = @user.last_name diff --git a/ruby/spec/jam_ruby/resque/active_music_session_cleaner_spec.rb b/ruby/spec/jam_ruby/resque/active_music_session_cleaner_spec.rb index 2b9196f6f..8bc41685c 100644 --- a/ruby/spec/jam_ruby/resque/active_music_session_cleaner_spec.rb +++ b/ruby/spec/jam_ruby/resque/active_music_session_cleaner_spec.rb @@ -12,7 +12,7 @@ describe "ActiveMusicSessionCleaner" do describe "active session cleaning" do it "should remove active sessions that meet criteria" do - ms = FactoryGirl.create(:single_user_session) + ms = FactoryBot.create(:single_user_session) ActiveMusicSession.all.count.should == 1 @cleaner.run diff --git a/ruby/spec/jam_ruby/resque/audiomixer_spec.rb b/ruby/spec/jam_ruby/resque/audiomixer_spec.rb index 9e26581de..8bb57de9a 100644 --- a/ruby/spec/jam_ruby/resque/audiomixer_spec.rb +++ b/ruby/spec/jam_ruby/resque/audiomixer_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'fileutils' -# these tests avoid the use of ActiveRecord and FactoryGirl to do blackbox, non test-instrumented tests +# these tests avoid the use of ActiveRecord and FactoryBot to do blackbox, non test-instrumented tests describe AudioMixer do include UsesTempFiles @@ -152,11 +152,11 @@ describe AudioMixer do before(:each) do content_for_file("ogg goodness") - @user = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @music_session = FactoryGirl.create(:active_music_session, :creator => @user, :musician_access => true) + @user = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @music_session = FactoryBot.create(:active_music_session, :creator => @user, :musician_access => true) # @music_session.connections << @connection @music_session.save @connection.join_the_session(@music_session, true, [@track], @user, 10) diff --git a/ruby/spec/jam_ruby/resque/google_analytics_event_spec.rb b/ruby/spec/jam_ruby/resque/google_analytics_event_spec.rb index 835916cc1..1dcfe6a68 100644 --- a/ruby/spec/jam_ruby/resque/google_analytics_event_spec.rb +++ b/ruby/spec/jam_ruby/resque/google_analytics_event_spec.rb @@ -12,9 +12,9 @@ describe GoogleAnalyticsEvent do it 'reports first recording' do pending "job is commented out" ResqueSpec.reset! - user = FactoryGirl.create(:user) - band = FactoryGirl.create(:band) - music_session = FactoryGirl.create(:active_music_session, + user = FactoryBot.create(:user) + band = FactoryBot.create(:band) + music_session = FactoryBot.create(:active_music_session, :creator => user, :musician_access => true, :band => band) @@ -30,20 +30,20 @@ describe GoogleAnalyticsEvent do pending "job is commented out" ResqueSpec.reset! JamRuby::GoogleAnalyticsEvent::BandSessionTracker.should have_schedule_size_of(0) - user = FactoryGirl.create(:user) - user1 = FactoryGirl.create(:user) - band = FactoryGirl.create(:band) + user = FactoryBot.create(:user) + user1 = FactoryBot.create(:user) + band = FactoryBot.create(:band) band.users << user band.users << user1 band.reload - music_session = FactoryGirl.create(:active_music_session, :creator => user, + music_session = FactoryBot.create(:active_music_session, :creator => user, :musician_access => true, :band => band) expect(band.band_musicians.count).to eq(2) expect(band.did_real_session).to eq(false) - connection = FactoryGirl.create(:connection, :user => user, :as_musician => true, + connection = FactoryBot.create(:connection, :user => user, :as_musician => true, :aasm_state => Connection::CONNECT_STATE.to_s, :music_session => music_session) - connection = FactoryGirl.create(:connection, :user => user1, :as_musician => true, + connection = FactoryBot.create(:connection, :user => user1, :as_musician => true, :aasm_state => Connection::CONNECT_STATE.to_s, :music_session => music_session) music_session.reload @@ -75,11 +75,11 @@ describe GoogleAnalyticsEvent do end it 'reports size increment' do pending "job is commented out" - user = FactoryGirl.create(:user) - music_session = FactoryGirl.create(:active_music_session, + user = FactoryBot.create(:user) + music_session = FactoryBot.create(:active_music_session, :creator => user, :musician_access => true) - connection = FactoryGirl.create(:connection, :user => user, + connection = FactoryBot.create(:connection, :user => user, :as_musician => true, :aasm_state => Connection::CONNECT_STATE.to_s, :music_session => music_session) @@ -90,9 +90,9 @@ describe GoogleAnalyticsEvent do it 'reports duration' do pending "job is commented out" - user = FactoryGirl.create(:user) + user = FactoryBot.create(:user) JamRuby::GoogleAnalyticsEvent::SessionDurationTracker.should have_schedule_size_of(0) - music_session = FactoryGirl.create(:active_music_session, + music_session = FactoryBot.create(:active_music_session, :creator => user, :musician_access => true) GoogleAnalyticsEvent::SessionDurationTracker.should have_schedule_size_of(1) diff --git a/ruby/spec/jam_ruby/resque/icecast_config_worker_spec.rb b/ruby/spec/jam_ruby/resque/icecast_config_worker_spec.rb index c93363a94..c46de0007 100644 --- a/ruby/spec/jam_ruby/resque/icecast_config_worker_spec.rb +++ b/ruby/spec/jam_ruby/resque/icecast_config_worker_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'fileutils' -# these tests avoid the use of ActiveRecord and FactoryGirl to do blackbox, non test-instrumented tests +# these tests avoid the use of ActiveRecord and FactoryBot to do blackbox, non test-instrumented tests describe IcecastConfigWriter do let(:worker) { IcecastConfigWriter.new } @@ -37,7 +37,7 @@ describe IcecastConfigWriter do describe "integration" do - let(:server) {FactoryGirl.create(:icecast_server_minimal, server_id: APP_CONFIG.icecast_server_id)} + let(:server) {FactoryBot.create(:icecast_server_minimal, server_id: APP_CONFIG.icecast_server_id)} describe "simulated" do @@ -87,7 +87,7 @@ describe IcecastConfigWriter do it "should not have been enqueued if routed to a different server_id" do pending 'icecast needs love' - new_server = FactoryGirl.create(:icecast_server_minimal, server_id: APP_CONFIG.icecast_server_id) + new_server = FactoryBot.create(:icecast_server_minimal, server_id: APP_CONFIG.icecast_server_id) with_resque do new_server.save! end diff --git a/ruby/spec/jam_ruby/resque/icecast_source_check_spec.rb b/ruby/spec/jam_ruby/resque/icecast_source_check_spec.rb index 83be6d612..f9a2ba22d 100644 --- a/ruby/spec/jam_ruby/resque/icecast_source_check_spec.rb +++ b/ruby/spec/jam_ruby/resque/icecast_source_check_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'fileutils' -# these tests avoid the use of ActiveRecord and FactoryGirl to do blackbox, non test-instrumented tests +# these tests avoid the use of ActiveRecord and FactoryBot to do blackbox, non test-instrumented tests describe IcecastSourceCheck do let(:check) { IcecastSourceCheck.new } @@ -16,38 +16,38 @@ describe IcecastSourceCheck do it "find a mounts if sourced_needs_changing_at is nil and listeners = 1/sourced = false" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, sourced: false, listeners: 1, sourced_needs_changing_at: nil) + mount = FactoryBot.create(:iceast_mount_with_music_session, sourced: false, listeners: 1, sourced_needs_changing_at: nil) check.should_receive(:handle_notifications).once check.run end it "find a mount if source_changed timestamp is nil and listeners = 0/sourced = true" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, sourced: true, listeners: 0, sourced_needs_changing_at: nil) + mount = FactoryBot.create(:iceast_mount_with_music_session, sourced: true, listeners: 0, sourced_needs_changing_at: nil) check.should_receive(:handle_notifications).once check.run end it "find no mounts if source_changed timestamp is nil and listeners = 0/sourced = true" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, sourced: true, listeners: 1) + mount = FactoryBot.create(:iceast_mount_with_music_session, sourced: true, listeners: 1) check.should_not_receive(:handle_notifications) check.run end it "find no mounts if source_changed timestamp is very recent and listeners = 1/sourced = false" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, sourced_needs_changing_at: Time.now, sourced: false, listeners: 1) + mount = FactoryBot.create(:iceast_mount_with_music_session, sourced_needs_changing_at: Time.now, sourced: false, listeners: 1) check.should_not_receive(:handle_notifications) check.run end it "find no mounts if source_changed timestamp is very recent and listeners = 0/sourced = true" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, sourced_needs_changing_at: Time.now, sourced: true, listeners: 0) + mount = FactoryBot.create(:iceast_mount_with_music_session, sourced_needs_changing_at: Time.now, sourced: true, listeners: 0) check.should_not_receive(:handle_notifications) check.run end it "sends notify_source_down_requested when old source_changed timestamp, and sourced = true and listeners = 0" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, sourced_needs_changing_at: 2.days.ago, sourced:true, listeners: 0) + mount = FactoryBot.create(:iceast_mount_with_music_session, sourced_needs_changing_at: 2.days.ago, sourced:true, listeners: 0) check.stub(:handle_notifications) do |mount| mount.should_receive(:notify_source_down_requested).once mount.should_not_receive(:notify_source_up_requested) @@ -60,7 +60,7 @@ describe IcecastSourceCheck do end it "does not send notify_source_down_requested when old source_changed timestamp, and sourced = true and listeners = 1" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, sourced_needs_changing_at: 2.days.ago, sourced:true, listeners: 1) + mount = FactoryBot.create(:iceast_mount_with_music_session, sourced_needs_changing_at: 2.days.ago, sourced:true, listeners: 1) check.stub(:handle_notifications) do |mount| mount.should_not_receive(:notify_source_down_requested) mount.should_not_receive(:notify_source_up_requested) @@ -73,7 +73,7 @@ describe IcecastSourceCheck do end it "sends notify_source_up_requested when old source_changed timestamp, and sourced = false and listeners = 1" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, sourced_needs_changing_at: 2.days.ago, sourced:false, listeners: 1) + mount = FactoryBot.create(:iceast_mount_with_music_session, sourced_needs_changing_at: 2.days.ago, sourced:false, listeners: 1) check.stub(:handle_notifications) do |mount| mount.should_not_receive(:notify_source_down_requested) mount.should_receive(:notify_source_up_requested).once @@ -87,7 +87,7 @@ describe IcecastSourceCheck do it "does not send notify_source_up_requested when old source_changed timestamp, and sourced = false and listeners = 0" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, sourced_needs_changing_at: 2.days.ago, sourced:false, listeners: 0) + mount = FactoryBot.create(:iceast_mount_with_music_session, sourced_needs_changing_at: 2.days.ago, sourced:false, listeners: 0) check.stub(:handle_notifications) do |mount| mount.should_not_receive(:notify_source_down_requested) mount.should_not_receive(:notify_source_up_requested) @@ -100,7 +100,7 @@ describe IcecastSourceCheck do end it "does not resets source_changed_at when a notification is sent out" do - mount = FactoryGirl.create(:iceast_mount_with_music_session, sourced_needs_changing_at: 2.days.ago, sourced:false, listeners: 1) + mount = FactoryBot.create(:iceast_mount_with_music_session, sourced_needs_changing_at: 2.days.ago, sourced:false, listeners: 1) check.stub(:handle_notifications) do |mount| mount.should_not_receive(:notify_source_down_requested) mount.should_receive(:notify_source_up_requested).once diff --git a/ruby/spec/jam_ruby/resque/jam_tracks_builder_spec.rb b/ruby/spec/jam_ruby/resque/jam_tracks_builder_spec.rb index 64a65c97c..a644b8758 100644 --- a/ruby/spec/jam_ruby/resque/jam_tracks_builder_spec.rb +++ b/ruby/spec/jam_ruby/resque/jam_tracks_builder_spec.rb @@ -5,8 +5,8 @@ describe JamTracksBuilder do include CarrierWave::Test::Matchers before (:all) do - @user = FactoryGirl.create(:user) - @jam_track = FactoryGirl.create(:jam_track) + @user = FactoryBot.create(:user) + @jam_track = FactoryBot.create(:jam_track) original_storage = JamTrackTrackUploader.storage = :fog original_storage = JamTrackRightUploader.storage = :fog @s3 = S3Manager.new(APP_CONFIG.aws_bucket, APP_CONFIG.aws_access_key_id, APP_CONFIG.aws_secret_access_key) @@ -24,8 +24,8 @@ describe JamTracksBuilder do it "should build" do ogg_path = File.join('spec', 'files', 'on.ogg') - user = FactoryGirl.create(:user) - jam_track_track = FactoryGirl.create(:jam_track_track) + user = FactoryBot.create(:user) + jam_track_track = FactoryBot.create(:jam_track_track) jam_track = jam_track_track.jam_track @s3.upload(jam_track_track.manually_uploaded_filename(:url_48), ogg_path) @@ -57,10 +57,10 @@ describe JamTracksBuilder do describe "with bitrate 44" do it "should build" do ogg_path = File.join('spec', 'files', 'on.ogg') - user = FactoryGirl.create(:user) + user = FactoryBot.create(:user) # Should build bitrate 44 and only bitrate 44: - jam_track_track = FactoryGirl.create(:jam_track_track) + jam_track_track = FactoryBot.create(:jam_track_track) jam_track = jam_track_track.jam_track # uploader = JamTrackTrackUploader.new(jam_track_track, :url_44) diff --git a/ruby/spec/jam_ruby/resque/jam_tracks_cleaner_spec.rb b/ruby/spec/jam_ruby/resque/jam_tracks_cleaner_spec.rb index 9f683c3e2..186253068 100644 --- a/ruby/spec/jam_ruby/resque/jam_tracks_cleaner_spec.rb +++ b/ruby/spec/jam_ruby/resque/jam_tracks_cleaner_spec.rb @@ -7,8 +7,8 @@ describe JamTracksCleaner do in_directory_with_file(RIGHT_NAME) before (:all) do - @user = FactoryGirl.create(:user) - @jam_track = FactoryGirl.create(:jam_track) + @user = FactoryBot.create(:user) + @jam_track = FactoryBot.create(:jam_track) original_storage = JamTrackRightUploader.storage = :fog end diff --git a/ruby/spec/jam_ruby/resque/music_session_reminder_spec.rb b/ruby/spec/jam_ruby/resque/music_session_reminder_spec.rb index 35c8ae845..603e898de 100644 --- a/ruby/spec/jam_ruby/resque/music_session_reminder_spec.rb +++ b/ruby/spec/jam_ruby/resque/music_session_reminder_spec.rb @@ -7,14 +7,14 @@ describe 'MusicSessionReminder' do MusicSession.delete_all User.delete_all - @receiver = FactoryGirl.create(:user) - @sender = FactoryGirl.create(:user) - @session = FactoryGirl.create(:music_session) + @receiver = FactoryBot.create(:user) + @sender = FactoryBot.create(:user) + @session = FactoryBot.create(:music_session) - @slot1 = FactoryGirl.build(:rsvp_slot, :music_session => @session, :instrument => JamRuby::Instrument.find('electric guitar')) + @slot1 = FactoryBot.build(:rsvp_slot, :music_session => @session, :instrument => JamRuby::Instrument.find('electric guitar')) @slot1.save - @slot2 = FactoryGirl.build(:rsvp_slot, :music_session => @session, :instrument => JamRuby::Instrument.find('drums')) + @slot2 = FactoryBot.build(:rsvp_slot, :music_session => @session, :instrument => JamRuby::Instrument.find('drums')) @slot2.save end @@ -57,7 +57,7 @@ describe 'MusicSessionReminder' do it "sends notice 5 minutes before" do UserMailer.deliveries.length.should == 0 - receiver_connection = FactoryGirl.create(:connection, user: @receiver) + receiver_connection = FactoryBot.create(:connection, user: @receiver) @receiver.reload rsvp = RsvpRequest.create({:session_id => @session.id, :rsvp_slots => [@slot1.id, @slot2.id], :message => "We be jammin!"}, @receiver) diff --git a/ruby/spec/jam_ruby/resque/music_session_scheduler_spec.rb b/ruby/spec/jam_ruby/resque/music_session_scheduler_spec.rb index 77a0b4265..bd4d479fd 100644 --- a/ruby/spec/jam_ruby/resque/music_session_scheduler_spec.rb +++ b/ruby/spec/jam_ruby/resque/music_session_scheduler_spec.rb @@ -10,7 +10,7 @@ describe "MusicSessionScheduler" do describe "session scheduling" do it "should reschedule sessions that meet criteria" do - ms = FactoryGirl.create(:recurring_music_session_weekly) + ms = FactoryBot.create(:recurring_music_session_weekly) ms.next_session_scheduled.should == false MusicSession.all.count.should == 1 @@ -33,7 +33,7 @@ describe "MusicSessionScheduler" do it "should not reschedule session that does not meet criteria" do # test non-recurring session - ms = FactoryGirl.create(:music_session) + ms = FactoryBot.create(:music_session) MusicSession.all.count.should == 1 @@ -47,7 +47,7 @@ describe "MusicSessionScheduler" do MusicSession.all.count.should == 1 # test canceled session - ms = FactoryGirl.create(:recurring_music_session_weekly) + ms = FactoryBot.create(:recurring_music_session_weekly) MusicSession.all.count.should == 2 ms.canceled = true @@ -57,7 +57,7 @@ describe "MusicSessionScheduler" do MusicSession.all.count.should == 2 # test already rescheduled - ms = FactoryGirl.create(:recurring_music_session_weekly) + ms = FactoryBot.create(:recurring_music_session_weekly) ms.next_session_scheduled = true ms.save! @@ -78,24 +78,24 @@ describe "MusicSessionScheduler" do User.delete_all # set up data - creator = FactoryGirl.create(:user) - responder1 = FactoryGirl.create(:user) - responder2 = FactoryGirl.create(:user) - responder3 = FactoryGirl.create(:user) - responder4 = FactoryGirl.create(:user) - responder5 = FactoryGirl.create(:user) + creator = FactoryBot.create(:user) + responder1 = FactoryBot.create(:user) + responder2 = FactoryBot.create(:user) + responder3 = FactoryBot.create(:user) + responder4 = FactoryBot.create(:user) + responder5 = FactoryBot.create(:user) - music_session = FactoryGirl.create(:music_session, :creator => creator) + music_session = FactoryBot.create(:music_session, :creator => creator) # do one more delete since the MusicSession factory creates a chosen RSVP slot RsvpRequestRsvpSlot.delete_all RsvpRequest.delete_all RsvpSlot.delete_all - slot1 = FactoryGirl.create(:rsvp_slot, :music_session => music_session, :instrument => JamRuby::Instrument.find('electric guitar')) - slot2 = FactoryGirl.create(:rsvp_slot, :music_session => music_session, :instrument => JamRuby::Instrument.find('drums')) - slot3 = FactoryGirl.create(:rsvp_slot, :music_session => music_session, :instrument => JamRuby::Instrument.find('bass guitar')) - slot4 = FactoryGirl.create(:rsvp_slot, :music_session => music_session, :instrument => JamRuby::Instrument.find('computer')) + slot1 = FactoryBot.create(:rsvp_slot, :music_session => music_session, :instrument => JamRuby::Instrument.find('electric guitar')) + slot2 = FactoryBot.create(:rsvp_slot, :music_session => music_session, :instrument => JamRuby::Instrument.find('drums')) + slot3 = FactoryBot.create(:rsvp_slot, :music_session => music_session, :instrument => JamRuby::Instrument.find('bass guitar')) + slot4 = FactoryBot.create(:rsvp_slot, :music_session => music_session, :instrument => JamRuby::Instrument.find('computer')) # create RSVPs rsvp1 = RsvpRequest.create({:session_id => music_session.id, :rsvp_slots => [slot1.id, slot2.id]}, responder1) diff --git a/ruby/spec/jam_ruby/resque/quick_mixer_spec.rb b/ruby/spec/jam_ruby/resque/quick_mixer_spec.rb index f7d877ef3..601345eea 100644 --- a/ruby/spec/jam_ruby/resque/quick_mixer_spec.rb +++ b/ruby/spec/jam_ruby/resque/quick_mixer_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' require 'fileutils' -# these tests avoid the use of ActiveRecord and FactoryGirl to do blackbox, non test-instrumented tests +# these tests avoid the use of ActiveRecord and FactoryBot to do blackbox, non test-instrumented tests describe AudioMixer do include UsesTempFiles - let(:quick_mix) { FactoryGirl.create(:quick_mix, started_at: nil, should_retry: false) } + let(:quick_mix) { FactoryBot.create(:quick_mix, started_at: nil, should_retry: false) } before(:each) do @@ -71,11 +71,11 @@ describe AudioMixer do before(:each) do content_for_file("ogg goodness") - @user = FactoryGirl.create(:user) - @connection = FactoryGirl.create(:connection, :user => @user) - @instrument = FactoryGirl.create(:instrument, :description => 'a great instrument') - @track = FactoryGirl.create(:track, :connection => @connection, :instrument => @instrument) - @music_session = FactoryGirl.create(:active_music_session, :creator => @user, :musician_access => true) + @user = FactoryBot.create(:user) + @connection = FactoryBot.create(:connection, :user => @user) + @instrument = FactoryBot.create(:instrument, :description => 'a great instrument') + @track = FactoryBot.create(:track, :connection => @connection, :instrument => @instrument) + @music_session = FactoryBot.create(:active_music_session, :creator => @user, :musician_access => true) # @music_session.connections << @connection @music_session.save @connection.join_the_session(@music_session, true, [@track], @user, 10) diff --git a/ruby/spec/jam_ruby/resque/scheduled_daily_job_spec.rb b/ruby/spec/jam_ruby/resque/scheduled_daily_job_spec.rb index b53fdbca5..87e1a4a39 100644 --- a/ruby/spec/jam_ruby/resque/scheduled_daily_job_spec.rb +++ b/ruby/spec/jam_ruby/resque/scheduled_daily_job_spec.rb @@ -5,7 +5,7 @@ describe 'DailyJob' do shared_examples_for :calendar_cleanup do |trigger_delete, end_count| before :each do Calendar.destroy_all - @creator = FactoryGirl.create(:user) + @creator = FactoryBot.create(:user) @creator.calendars << Calendar.new( :name=>"Test Cal", :description=>"This is a test", diff --git a/ruby/spec/jam_ruby/resque/scheduled_music_session_cleaner_spec.rb b/ruby/spec/jam_ruby/resque/scheduled_music_session_cleaner_spec.rb index 6d08c366e..731b47603 100644 --- a/ruby/spec/jam_ruby/resque/scheduled_music_session_cleaner_spec.rb +++ b/ruby/spec/jam_ruby/resque/scheduled_music_session_cleaner_spec.rb @@ -11,10 +11,10 @@ describe 'ScheduledMusicSessionCleaner' do MusicSession::UNSTARTED_INTERVAL_DAYS_PURGE_RECUR].each do |interval| dd = Time.now - (interval.to_i + 1).days Timecop.travel(dd) - FactoryGirl.create(:music_session, scheduled_start: dd) + FactoryBot.create(:music_session, scheduled_start: dd) Timecop.return end - msess2 = FactoryGirl.create(:music_session, scheduled_start: Time.now) + msess2 = FactoryBot.create(:music_session, scheduled_start: Time.now) expect(MusicSession.count).to be(3) JamRuby::ScheduledMusicSessionCleaner.perform diff --git a/ruby/spec/jam_ruby/resque/unused_music_notation_cleaner_spec.rb b/ruby/spec/jam_ruby/resque/unused_music_notation_cleaner_spec.rb index 1f0ff3e55..68af06a71 100644 --- a/ruby/spec/jam_ruby/resque/unused_music_notation_cleaner_spec.rb +++ b/ruby/spec/jam_ruby/resque/unused_music_notation_cleaner_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'fileutils' -# these tests avoid the use of ActiveRecord and FactoryGirl to do blackbox, non test-instrumented tests +# these tests avoid the use of ActiveRecord and FactoryBot to do blackbox, non test-instrumented tests describe UnusedMusicNotationCleaner do include UsesTempFiles @@ -33,7 +33,7 @@ describe UnusedMusicNotationCleaner do notation.file_url = File.open(UNUSED_NOTATION_TEMP_FILE) notation.size = 10 - notation.user = FactoryGirl.create(:user) + notation.user = FactoryBot.create(:user) notation.created_at = Time.now - 1.hours notation.save! @@ -42,12 +42,12 @@ describe UnusedMusicNotationCleaner do end it "find no music notataion if music_session_id is not nil and session_removed_at is in 1 hour" do - music_session = FactoryGirl.create(:music_session, :session_removed_at => Time.now - 1.hours) + music_session = FactoryBot.create(:music_session, :session_removed_at => Time.now - 1.hours) notation = MusicNotation.new notation.file_url = File.open(UNUSED_NOTATION_TEMP_FILE) notation.size = 10 - notation.user = FactoryGirl.create(:user) + notation.user = FactoryBot.create(:user) notation.created_at = Time.now - 1.hours notation.music_session = music_session notation.save! @@ -59,7 +59,7 @@ describe UnusedMusicNotationCleaner do notation = MusicNotation.new notation.file_url = File.open(UNUSED_NOTATION_TEMP_FILE) notation.size = 10 - notation.user = FactoryGirl.create(:user) + notation.user = FactoryBot.create(:user) notation.created_at = Time.now - 2.days notation.save! @@ -68,12 +68,12 @@ describe UnusedMusicNotationCleaner do end it "find music notataion if music_session_id is not nil and session_removed_at 2 days ago" do - music_session = FactoryGirl.create(:music_session, :session_removed_at => Time.now - 2.days) + music_session = FactoryBot.create(:music_session, :session_removed_at => Time.now - 2.days) notation = MusicNotation.new notation.file_url = File.open(UNUSED_NOTATION_TEMP_FILE) notation.size = 10 - notation.user = FactoryGirl.create(:user) + notation.user = FactoryBot.create(:user) notation.created_at = Time.now - 3.days notation.music_session = music_session notation.save! diff --git a/ruby/spec/mailers/render_emails_spec.rb b/ruby/spec/mailers/render_emails_spec.rb index 26e38c635..751655c07 100644 --- a/ruby/spec/mailers/render_emails_spec.rb +++ b/ruby/spec/mailers/render_emails_spec.rb @@ -6,8 +6,8 @@ require "spec_helper" describe "RenderMailers" do - let(:user) { FactoryGirl.create(:user) } - let(:school) {FactoryGirl.create(:school, education:true)} + let(:user) { FactoryBot.create(:user) } + let(:school) {FactoryBot.create(:school, education:true)} before(:each) do @filename = nil # set this on your test to pin the filename; i just make it the name of the mailer method responsible for sending the mail @@ -46,8 +46,8 @@ describe "RenderMailers" do end describe "has sending user" do - let(:user2) { FactoryGirl.create(:user) } - let(:friend_request) { FactoryGirl.create(:friend_request, user: user, friend: user2) } + let(:user2) { FactoryBot.create(:user) } + let(:friend_request) { FactoryBot.create(:friend_request, user: user, friend: user2) } it { @filename="text_message"; UserMailer.text_message(user, user2.id, user2.name, user2.resolved_photo_url, 'Get online!!').deliver_now } it { @filename="friend_request"; UserMailer.friend_request(user, 'So and so has sent you a friend request.', friend_request.id).deliver_now } @@ -81,8 +81,8 @@ describe "RenderMailers" do # end =begin describe "student/teacher" do - let(:teacher) { u = FactoryGirl.create(:teacher); u.user } - let(:user) { FactoryGirl.create(:user) } + let(:teacher) { u = FactoryBot.create(:teacher); u.user } + let(:user) { FactoryBot.create(:user) } it "teacher_welcome_message" do @filename = "teacher_welcome_message" @@ -170,9 +170,9 @@ describe "RenderMailers" do it "student_test_drive_done" do @filename = "student_test_drive_lesson_done" lesson = testdrive_lesson(user, teacher) - lesson = testdrive_lesson(user, FactoryGirl.create(:teacher_user)) - lesson = testdrive_lesson(user, FactoryGirl.create(:teacher_user)) - lesson = testdrive_lesson(user, FactoryGirl.create(:teacher_user)) + lesson = testdrive_lesson(user, FactoryBot.create(:teacher_user)) + lesson = testdrive_lesson(user, FactoryBot.create(:teacher_user)) + lesson = testdrive_lesson(user, FactoryBot.create(:teacher_user)) UserMailer.deliveries.clear UserMailer.student_test_drive_lesson_done(lesson).deliver_now @@ -224,7 +224,7 @@ describe "RenderMailers" do lesson = testdrive_lesson(user, teacher) UserMailer.deliveries.clear - notation = FactoryGirl.create(:music_notation, user: user) + notation = FactoryBot.create(:music_notation, user: user) UserMailer.lesson_attachment(user, teacher, lesson, notation).deliver_now end @@ -234,7 +234,7 @@ describe "RenderMailers" do lesson = testdrive_lesson(user, teacher) UserMailer.deliveries.clear - claim = FactoryGirl.create(:claimed_recording, user: user) + claim = FactoryBot.create(:claimed_recording, user: user) UserMailer.lesson_attachment(user, teacher, lesson, claim).deliver_now end @@ -391,17 +391,17 @@ describe "RenderMailers" do it "invite_school_teacher" do @filename = "invite_school_teacher" - UserMailer.invite_school_teacher(FactoryGirl.create(:school_invitation, as_teacher: true)).deliver_now + UserMailer.invite_school_teacher(FactoryBot.create(:school_invitation, as_teacher: true)).deliver_now end it "invite_school_student" do @filename = "invite_school_student" - UserMailer.invite_school_student(FactoryGirl.create(:school_invitation, as_teacher: false)).deliver_now + UserMailer.invite_school_student(FactoryBot.create(:school_invitation, as_teacher: false)).deliver_now end end describe "Retailer emails" do - let(:retailer) {FactoryGirl.create(:retailer)} + let(:retailer) {FactoryBot.create(:retailer)} before(:each) do UserMailer.deliveries.clear @@ -418,9 +418,9 @@ describe "RenderMailers" do describe "InvitedUserMailer emails" do - let(:user2) { FactoryGirl.create(:user) } - let(:invited_user) { FactoryGirl.create(:invited_user, :sender => user2) } - let(:admin_invited_user) { FactoryGirl.create(:invited_user) } + let(:user2) { FactoryBot.create(:user) } + let(:invited_user) { FactoryBot.create(:invited_user, :sender => user2) } + let(:admin_invited_user) { FactoryBot.create(:invited_user) } before(:each) do InvitedUserMailer.deliveries.clear @@ -439,8 +439,8 @@ describe "RenderMailers" do end describe "Poke Amazon Users" do - let(:teacher) { u = FactoryGirl.create(:teacher, biography: 'This is a really long biography for a really worthless human that does not deserve the first bit of trash. What? What was I saying. Oh yes, right. For years me takey-takey lessons and givey-givey lessons. But so what you say? beat it'); u.user } - let(:user) { FactoryGirl.create(:user) } + let(:teacher) { u = FactoryBot.create(:teacher, biography: 'This is a really long biography for a really worthless human that does not deserve the first bit of trash. What? What was I saying. Oh yes, right. For years me takey-takey lessons and givey-givey lessons. But so what you say? beat it'); u.user } + let(:user) { FactoryBot.create(:user) } before(:each) do UserMailer.deliveries.clear @@ -459,20 +459,20 @@ describe "RenderMailers" do end describe "Daily Scheduled Session emails" do - let (:scheduled_batch) { FactoryGirl.create(:email_batch_scheduled_session) } - let(:music_session) { FactoryGirl.create(:music_session) } - let (:drums) { FactoryGirl.create(:instrument, :description => 'drums') } - let (:guitar) { FactoryGirl.create(:instrument, :description => 'guitar') } - let (:bass) { FactoryGirl.create(:instrument, :description => 'bass') } - let (:vocals) { FactoryGirl.create(:instrument, :description => 'vocal') } + let (:scheduled_batch) { FactoryBot.create(:email_batch_scheduled_session) } + let(:music_session) { FactoryBot.create(:music_session) } + let (:drums) { FactoryBot.create(:instrument, :description => 'drums') } + let (:guitar) { FactoryBot.create(:instrument, :description => 'guitar') } + let (:bass) { FactoryBot.create(:instrument, :description => 'bass') } + let (:vocals) { FactoryBot.create(:instrument, :description => 'vocal') } - let (:drummer) { FactoryGirl.create(:user, :last_jam_locidispid => 1, :last_jam_addr => 1) } - let (:guitarist) { FactoryGirl.create(:user, :last_jam_locidispid => 1, :last_jam_addr => 1) } - let (:bassist) { FactoryGirl.create(:user, :last_jam_locidispid => 1, :last_jam_addr => 1) } - let (:vocalist) { FactoryGirl.create(:user, :last_jam_locidispid => 1, :last_jam_addr => 1) } + let (:drummer) { FactoryBot.create(:user, :last_jam_locidispid => 1, :last_jam_addr => 1) } + let (:guitarist) { FactoryBot.create(:user, :last_jam_locidispid => 1, :last_jam_addr => 1) } + let (:bassist) { FactoryBot.create(:user, :last_jam_locidispid => 1, :last_jam_addr => 1) } + let (:vocalist) { FactoryBot.create(:user, :last_jam_locidispid => 1, :last_jam_addr => 1) } let (:session1) do - FactoryGirl.create(:music_session, + FactoryBot.create(:music_session, :creator => drummer, :scheduled_start => Time.now() + 2.days, :musician_access => true, @@ -481,7 +481,7 @@ describe "RenderMailers" do end let (:session2) do - FactoryGirl.create(:music_session, + FactoryBot.create(:music_session, :creator => drummer, :scheduled_start => Time.now() + 2.days, :musician_access => true, @@ -493,21 +493,21 @@ describe "RenderMailers" do BatchMailer.deliveries.clear scheduled_batch.reset! - drummer.musician_instruments << FactoryGirl.build(:musician_instrument, player: drummer, instrument: drums, proficiency_level: 2) - drummer.musician_instruments << FactoryGirl.build(:musician_instrument, player: drummer, instrument: guitar, proficiency_level: 2) + drummer.musician_instruments << FactoryBot.build(:musician_instrument, player: drummer, instrument: drums, proficiency_level: 2) + drummer.musician_instruments << FactoryBot.build(:musician_instrument, player: drummer, instrument: guitar, proficiency_level: 2) - guitarist.musician_instruments << FactoryGirl.build(:musician_instrument, player: guitarist, instrument: guitar, proficiency_level: 2) - guitarist.musician_instruments << FactoryGirl.build(:musician_instrument, player: guitarist, instrument: bass, proficiency_level: 2) + guitarist.musician_instruments << FactoryBot.build(:musician_instrument, player: guitarist, instrument: guitar, proficiency_level: 2) + guitarist.musician_instruments << FactoryBot.build(:musician_instrument, player: guitarist, instrument: bass, proficiency_level: 2) - vocalist.musician_instruments << FactoryGirl.build(:musician_instrument, player: vocalist, instrument: vocals, proficiency_level: 2) + vocalist.musician_instruments << FactoryBot.build(:musician_instrument, player: vocalist, instrument: vocals, proficiency_level: 2) - FactoryGirl.create(:rsvp_slot, :instrument => drums, :music_session => session1) - FactoryGirl.create(:rsvp_slot, :instrument => guitar, :music_session => session1) - FactoryGirl.create(:rsvp_slot, :instrument => bass, :music_session => session1) + FactoryBot.create(:rsvp_slot, :instrument => drums, :music_session => session1) + FactoryBot.create(:rsvp_slot, :instrument => guitar, :music_session => session1) + FactoryBot.create(:rsvp_slot, :instrument => bass, :music_session => session1) - FactoryGirl.create(:rsvp_slot, :instrument => drums, :music_session => session2) - FactoryGirl.create(:rsvp_slot, :instrument => guitar, :music_session => session2) - FactoryGirl.create(:rsvp_slot, :instrument => bass, :music_session => session2) + FactoryBot.create(:rsvp_slot, :instrument => drums, :music_session => session2) + FactoryBot.create(:rsvp_slot, :instrument => guitar, :music_session => session2) + FactoryBot.create(:rsvp_slot, :instrument => bass, :music_session => session2) JamRuby::Score.createx(1, 'a', 1, 1, 'a', 1, 10) JamRuby::Score.createx(1, 'a', 1, 2, 'a', 2, Score::MAX_YELLOW_LATENCY + 1) @@ -525,9 +525,9 @@ describe "RenderMailers" do end describe "New Musician Match email", focus: true do - let(:user) { FactoryGirl.create(:user) } - let(:user1) { FactoryGirl.create(:user, first_name: 'David', last_name: 'Macmillan', updated_at: 2.day.ago.to_i) } - let(:user2) { FactoryGirl.create(:user, first_name: 'Tom', last_name: 'Cluff', last_jam_updated_at: 1.days.ago.to_i) } + let(:user) { FactoryBot.create(:user) } + let(:user1) { FactoryBot.create(:user, first_name: 'David', last_name: 'Macmillan', updated_at: 2.day.ago.to_i) } + let(:user2) { FactoryBot.create(:user, first_name: 'Tom', last_name: 'Cluff', last_jam_updated_at: 1.days.ago.to_i) } let(:matched_musician_data){ [ { diff --git a/ruby/spec/mailers/teacher_lesson_email_spec.rb b/ruby/spec/mailers/teacher_lesson_email_spec.rb index 0c8deea74..064077b4e 100644 --- a/ruby/spec/mailers/teacher_lesson_email_spec.rb +++ b/ruby/spec/mailers/teacher_lesson_email_spec.rb @@ -48,8 +48,8 @@ describe "TeacherLessonEmails" do # lessons with no school affiliation describe "no-school" do - let(:user) { FactoryGirl.create(:user) } - let(:teacher) { FactoryGirl.create(:teacher_user) } + let(:user) { FactoryBot.create(:user) } + let(:teacher) { FactoryBot.create(:teacher_user) } let(:lesson) { normal_lesson(user, teacher) } let(:mail) { UserMailer.deliveries[-1] } @@ -114,13 +114,13 @@ describe "TeacherLessonEmails" do end it "teacher_distribution_done" do - teacher_payment = FactoryGirl.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryGirl.create(:teacher_distribution, lesson_session: lesson)) + teacher_payment = FactoryBot.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryBot.create(:teacher_distribution, lesson_session: lesson)) UserMailer.teacher_distribution_done(teacher_payment).deliver_now school_over_teacher end it "teacher_distribution_fail" do - teacher_payment = FactoryGirl.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryGirl.create(:teacher_distribution, lesson_session: lesson)) + teacher_payment = FactoryBot.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryBot.create(:teacher_distribution, lesson_session: lesson)) UserMailer.teacher_distribution_fail(teacher_payment).deliver_now school_over_teacher end @@ -158,10 +158,10 @@ describe "TeacherLessonEmails" do before(:each) { @schoolDirectComm = true } - let(:school) { FactoryGirl.create(:school, scheduling_communication: School::SCHEDULING_COMM_TEACHER) } - let(:user) { FactoryGirl.create(:user) } - let(:teacher_obj) { FactoryGirl.create(:teacher, school: school) } - let(:teacher) { FactoryGirl.create(:user, teacher: teacher_obj) } + let(:school) { FactoryBot.create(:school, scheduling_communication: School::SCHEDULING_COMM_TEACHER) } + let(:user) { FactoryBot.create(:user) } + let(:teacher_obj) { FactoryBot.create(:teacher, school: school) } + let(:teacher) { FactoryBot.create(:user, teacher: teacher_obj) } let(:lesson) { normal_lesson(user, teacher) } let(:mail) { UserMailer.deliveries[-1] } @@ -223,13 +223,13 @@ describe "TeacherLessonEmails" do end it "teacher_distribution_done" do - teacher_payment = FactoryGirl.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryGirl.create(:teacher_distribution, lesson_session: lesson)) + teacher_payment = FactoryBot.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryBot.create(:teacher_distribution, lesson_session: lesson)) UserMailer.teacher_distribution_done(teacher_payment).deliver_now school_over_teacher end it "teacher_distribution_fail" do - teacher_payment = FactoryGirl.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryGirl.create(:teacher_distribution, lesson_session: lesson)) + teacher_payment = FactoryBot.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryBot.create(:teacher_distribution, lesson_session: lesson)) UserMailer.teacher_distribution_fail(teacher_payment).deliver_now school_over_teacher end @@ -268,10 +268,10 @@ describe "TeacherLessonEmails" do before(:each) { @schoolSchedulingComm = true } - let(:school) { FactoryGirl.create(:school, scheduling_communication: School::SCHEDULING_COMM_SCHOOL) } - let(:user) { FactoryGirl.create(:user) } - let(:teacher_obj) { FactoryGirl.create(:teacher, school: school) } - let(:teacher) { FactoryGirl.create(:user, teacher: teacher_obj) } + let(:school) { FactoryBot.create(:school, scheduling_communication: School::SCHEDULING_COMM_SCHOOL) } + let(:user) { FactoryBot.create(:user) } + let(:teacher_obj) { FactoryBot.create(:teacher, school: school) } + let(:teacher) { FactoryBot.create(:user, teacher: teacher_obj) } let(:lesson) { normal_lesson(user, teacher) } let(:mail) { UserMailer.deliveries[-1] } @@ -332,13 +332,13 @@ describe "TeacherLessonEmails" do end it "teacher_distribution_done" do - teacher_payment = FactoryGirl.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryGirl.create(:teacher_distribution, lesson_session: lesson)) + teacher_payment = FactoryBot.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryBot.create(:teacher_distribution, lesson_session: lesson)) UserMailer.teacher_distribution_done(teacher_payment).deliver_now school_over_teacher end it "teacher_distribution_fail" do - teacher_payment = FactoryGirl.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryGirl.create(:teacher_distribution, lesson_session: lesson)) + teacher_payment = FactoryBot.create(:teacher_payment, teacher: teacher, teacher_distribution: FactoryBot.create(:teacher_distribution, lesson_session: lesson)) UserMailer.teacher_distribution_fail(teacher_payment).deliver_now school_over_teacher end diff --git a/ruby/spec/mailers/user_mailer_spec.rb b/ruby/spec/mailers/user_mailer_spec.rb index 1e8c4888c..d539fb65a 100644 --- a/ruby/spec/mailers/user_mailer_spec.rb +++ b/ruby/spec/mailers/user_mailer_spec.rb @@ -9,7 +9,7 @@ require "spec_helper" describe UserMailer do - let(:user) { FactoryGirl.create(:user) } + let(:user) { FactoryBot.create(:user) } before(:each) do #stub_const("APP_CONFIG", app_config) @@ -142,7 +142,7 @@ describe UserMailer do describe "notifications" do let(:mail) { UserMailer.deliveries[0] } - let(:music_session) { FactoryGirl.create(:music_session) } + let(:music_session) { FactoryBot.create(:music_session) } it "should send upcoming email" do user.update_email = "my_new_email@jamkazam.com" diff --git a/ruby/spec/spec_helper.rb b/ruby/spec/spec_helper.rb index 113b3dc75..fe92ac438 100644 --- a/ruby/spec/spec_helper.rb +++ b/ruby/spec/spec_helper.rb @@ -26,13 +26,15 @@ JamRuby::TestSupport.recreate_database if ENV['SKIP_DB_PREP'].nil? # initialize ActiveRecord's db connection ActiveRecord::Base.establish_connection(YAML::load(File.open('config/database.yml'))["test"]) -ActiveRecord::Base.raise_in_transactional_callbacks = true + + # ActiveRecord::Base.raise_in_transactional_callbacks = true + # so jam_ruby models that use APP_CONFIG in metadata will load. this is later stubbed pre test run APP_CONFIG = app_config require 'jam_ruby' -require 'factory_girl' +require 'factory_bot' require 'rubygems' require 'spork' require 'database_cleaner' @@ -47,12 +49,12 @@ require 'resque_spec/scheduler' include JamRuby # manually register observers -ActiveRecord::Base.add_observer InvitedUserObserver.instance -ActiveRecord::Base.add_observer UserObserver.instance -ActiveRecord::Base.add_observer FeedbackObserver.instance -ActiveRecord::Base.add_observer RecordedTrackObserver.instance -ActiveRecord::Base.add_observer RecordedBackingTrackObserver.instance -ActiveRecord::Base.add_observer QuickMixObserver.instance +# ActiveRecord::Base.add_observer InvitedUserObserver.instance +# ActiveRecord::Base.add_observer UserObserver.instance +# ActiveRecord::Base.add_observer FeedbackObserver.instance +# ActiveRecord::Base.add_observer RecordedTrackObserver.instance +# ActiveRecord::Base.add_observer RecordedBackingTrackObserver.instance +# ActiveRecord::Base.add_observer QuickMixObserver.instance #RecordedTrack.observers.disable :all # only a few tests want this observer active @@ -65,13 +67,13 @@ CarrierWave.configure do |config| config.enable_processing = false end -Stripe.api_key = "sk_test_OkjoIF7FmdjunyNsdVqJD02D" +# Stripe.api_key = "sk_test_OkjoIF7FmdjunyNsdVqJD02D" -Recurly::API.net_http = { - ssl_version: :TLSv1_2, - #... -} +# Recurly::API.net_http = { +# ssl_version: :TLSv1_2, +# #... +# } #uncomment the following line to use spork with the debugger #require 'spork/ext/ruby-debug' @@ -83,7 +85,6 @@ Recurly::API.net_http = { # This file is copied to spec/ when you run 'rails generate rspec:install' #ENV["RAILS_ENV"] ||= 'test' #require File.expand_path("../../config/environment", __FILE__) - require 'rspec/autorun' #require 'rspec/rails' # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. @@ -93,8 +94,8 @@ Recurly::API.net_http = { # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| - config.color_enabled = true - config.treat_symbols_as_metadata_keys_with_true_values = true + config.color = true + # config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus diff --git a/ruby/spec/support/lesson_session.rb b/ruby/spec/support/lesson_session.rb index 745940b50..3cbf77595 100644 --- a/ruby/spec/support/lesson_session.rb +++ b/ruby/spec/support/lesson_session.rb @@ -20,11 +20,11 @@ def book_lesson(user, teacher, options) if options[:slots].nil? slots = [] if options[:monthly] - slots << FactoryGirl.build(:lesson_booking_slot_recurring) - slots << FactoryGirl.build(:lesson_booking_slot_recurring) + slots << FactoryBot.build(:lesson_booking_slot_recurring) + slots << FactoryBot.build(:lesson_booking_slot_recurring) else - slots << FactoryGirl.build(:lesson_booking_slot_single) - slots << FactoryGirl.build(:lesson_booking_slot_single) + slots << FactoryBot.build(:lesson_booking_slot_single) + slots << FactoryBot.build(:lesson_booking_slot_single) end else @@ -71,9 +71,9 @@ def book_lesson(user, teacher, options) if options[:counter] if options[:monthly] - counter_slot = FactoryGirl.build(:lesson_booking_slot_recurring) + counter_slot = FactoryBot.build(:lesson_booking_slot_recurring) else - counter_slot = FactoryGirl.build(:lesson_booking_slot_single) + counter_slot = FactoryBot.build(:lesson_booking_slot_single) end lesson.counter({proposer: options[:counterer] || user, message: "countered YEAH!", slot: counter_slot}) @@ -102,7 +102,7 @@ def book_lesson(user, teacher, options) lesson.analyse lesson.session_completed elsif options[:teacher_miss] - uh2 = FactoryGirl.create(:music_session_user_history, user: user, history: lesson.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: user, history: lesson.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson.music_session.session_removed_at = end_time lesson.music_session.save! @@ -110,8 +110,8 @@ def book_lesson(user, teacher, options) lesson.analyse lesson.session_completed elsif options[:success] - uh1 = FactoryGirl.create(:music_session_user_history, user: user, history: lesson.music_session, created_at: start, session_removed_at: end_time) - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher, history: lesson.music_session, created_at: start, session_removed_at: end_time) + uh1 = FactoryBot.create(:music_session_user_history, user: user, history: lesson.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher, history: lesson.music_session, created_at: start, session_removed_at: end_time) # artificially end the session, which is covered by other background jobs lesson.music_session.session_removed_at = end_time lesson.music_session.save! @@ -124,9 +124,9 @@ def book_lesson(user, teacher, options) elsif options[:finish] # teacher & student get into session - uh2 = FactoryGirl.create(:music_session_user_history, user: teacher, history: lesson.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: teacher, history: lesson.music_session, created_at: start, session_removed_at: end_time) if options[:student_show] - uh2 = FactoryGirl.create(:music_session_user_history, user: user, history: lesson.music_session, created_at: start, session_removed_at: end_time) + uh2 = FactoryBot.create(:music_session_user_history, user: user, history: lesson.music_session, created_at: start, session_removed_at: end_time) end # artificially end the session, which is covered by other background jobs lesson.music_session.session_removed_at = end_time diff --git a/ruby/spec/support/utilities.rb b/ruby/spec/support/utilities.rb index f9f3025b9..a3521bdc3 100644 --- a/ruby/spec/support/utilities.rb +++ b/ruby/spec/support/utilities.rb @@ -1,3 +1,4 @@ +require "ostruct" JAMKAZAM_TESTING_BUCKET = 'jamkazam-testing' # cuz i'm not comfortable using aws_bucket accessor directly def app_config @@ -50,6 +51,10 @@ def app_config 'nobody@jamkazam.com' end + def action_mailer + OpenStruct.new(asset_host: 'http://localhost:3000') + end + def aws_bucket JAMKAZAM_TESTING_BUCKET end @@ -422,8 +427,8 @@ def fake_geo_124_zip(geoisp_csv) end def friend(user1, user2) - FactoryGirl.create(:friendship, user: user1, friend: user2) - FactoryGirl.create(:friendship, user: user2, friend: user1) + FactoryBot.create(:friendship, user: user1, friend: user2) + FactoryBot.create(:friendship, user: user2, friend: user1) end def stripe_oauth_client @@ -476,3 +481,12 @@ def create_stripe_token(exp_month = 2019) }, ).id end + +module ApplicationHelper + def self.spa_base_uri + 'http://localhost:3000' + end + def self.base_uri(request) + 'http://localhost:3000' + end +end diff --git a/upgrade-plan/GEM_AUDIT.md b/upgrade-plan/GEM_AUDIT.md index 7c8d1755b..d3e1ece37 100644 --- a/upgrade-plan/GEM_AUDIT.md +++ b/upgrade-plan/GEM_AUDIT.md @@ -2,8 +2,8 @@ This document summarizes the gems identified across the repository (`admin`, `web`, `ruby`, `websocket-gateway`, `monitor`, `pb`) that pose significant risks or require specific attention during the upgrade to Rails 8 and Ruby 3.x. -**Status:** Draft / Initial Audit -**Date:** 2025-12-19 +**Status:** Updated Audit +**Date:** 2026-01-10 ## 🚨 Critical / Blockers @@ -11,19 +11,49 @@ These gems are either incompatible with modern Rails/Ruby, have been removed, or | Gem | Current Version | Issue | Action Plan | | :--- | :--- | :--- | :--- | -| **Ruby** | 2.3.1 | **Ancient**. EOL. Incompatible with Rails 8 (req 3.2+). | Upgrade to 3.2+ immediately. | -| **Rails** | 4.2.8 | **Ancient**. EOL. APIs removed/changed significantly. | Upgrade path: 4.2 -> 5.0 -> 5.1 -> 5.2 -> 6.0 -> 6.1 -> 7.0 -> 7.1 -> 8.0. | +| **Ruby** | 2.3.1 (admin/web) -> 3.2.2 (ruby) | **Ancient**. EOL. Incompatible with Rails 8 (req 3.2+). | `ruby/Gemfile` has been updated to 3.2.2. `admin`, `web`, `websocket-gateway`, `pb` must follow. | +| **Rails** | 4.2.8 (admin/web) -> 8.0.0 (ruby) | **Ancient**. EOL. APIs removed/changed significantly. | `ruby/Gemfile` updated to 8.0.0. All consumers of `jam_ruby` must update. | | `protected_attributes` | * | Removed in Rails 5. | Replace with `StrongParameters` in all controllers/models. | | `rails-observers` | * | Removed in Rails 4/5. | Replace with `ActiveSupport::Callbacks` or Service Objects. | -| `devise` | 3.3.0 | Incompatible with modern Rails. | Upgrade to latest (v4.x). meticulous migration of config/views required. | +| `devise` | 3.3.0 | Incompatible with modern Rails. | Upgrade to latest (v4.x). Meticulous migration of config/views required. | | `activeadmin` | ~1.0.0.pre | Major breaking changes in v2/v3. | Upgrade to latest. Expect broken UI/configs. | -| `paperclip` / `carrierwave` | 0.x | `paperclip` is dead. `carrierwave` 0.x is very old. | Upgrade `carrierwave` to 3.x. Check config/storage adapters. | +| `paperclip` / `carrierwave` | 0.9.0 / 0.11.2 | `paperclip` is dead. `carrierwave` 0.x is very old. | Upgrade `carrierwave` to 3.x. Check config/storage adapters. | | `aws-sdk` | ~> 1 | v1 is deprecated. v2/v3 have different namespaces. | Rewrite AWS interactions using `aws-sdk-s3`, etc. (v3). | | `resque` ecosystem | Mixed | Old versions. `resque-scheduler`, `retry` issues. | Verify compatibility or migrate to **Solid Queue** (Rails 8 default) or Sidekiq. | -| `poltergeist` / `phantomjs` | * | **Dead project**. | Replace with `selenium-webdriver` (Headless Chrome) or `cuprite`. | +| `poltergeist` / `phantomjs` | * | **Dead project**. | Replace with `selenium-webdriver` (Headless Chrome) or `cuprite` (used in `monitor`). | | `mimemagic` | * | Licensing issues/yanked versions. | Ensure using a safe version or replace with `marcel` (Rails default). | | `json` | 1.8.6 | C-ext compilation fails on Ruby 3. | Remove pin. Use default or newer version. | +## 📂 Project-Specific Findings + +### `ruby/Gemfile` (Shared Library) +**Status:** User has initiated upgrade to Ruby 3.2.2 / Rails 8.0.0. +* **Removed Pins:** `nokogiri`, `sprockets`, `faraday`, `redis` etc. have been unpinned. +* **TODO:** `aws-sdk` (~> 1), `factory_girl`, `rspec` (2.11) need upgrades. + +### `admin/Gemfile` +**Status:** Legacy (Rails 4.2.8, Ruby 2.3.1). +* **Dependencies:** Depends on `jam_ruby`. **Conflict:** `jam_ruby` wants Rails 8, `admin` wants Rails 4. +* **Specific Pins:** `activeadmin` (1.0.0.pre4), `sass-rails`, `jquery-ui-rails`, `bootstrap-sass` (2.0.4), `fog`. + +### `web/Gemfile` +**Status:** Legacy (Rails 4.2.8, Ruby 2.3.1). +* **Dependencies:** Depends on `jam_ruby`, `jam_websockets`, `jampb`. +* **Specific Pins:** `react-rails` (1.3.3), `omniauth-*` (1.x), `paypal-sdk-merchant-jk`, `capybara-webkit`. + +### `websocket-gateway/Gemfile` +**Status:** Legacy (Rails 4.2.8, Ruby 2.3.1). +* **Dependencies:** Depends on `jam_ruby`. +* **Specific Pins:** `em-websocket` (>=0.4.0), `amqp`, `eventmachine`. + +### `monitor/Gemfile` +**Status:** Standalone. +* **Issues:** Uses `poltergeist` (Dead). Needs migration to Selenium/Cuprite. + +### `pb/Gemfile` +**Status:** Legacy (Ruby 2.3.1). +* **Issues:** `ruby-protocol-buffers` (1.2.2). Needs verification on Ruby 3.2. + ## ⚠️ High Risk / Major Upgrades | Gem | Issue | Action | @@ -74,6 +104,7 @@ These gems are either incompatible with modern Rails/Ruby, have been removed, or ## Recommendation -1. **De-risk Ruby:** Try to get the app booting on Ruby 2.7 first (bridge to 3.0), then 3.2. -2. **De-risk Rails:** Upgrade 4.2 -> 5.0 is the hardest hurdle (`protected_attributes`, `observers`). -3. **Component Isolation:** Upgrade `ruby` (shared lib) first, then `admin` (smaller footprint), then `web` (largest surface area). +1. **Unified Upgrade:** Since `admin` and `web` depend on `jam_ruby`, they must likely be upgraded in lockstep, or `jam_ruby` needs to support dual versions (hard with Rails 4 vs 8). +2. **De-risk Ruby:** Try to get the app booting on Ruby 3.2 first. +3. **De-risk Rails:** Upgrade 4.2 -> 5.0 is the hardest hurdle (`protected_attributes`, `observers`). +4. **Component Isolation:** Upgrade `ruby` (shared lib) first, then `admin` (smaller footprint), then `web` (largest surface area). diff --git a/web/Gemfile b/web/Gemfile index 92394a53c..c2afe7a60 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -1,12 +1,8 @@ -source 'http://rubygems.org' -# Look for $WORKSPACE, otherwise use "workspace" as dev path. +source 'https://rubygems.org' -devenv = ENV["BUILD_NUMBER"].nil? # Jenkins sets a build number environment variable +devenv = ENV["BUILD_NUMBER"].nil? -ruby_version = ENV["JAM_RUBY_VERSION"] -ruby_version = "2.3.1" if ruby_version.nil? - -ruby ruby_version +ruby "3.2.2" if devenv #gem 'jam_db', :path=> "../db/target/ruby_package" @@ -22,224 +18,154 @@ else ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] ||= "true" end end -gem 'rails', '= 4.2.8' -gem 'railties', '= 4.2.8' -gem 'auto_strip_attributes', '2.6.0' -gem 'protected_attributes' -gem 'rails-observers' + +gem 'rails', '~> 8.0.0' +gem 'auto_strip_attributes' +# gem 'protected_attributes' # Removed in Rails 5+ +# gem 'rails-observers' # Removed in Rails 5+ # PINNED TO SUPPORT BOTH 2.3.1 and 2.4.1 Ruby simultaneously # This should be the same in ruby/admin/web/websocket-gateway ####### -gem 'nokogiri', '1.10.10' # added to pin before 1.11.0, which requires at leaost ruby 2.5. unpin we go above -gem 'sprockets', '3.6.3' # added to pin before 4.0.0, which requiurse at least ruby 2.5 -gem 'fog-brightbox', '0.11.0' # pinned until we are on ruby 2.5; then remove -gem 'faraday', '0.9.2' # pinned untnil we are on ruby 2.5; then remove -gem 'ruby-prof', '0.15.9' # pinned until we are on ruby 2.5; then remove -gem 'rubyzip', '1.2.1' # pinned until we are on ruby 2.5; then remove -gem 'recurly', '2.19.14' # should upgrade to 3.x when we have time to validaate -gem 'icalendar', '2.4.0' # pinned until we are on ruby 2.5; then remove -gem 'email_validator', '1.6.0' # pinned until we are on ruby 2.5, then remove -gem 'redis', '3.3.3' # pinned until we are on 2.5; then remove -gem 'redis-namespace', '1.5.3' # pinned until we are on 2.5; then remove -gem 'oj', '3.1.3' # pinned until we are on 2.5; then remove -gem 'bcrypt', '3.1.13' -gem 'sass-rails', '5.0.7' # compiler mismatch issue between build and www -gem 'sass', '3.5.5 '# compiler mismatch issue between build and www -#1###### +gem 'nokogiri' +gem 'sprockets' +gem 'fog-brightbox' +gem 'faraday' +gem 'ruby-prof' +gem 'rubyzip' +gem 'recurly' +gem 'icalendar' +gem 'email_validator' +gem 'redis' +gem 'redis-namespace' +gem 'oj' +gem 'bcrypt' +gem 'sass-rails' +gem 'sass' +####### -gem 'responders', '~> 2.0' -#gem 'sprockets', '3.2.0' -gem 'sprockets-es6', require: 'sprockets/es6' -gem 'sprockets-rails', '2.3.2' +gem 'responders' +gem 'sprockets-es6' +gem 'sprockets-rails' gem 'non-stupid-digest-assets' -#gem 'license_finder' -#gem 'pg_migrate', '0.1.14' -#gem 'paypal-sdk-rest' -gem 'paypal-sdk-merchant-jk', '1.118.1' + +gem 'paypal-sdk-merchant-jk' # TODO: Check if this custom fork needs update gem 'kickbox' -#gem 'oj' # '2.10.2' gem 'builder' gem 'jquery-rails' -gem 'jquery-ui-rails', '4.2.1' -#gem 'bootstrap-sass', '2.0.4' -#gem 'bcrypt-ruby', '3.1.14' -gem 'faker', '1.3.0' -gem 'will_paginate' #, '3.0.3' -gem 'bootstrap-will_paginate', '0.0.6' -gem 'em-websocket', '>=0.4.0' #, :path => '/Users/seth/workspace/em-websocket' -gem 'uuidtools', '2.1.2' -gem 'ruby-protocol-buffers', '1.2.2' +gem 'jquery-ui-rails' +gem 'faker' +gem 'will_paginate' +gem 'bootstrap-will_paginate' +gem 'em-websocket' +gem 'uuidtools' +gem 'ruby-protocol-buffers' -if ENV["MODERN_OS"] == "1" - gem 'pg', '0.21.0' -else - gem 'pg', '0.17.1' -end +gem 'pg' + +gem 'rabl' +gem 'gon' +gem 'eventmachine' +gem 'amqp' -#gem 'compass-rails' #, '1.1.3' # 1.1.4 throws an exception on startup about !initialize on nil -#gem "compass-rails", github: "Compass/compass-rails", branch: "master" -gem 'rabl', '0.13.1' # 0.14.3 has error on jenkins build server in ubuntu 12 -gem 'gon', '~>4.1.0' # for passthrough of Ruby variables to Javascript variables -gem 'eventmachine', "1.2.3" #, '1.0.4' -#gem 'faraday', '~>0.9.0' -gem 'amqp', '0.9.8' -#gem 'logging-rails', :require => 'logging/rails' -#gem 'omniauth', '1.1.1' -#gem 'omniauth-facebook', '1.4.1' -#======= -#gem 'logging-rails', :require => 'logging/rails' gem 'omniauth' gem 'omniauth-facebook' -#>>>>>>> develop gem 'omniauth-twitter' gem 'omniauth-google-oauth2' gem 'omniauth-stripe-connect' -gem 'google-api-client' #, '0.7.1' -gem 'retriable', '3.0.1' # this is necessary because 3.0.2 has a bug when used by google-api-client -#gem 'google-api-omniauth' #, '0.1.1' -gem 'signet', '0.5.0' +gem 'google-api-client' +gem 'retriable' +gem 'signet' gem 'twitter' -gem 'fb_graph', '2.5.9' -gem 'sendgrid', '1.2.0' -gem 'filepicker-rails', '0.1.0' -gem 'aws-sdk', '~> 1' -gem 'aasm' #, '3.0.16' +gem 'fb_graph' +gem 'sendgrid' +gem 'filepicker-rails' +gem 'aws-sdk-s3' +gem 'aasm' gem 'carmen' -gem 'carrierwave', '0.11.2' #, '0.9.0' +gem 'carrierwave' gem 'carrierwave_direct' gem 'fog' -#gem 'jquery-payment-rails', github: 'sethcall/jquery-payment-rails' -gem 'haml-rails', '0.9.0' # pinned because upgrading lets u not do = "{% if(data.feed_item['has_mount?']) { %}" . ? is bad -gem 'unf' #optional fog dependency -gem 'devise', '3.3.0' #3.4.0 causes uninitialized constant ActionController::Metal (NameError) +gem 'haml-rails' +gem 'unf' +gem 'devise' gem 'postgres-copy' gem 'prawn-table' -#group :libv8 do -# gem 'libv8', "~> 3.11.8" -#end + gem 'geokit-rails' -gem 'postgres_ext' gem 'resque' -gem 'resque-scheduler', '4.3.0' # a bug in 4.4.0 stops resque schedule from starting. 4.3.0 is very old compared to 4.4.0 though +gem 'resque-scheduler' gem 'resque-retry' gem 'resque-failed-job-mailer' gem 'resque-dynamic-queues' -gem 'resque-lonely_job', '~> 1.0.0' +gem 'resque-lonely_job' gem 'resque_mailer' -gem 'netaddr', '1.5.1' +gem 'netaddr' gem 'quiet_assets', :group => :development -gem 'bugsnag', '5.3.2' -gem 'multi_json' #, '1.9.0' +gem 'bugsnag' +gem 'multi_json' gem 'rest-client' gem 'iso-639' gem 'language_list' -#gem 'rubyzip' gem 'slim' gem 'htmlentities' gem 'sanitize' -#gem 'recurly', '~> 2' -#gem 'guard', '2.7.3' -#gem 'influxdb' #, '0.1.8' -gem 'cause' # needed by influxdb -gem 'influxdb', '0.3.14' -gem 'influxdb-rails', '0.1.12' +gem 'cause' +gem 'influxdb' +gem 'influxdb-rails' gem 'sitemap_generator' -gem 'bower-rails', "~> 0.9.2" -gem 'react-rails', '1.3.3' #'~> 1.0' -gem 'sendgrid_toolkit', '>= 1.1.1' +gem 'bower-rails' +gem 'react-rails' +gem 'sendgrid_toolkit' gem 'stripe' gem 'zip-codes' -#gem 'email_validator' -#gem "browserify-rails", "~> 0.7" gem 'elasticsearch' -gem 'logging', '1.7.2' +gem 'logging' -gem 'rack-cors', '~> 1.0', '>= 1.0.6' - - -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 - #gem 'faster_path', '~> 0.1.0', :group => :development -end +gem 'rack-cors' source 'https://rails-assets.org' do - gem 'rails-assets-reflux', '0.3.0' + gem 'rails-assets-reflux' gem 'rails-assets-classnames' -#<<<<<<< HEAD -# gem 'rails-assets-react-select' - #gem "rails-assets-regenerator" gem 'rails-assets-bluebird' -#======= - gem 'rails-assets-react-select', '0.6.7' -#>>>>>>> develop + gem 'rails-assets-react-select' end -#group :development, :production do -# gem 'rack-timeout' -#end - group :development, :test do - gem 'rspec-rails' #, require: "rspec/rails" #, '2.14.2' + gem 'rspec-rails' gem 'rspec-collection_matchers' - gem "activerecord-import", "~> 0.4.1" -# gem 'guard-rspec', '0.5.5' -# gem 'jasmine', '1.3.1' + gem "activerecord-import" gem 'pry' - gem 'execjs', '2.6.0 ' #, '1.4.0' - gem 'factory_girl_rails' # , '4.1.0' # in dev because in use by rake task - gem 'database_cleaner', '1.3.0' #in dev because in use by rake task + gem 'execjs' + gem 'factory_bot_rails' # Renamed from factory_girl_rails + gem 'database_cleaner' gem 'test-unit' - # gem 'teaspoon' - # gem 'teaspoon-jasmine' - gem 'puma' + gem 'puma' gem 'byebug' end -group :unix do -# gem 'therubyracer' #, '0.11.0beta8' -end - -# Gems used only for assets and not required -# in production environments by default. gem 'coffee-rails' gem 'uglifier' -gem 'coffee-script-source', '1.12.2' +gem 'coffee-script-source' + group :test, :cucumber do - gem 'simplecov', '~> 0.7.1' + gem 'simplecov' gem 'simplecov-rcov' gem 'capybara' - #gem 'rails-assets-sinon', source: 'https://rails-assets.org' - #gem 'sinon-rails' -#if ENV['JAMWEB_QT5'] == '1' -# # necessary on platforms such as arch linux, where pacman -S qt5-webkit is your easiet option -# gem "capybara-webkit", :git => 'git://github.com/thoughtbot/capybara-webkit.git' -#else -# gem "capybara-webkit" -#end - gem 'capybara-screenshot', '1.0.25' #, '0.3.22' # 1.0.0 broke compat with rspec. maybe we need newer rspec + gem 'capybara-screenshot' gem 'selenium-webdriver' - gem 'webdrivers', '~> 4.0', require: false + gem 'webdrivers', require: false gem "show_me_the_cookies" -# gem 'geckodriver-helper' # firefox - - # gem 'cucumber-rails', :require => false #, '1.3.0', :require => false -# gem 'guard-spork', '0.3.2' - gem 'spork', '0.9.0' - gem 'launchy', '2.1.1' + gem 'spork' + gem 'launchy' gem 'rack-test' - # gem 'rb-fsevent', '0.9.1', :require => false - # gem 'growl', '1.0.3' gem 'resque_spec' gem 'timecop' - gem 'webmock', '~> 3.11', '>= 3.11.2' -# gem 'thin' + gem 'webmock' end - group :production do gem 'unicorn' gem 'newrelic_rpm' @@ -248,4 +174,4 @@ end group :package do gem 'fpm' -end +end \ No newline at end of file diff --git a/web/app/controllers/users_controller.rb b/web/app/controllers/users_controller.rb index df463954f..01df89d8f 100644 --- a/web/app/controllers/users_controller.rb +++ b/web/app/controllers/users_controller.rb @@ -279,7 +279,7 @@ class UsersController < ApplicationController end def update - if @user.update_attributes(params[:jam_ruby_user]) + if @user.update_attributes(user_params) flash[:success] = "Profile updated" sign_in @user redirect_to @user @@ -468,6 +468,10 @@ JS private + def user_params + params.require(:jam_ruby_user).permit(:first_name, :last_name, :email, :city, :password, :password_confirmation, :state, :country, :birth_date, :subscribe_email, :terms_of_service, :original_fpfile, :cropped_fpfile, :cropped_large_fpfile, :cropped_s3_path, :cropped_large_s3_path, :photo_url, :large_photo_url, :crop_selection, :used_current_month, :used_month_play_time, :v2_photo_url, :v2_photo_uploaded) + end + def _render(action) case action when 'new' diff --git a/web/config/application.rb b/web/config/application.rb index 235f72847..eb07fd418 100644 --- a/web/config/application.rb +++ b/web/config/application.rb @@ -65,11 +65,6 @@ if defined?(Bundler) config.active_record.schema_format = :sql - # Enforce whitelist mode for mass assignment. - # This will create an empty whitelist of attributes available for mass-assignment for all models - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible - # parameters by using an attr_accessible or attr_protected declaration. - #config.active_record.whitelist_attributes = true # Enable the asset pipeline config.assets.enabled = true @@ -112,7 +107,7 @@ if defined?(Bundler) config.recaptcha_public_key = '6Let8dgSAAAAAFheKGWrs6iaq_hIlPOZ2f3Bb56B' config.recaptcha_private_key = '6Let8dgSAAAAAJzFxL9w2QR5auxjk0ol1_xAtOGO' - config.active_record.raise_in_transactional_callbacks = true + # config.active_record.raise_in_transactional_callbacks = true # create one user per real jamkazam employee? config.bootstrap_dev_users = true diff --git a/websocket-gateway/Gemfile b/websocket-gateway/Gemfile index db64d6b8c..b982e5b42 100644 --- a/websocket-gateway/Gemfile +++ b/websocket-gateway/Gemfile @@ -1,13 +1,10 @@ -#ruby=1.9.3-p327 -source 'http://rubygems.org' +source 'https://rubygems.org' + unless ENV['LOCAL_DEV'] == '1' source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/' end -ruby_version = ENV["JAM_RUBY_VERSION"] -ruby_version = "2.3.1" if ruby_version.nil? - -ruby ruby_version +ruby "3.2.2" # Look for $WORKSPACE, otherwise use "workspace" as dev path. devenv = ENV["BUILD_NUMBER"].nil? @@ -22,98 +19,81 @@ else ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] ||= "true" end -gem 'activerecord', '= 4.2.8' -gem 'actionpack', '= 4.2.8' -gem 'actionmailer', '= 4.2.8' -gem 'protected_attributes' -gem 'rails-observers' -gem 'auto_strip_attributes', '2.6.0' +gem 'activerecord', '~> 8.0.0' +gem 'actionpack', '~> 8.0.0' +gem 'actionmailer', '~> 8.0.0' +# gem 'protected_attributes' +# gem 'rails-observers' +gem 'auto_strip_attributes' # PINNED TO SUPPORT BOTH 2.3.1 and 2.4.1 Ruby simultaneously # This should be the same in ruby/admin/web/websocket-gateway ####### -gem 'nokogiri', '1.10.10' # added to pin before 1.11.0, which requires at leaost ruby 2.5. unpin we go above -gem 'sprockets', '3.6.3' # added to pin before 4.0.0, which requiurse at least ruby 2.5 -gem 'fog-brightbox', '0.11.0' # pinned until we are on ruby 2.5; then remove -gem 'faraday', '0.9.2' # pinned untnil we are on ruby 2.5; then remove -gem 'ruby-prof', '0.15.9' # pinned until we are on ruby 2.5; then remove -gem 'rubyzip', '1.2.1' # pinned until we are on ruby 2.5; then remove -gem 'recurly', '2.18.16' # should upgrade to 3.x when we have time to validaate -gem 'icalendar', '2.4.0' # pinned until we are on ruby 2.5; then remove -gem 'email_validator', '1.6.0' # pinned until we are on ruby 2.5, then remove -gem 'redis', '3.3.3' # pinned until we are on 2.5; then remove -gem 'redis-namespace', '1.5.3' # pinned until we are on 2.5; then remove -gem 'oj', '3.1.3' # pinned until we are on 2.5; then remove -gem 'bcrypt', '3.1.13' +gem 'nokogiri' +gem 'sprockets' +gem 'fog-brightbox' +gem 'faraday' +gem 'ruby-prof' +gem 'rubyzip' +gem 'recurly' +gem 'icalendar' +gem 'email_validator' +gem 'redis' +gem 'redis-namespace' +gem 'oj' +gem 'bcrypt' gem 'mimemagic', :source => 'https://int.jamkazam.com/gems/' ####### -#gem 'license_finder' gem 'zip-codes' gem 'stripe' gem 'kickbox' -gem 'uuidtools', '2.1.2' -# On MacOSX: gem install bcrypt-ruby -v '3.0.1' -- --with-cflags=-Wno-implicit-function-declaration -gem 'ruby-protocol-buffers', '1.2.2' -gem 'em-websocket', '>=0.4.0' #, :path=> "#{workspace}/em-websocket-jam" +gem 'uuidtools' +gem 'ruby-protocol-buffers' +gem 'em-websocket' gem 'amqp' gem 'logging' gem 'will_paginate' gem 'sendgrid' gem 'rb-readline' -gem 'aasm' #, '3.0.16' -gem 'carrierwave', '0.11.2' +gem 'aasm' +gem 'carrierwave' gem 'fog' -gem 'devise', '3.3.0' # 3.4.0 causes uninitialized constant ActionController::Metal (NameError) +gem 'devise' gem 'postgres-copy' -gem 'aws-sdk', '~> 1' -gem 'bugsnag', '5.3.2' -gem 'postgres_ext' +gem 'aws-sdk-s3' +gem 'bugsnag' gem 'resque' gem 'resque-retry' gem 'resque-failed-job-mailer' -gem 'resque-lonely_job', '~> 1.0.0' +gem 'resque-lonely_job' gem 'resque_mailer' gem 'geokit' -gem 'geokit-rails' #, '2.0.1' -gem 'mime-types', '1.25.1' +gem 'geokit-rails' +gem 'mime-types' gem 'rest-client' -gem 'netaddr', '1.5.1' +gem 'netaddr' gem 'iso-639' gem 'language_list' gem 'sanitize' -#gem 'influxdb' -gem 'cause' # needed by influxdb -gem 'sendgrid_toolkit', '>= 1.1.1' +gem 'cause' +gem 'sendgrid_toolkit' gem 'elasticsearch' -if ENV["MODERN_OS"] == "1" - gem 'pg', '0.21.0' -else - gem 'pg', '0.17.1' -end +gem 'pg' group :development do gem 'pry' end group :test do - gem 'simplecov', '~> 0.7.1' + gem 'simplecov' gem 'simplecov-rcov' gem 'cucumber' - gem 'rspec', '2.14.1' # can go to 3.0, but requires changes to tests due to should removal, be_truthy, and other changes - gem 'factory_girl' - #gem 'spork', '0.9.0' -#<<<<<<< HEAD - gem 'database_cleaner' #, '0.7.0' -# gem 'guard', '>= 0.10.0' -# gem 'guard-rspec', '>= 0.7.3' -# gem 'pg_migrate','0.1.13' #:path => "#{workspace}/pg_migrate_ruby" -#======= -# gem 'database_cleaner', '0.7.0' - #gem 'pg_migrate','0.1.14' #:path => "#{workspace}/pg_migrate_ruby" -#>>>>>>> develop + gem 'rspec' + gem 'factory_bot' # Renamed from factory_girl + gem 'database_cleaner' gem 'evented-spec' end @@ -123,4 +103,4 @@ end group :package do gem 'fpm' -end +end \ No newline at end of file