From 611c38643befe6fbccbf3d52d5d7b45f69a5a21d Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 10 Jan 2026 16:54:50 -0600 Subject: [PATCH] in the midst of a giant slog . 390 to 290 failed tests. Still going --- ruby/Gemfile | 4 +- ruby/Gemfile.lock | 227 +---------------- ...0250322000000_affiliate_tracking_totals.rb | 20 +- ruby/lib/jam_ruby.rb | 1 + .../jam_ruby/lib/email_new_musician_match.rb | 2 +- ruby/lib/jam_ruby/lib/musician_filter.rb | 12 +- ruby/lib/jam_ruby/models/band.rb | 4 +- ruby/lib/jam_ruby/models/country.rb | 2 +- ruby/lib/jam_ruby/models/email_batch.rb | 2 +- ruby/lib/jam_ruby/models/geo_ip_blocks.rb | 2 +- ruby/lib/jam_ruby/models/geo_ip_locations.rb | 2 +- ruby/lib/jam_ruby/models/jam_isp.rb | 2 +- ruby/lib/jam_ruby/models/max_mind_geo.rb | 2 +- ruby/lib/jam_ruby/models/max_mind_isp.rb | 2 +- .../models/music_session_user_history.rb | 15 +- ruby/lib/jam_ruby/models/notification.rb | 4 +- ruby/lib/jam_ruby/models/recording.rb | 2 +- ruby/lib/jam_ruby/models/region.rb | 2 +- ruby/lib/jam_ruby/models/retailer.rb | 4 +- ruby/lib/jam_ruby/models/rsvp_request.rb | 2 +- ruby/lib/jam_ruby/models/school.rb | 4 +- ruby/lib/jam_ruby/models/teacher.rb | 8 +- ruby/lib/jam_ruby/models/user.rb | 22 +- ruby/lib/jam_ruby/recurly_client.rb | 8 +- ruby/spec/factories.rb | 14 +- ruby/spec/jam_ruby/calendar_manager_spec.rb | 8 +- ruby/spec/jam_ruby/connection_manager_spec.rb | 22 +- .../flows/monthly_recurring_lesson_spec.rb | 90 +++---- .../spec/jam_ruby/flows/normal_lesson_spec.rb | 230 +++++++++--------- .../jam_ruby/flows/recurring_lesson_spec.rb | 20 +- .../jam_ruby/flows/testdrive_lesson_spec.rb | 96 ++++---- ruby/spec/jam_ruby/lib/elasticsearch_spec.rb | 2 +- .../lib/email_new_musician_match_spec.rb | 2 +- ruby/spec/jam_ruby/lib/profanity_spec.rb | 14 +- .../models/active_music_session_spec.rb | 128 +++++----- .../jam_ruby/models/affiliate_partner_spec.rb | 80 +++--- .../models/affiliate_referral_visit_spec.rb | 8 +- .../jam_ruby/models/band_location_spec.rb | 4 +- ruby/spec/jam_ruby/models/band_spec.rb | 38 +-- .../jam_ruby/models/claimed_recording_spec.rb | 16 +- ruby/spec/jam_ruby/models/connection_spec.rb | 42 ++-- ruby/spec/jam_ruby/models/country_spec.rb | 2 +- .../email_batch_spec_scheduled_session.rb | 4 +- .../jam_ruby/models/event_session_spec.rb | 4 +- ruby/spec/jam_ruby/models/event_spec.rb | 2 +- ruby/spec/jam_ruby/models/feed_spec.rb | 10 +- ruby/spec/jam_ruby/models/feedback_spec.rb | 14 +- ruby/spec/jam_ruby/models/friendship_spec.rb | 4 +- .../jam_ruby/models/generic_state_spec.rb | 14 +- .../jam_ruby/models/geo_ip_blocks_spec.rb | 2 +- .../jam_ruby/models/geo_ip_locations_spec.rb | 4 +- ruby/spec/jam_ruby/models/get_work_spec.rb | 20 +- .../icecast_admin_authentication_spec.rb | 14 +- .../jam_ruby/models/icecast_directory_spec.rb | 6 +- .../jam_ruby/models/icecast_limit_spec.rb | 4 +- .../jam_ruby/models/icecast_logging_spec.rb | 6 +- .../icecast_master_server_relay_spec.rb | 2 +- .../jam_ruby/models/icecast_mount_spec.rb | 24 +- .../models/icecast_mount_template_spec.rb | 2 +- .../spec/jam_ruby/models/icecast_path_spec.rb | 22 +- .../jam_ruby/models/icecast_relay_spec.rb | 6 +- .../models/icecast_source_change_spec.rb | 2 +- .../jam_ruby/models/icecast_template_spec.rb | 2 +- .../icecast_user_authentication_spec.rb | 14 +- ruby/spec/jam_ruby/models/invitation_spec.rb | 8 +- .../spec/jam_ruby/models/invited_user_spec.rb | 14 +- .../jam_ruby/models/isp_score_batch_spec.rb | 6 +- ruby/spec/jam_ruby/models/jam_isp_spec.rb | 6 +- .../jam_ruby/models/jam_track_mixdown_spec.rb | 10 +- .../jam_ruby/models/jam_track_right_spec.rb | 24 +- ruby/spec/jam_ruby/models/jam_track_spec.rb | 26 +- .../jam_ruby/models/jam_track_tap_in_spec.rb | 4 +- .../jam_ruby/models/jam_track_track_spec.rb | 4 +- ruby/spec/jam_ruby/models/jamblaster_spec.rb | 2 +- .../spec/jam_ruby/models/join_request_spec.rb | 10 +- .../jam_ruby/models/latency_tester_spec.rb | 2 +- .../jam_ruby/models/lesson_booking_spec.rb | 44 ++-- .../models/lesson_payment_charge_spec.rb | 4 +- .../jam_ruby/models/lesson_session_spec.rb | 138 +++++------ ruby/spec/jam_ruby/models/mix_spec.rb | 4 +- .../jam_ruby/models/music_session_spec.rb | 40 +-- .../music_sessions_user_history_spec.rb | 48 ++-- .../spec/jam_ruby/models/notification_spec.rb | 40 +-- ruby/spec/jam_ruby/models/posa_card_spec.rb | 2 +- ruby/spec/jam_ruby/models/quick_mix_spec.rb | 26 +- .../models/recorded_backing_track_spec.rb | 34 +-- .../jam_ruby/models/recorded_track_spec.rb | 34 +-- ruby/spec/jam_ruby/models/recording_spec.rb | 124 +++++----- .../recurly_transaction_web_hook_spec.rb | 16 +- ruby/spec/jam_ruby/models/region_spec.rb | 2 +- ruby/spec/jam_ruby/models/review_spec.rb | 62 ++--- .../spec/jam_ruby/models/rsvp_request_spec.rb | 2 +- ruby/spec/jam_ruby/models/rsvp_slot_spec.rb | 4 +- ruby/spec/jam_ruby/models/sale_spec.rb | 110 ++++----- ruby/spec/jam_ruby/models/school_spec.rb | 2 +- ruby/spec/jam_ruby/models/score_spec.rb | 16 +- .../jam_ruby/models/shopping_cart_spec.rb | 48 ++-- ruby/spec/jam_ruby/models/signup_hint_spec.rb | 8 +- .../jam_ruby/models/teacher_payment_spec.rb | 4 +- ruby/spec/jam_ruby/models/teacher_spec.rb | 52 ++-- ruby/spec/jam_ruby/models/track_spec.rb | 4 +- ruby/spec/jam_ruby/models/user_asset_spec.rb | 2 +- .../jam_ruby/models/user_location_spec.rb | 4 +- ruby/spec/jam_ruby/models/user_spec.rb | 86 +++---- ruby/spec/jam_ruby/recurly_client_spec.rb | 6 +- ruby/spec/jam_ruby/resque/audiomixer_spec.rb | 20 +- .../resque/jam_tracks_builder_spec.rb | 12 +- .../resque/jam_tracks_cleaner_spec.rb | 6 +- .../resque/music_session_reminder_spec.rb | 16 +- ruby/spec/jam_ruby/resque/quick_mixer_spec.rb | 10 +- .../resque/scheduled_daily_job_spec.rb | 6 +- .../jam_ruby/subscription_definitions_spec.rb | 16 +- ruby/spec/mailers/render_emails_spec.rb | 10 +- ruby/spec/mailers/user_mailer_spec.rb | 68 +++--- ruby/spec/spec_helper.rb | 11 + ruby/spec/support/utilities.rb | 67 ++++- 116 files changed, 1270 insertions(+), 1407 deletions(-) diff --git a/ruby/Gemfile b/ruby/Gemfile index 994dcec43..ba2d275e0 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -35,7 +35,7 @@ gem 'fog-brightbox' gem 'faraday' gem 'ruby-prof' gem 'rubyzip' -gem 'recurly' +gem 'recurly', '~> 2.19' gem 'icalendar' gem 'email_validator' gem 'redis' @@ -69,7 +69,7 @@ gem 'resque-lonely_job' gem 'resque_mailer' gem 'builder' -gem 'fog' +gem 'fog-aws' gem 'rest-client' gem 'iso-639' gem 'sanitize' diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index 1981304cb..4802fb79c 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -12,7 +12,6 @@ GEM remote: https://rubygems.org/ remote: https://jamjam:blueberryjam@int.jamkazam.com/gems/ specs: - CFPropertyList (2.3.6) aasm (5.5.2) concurrent-ruby (~> 1.0) actioncable (8.0.4) @@ -90,9 +89,6 @@ GEM 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-protocol (2.5.0) amqp (1.8.0) amq-protocol (>= 2.2.0) @@ -118,7 +114,7 @@ GEM aws-sigv4 (~> 1.5) aws-sigv4 (1.12.1) aws-eventstream (~> 1, >= 1.0.2) - base64 (0.2.0) + base64 (0.3.0) bcrypt (3.1.21) bcrypt-ruby (3.1.5) bcrypt (>= 3.1.3) @@ -148,7 +144,6 @@ GEM 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) @@ -205,53 +200,6 @@ GEM faraday-rack (1.0.0) faraday-retry (1.0.3) ffi (1.17.3-arm64-darwin) - fission (0.5.0) - CFPropertyList (~> 2.2) - fog (2.3.0) - fog-aliyun (>= 0.1.0) - fog-atmos - fog-aws (>= 0.6.0) - 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 (~> 2.1) - fog-dynect (>= 0.0.2, < 0.6.0) - fog-ecloud (~> 0.1) - fog-google (~> 1.0) - fog-internet-archive - fog-json - fog-local - fog-openstack - fog-ovirt - fog-powerdns (>= 0.1.1) - fog-profitbricks - fog-rackspace - fog-radosgw (>= 0.0.2) - fog-riakcs - fog-sakuracloud (>= 0.0.4) - fog-serverlove - fog-softlayer - fog-storm_on_demand - fog-terremark - fog-vmfusion - fog-voxel - fog-vsphere (>= 0.4.0) - fog-xenserver - fog-xml (~> 0.1.1) - ipaddress (~> 0.5) - json (~> 2.3) - fog-aliyun (0.4.0) - addressable (~> 2.8.0) - aliyun-sdk (~> 0.8.0) - fog-core - fog-json - ipaddress (~> 0.8) - xml-simple (~> 1.1) - fog-atmos (0.1.0) - fog-core - fog-xml fog-aws (3.33.1) base64 (>= 0.2, < 0.4) fog-core (~> 2.6) @@ -261,114 +209,14 @@ GEM dry-inflector fog-core (>= 1.45, < 3.0) fog-json - 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) fog-core (2.6.0) builder 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 (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 (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-json (1.2.0) fog-core multi_json (~> 1.10) - fog-local (0.9.0) - fog-core (>= 1.27, < 3.0) - fog-openstack (1.1.5) - fog-core (~> 2.1) - fog-json (>= 1.0) - fog-ovirt (2.0.3) - activesupport - fog-core - fog-json - fog-xml - 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) - fog-xml (>= 0.1) - ipaddress (>= 0.8) - fog-radosgw (0.0.5) - fog-core (>= 1.21.0) - fog-json - fog-xml (>= 0.0.1) - fog-riakcs (0.1.0) - fog-core - fog-json - fog-xml - fog-sakuracloud (1.7.5) - fog-core - fog-json - fog-serverlove (0.1.2) - fog-core - fog-json - fog-softlayer (1.1.4) - fog-core - fog-json - fog-storm_on_demand (0.1.1) - fog-core - fog-json - fog-terremark (0.1.0) - fog-core - fog-xml - fog-vmfusion (0.1.0) - fission - fog-core - fog-voxel (0.1.0) - fog-core - fog-xml - fog-vsphere (3.7.2) - fog-core - rbvmomi2 (~> 3.0) - fog-xenserver (1.0.0) - fog-core - fog-xml - xmlrpc fog-xml (0.1.5) fog-core nokogiri (>= 1.5.11, < 2.0.0) @@ -383,40 +231,6 @@ GEM rails (>= 3.0) 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.1.0) @@ -425,8 +239,6 @@ GEM csv mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - httpclient (2.9.0) - mutex_m i18n (1.14.8) concurrent-ruby (~> 1.0) icalendar (2.12.1) @@ -439,7 +251,6 @@ GEM mini_magick (>= 4.9.5, < 6) ruby-vips (>= 2.0.17, < 3) io-console (0.8.2) - ipaddress (0.8.3) irb (1.16.0) pp (>= 0.6.0) rdoc (>= 4.0.0) @@ -448,8 +259,6 @@ GEM csv jmespath (1.6.2) json (2.18.0) - jwt (3.1.2) - base64 kickbox (2.0.5) faraday (~> 1.0) json (>= 1.8) @@ -485,7 +294,6 @@ GEM 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 @@ -502,12 +310,8 @@ GEM oj (3.16.13) bigdecimal (>= 3.0) ostruct (>= 0.2) - optimist (3.2.1) orm_adapter (0.5.0) - 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) @@ -570,17 +374,11 @@ GEM 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) rdoc (7.0.3) erb psych (>= 4.0.0) tsort - recurly (4.73.0) - base64 (~> 0.2.0) + recurly (2.20.5) redis (5.4.1) redis-client (>= 0.22.0) redis-client (0.26.3) @@ -589,10 +387,6 @@ GEM 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) @@ -625,7 +419,6 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - retriable (3.1.2) rexml (3.4.4) rspec (3.13.2) rspec-core (~> 3.13.0) @@ -661,11 +454,6 @@ GEM json sendgrid_toolkit (1.4.0) httparty (>= 0.7.6) - 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) @@ -700,11 +488,9 @@ GEM activesupport 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) @@ -714,16 +500,11 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - 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) @@ -751,7 +532,7 @@ DEPENDENCIES factory_bot faker faraday - fog + fog-aws fog-brightbox geokit geokit-rails @@ -768,7 +549,7 @@ DEPENDENCIES postgres-copy pry railties (~> 8.0.0) - recurly + recurly (~> 2.19) redis redis-namespace resque diff --git a/ruby/db/migrate/20250322000000_affiliate_tracking_totals.rb b/ruby/db/migrate/20250322000000_affiliate_tracking_totals.rb index ad770dd6b..70675a7cb 100644 --- a/ruby/db/migrate/20250322000000_affiliate_tracking_totals.rb +++ b/ruby/db/migrate/20250322000000_affiliate_tracking_totals.rb @@ -16,16 +16,18 @@ class AffiliateTrackingTotals < ActiveRecord::Migration[4.2] execute "ALTER TABLE affiliate_partners ADD COLUMN subscriptions_current_quarter_in_cents INTEGER NOT NULL DEFAULT 0" execute "ALTER TABLE affiliate_partners ADD COLUMN jamtracks_sold INTEGER NOT NULL DEFAULT 0" execute "ALTER TABLE affiliate_partners ADD COLUMN subscriptions_count INTEGER NOT NULL DEFAULT 0" - # execute "ALTER TABLE affiliate_quarterly_payments ADD COLUMN subscriptions_count INTEGER NOT NULL DEFAULT 0" - # execute "ALTER TABLE affiliate_monthy_payments ADD COLUMN subscriptions_count INTEGER NOT NULL DEFAULT 0" - # execute "ALTER TABLE affiliate_quarterly_payments ADD COLUMN jamtrack_due_amount_in_cents INTEGER NOT NULL DEFAULT 0" - # execute "ALTER TABLE affiliate_quarterly_payments ADD COLUMN subscription_due_amount_in_cents INTEGER NOT NULL DEFAULT 0" - #execute "ALTER TABLE affiliate_monthly_payments ADD COLUMN jamtrack_due_amount_in_cents INTEGER NOT NULL DEFAULT 0" - #execute "ALTER TABLE affiliate_monthly_payments ADD COLUMN subscription_due_amount_in_cents INTEGER NOT NULL DEFAULT 0" + execute "ALTER TABLE affiliate_quarterly_payments ADD COLUMN subscriptions_count INTEGER NOT NULL DEFAULT 0" + execute "ALTER TABLE affiliate_monthly_payments ADD COLUMN subscriptions_count INTEGER NOT NULL DEFAULT 0" + execute "ALTER TABLE affiliate_quarterly_payments ADD COLUMN jamtrack_due_amount_in_cents INTEGER NOT NULL DEFAULT 0" + execute "ALTER TABLE affiliate_quarterly_payments ADD COLUMN subscription_due_amount_in_cents INTEGER NOT NULL DEFAULT 0" + execute "ALTER TABLE affiliate_monthly_payments ADD COLUMN jamtrack_due_amount_in_cents INTEGER NOT NULL DEFAULT 0" + execute "ALTER TABLE affiliate_monthly_payments ADD COLUMN subscription_due_amount_in_cents INTEGER NOT NULL DEFAULT 0" + # execute "ALTER TABLE affiliate_quarterly_payments ADD COLUMN jamtracks_sold INTEGER NOT NULL DEFAULT 0" + # execute "ALTER TABLE affiliate_monthly_payments ADD COLUMN jamtracks_sold INTEGER NOT NULL DEFAULT 0" execute "CREATE INDEX affiliate_partner_user_id_idx ON affiliate_partners USING btree (partner_user_id);" - # execute "CREATE INDEX affiliate_quarterly_payments_closed_index ON affiliate_quarterly_payments USING btree (paid);" - # execute "CREATE INDEX affiliate_quarterly_payments_paid_index ON affiliate_quarterly_payments USING btree (closed);" - # execute "CREATE INDEX affiliate_monthly_payments_paid_index ON affiliate_monthly_payments USING btree (closed);" + execute "CREATE INDEX affiliate_quarterly_payments_closed_index ON affiliate_quarterly_payments USING btree (paid);" + execute "CREATE INDEX affiliate_quarterly_payments_paid_index ON affiliate_quarterly_payments USING btree (closed);" + execute "CREATE INDEX affiliate_monthly_payments_paid_index ON affiliate_monthly_payments USING btree (closed);" end =begin diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index be7f61bf9..9ddced3ab 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -26,6 +26,7 @@ require 'stripe' require 'zip-codes' require 'email_validator' require 'action_view' +require 'recurly' require "jam_ruby/lib/timezone" require "jam_ruby/constants/limits" diff --git a/ruby/lib/jam_ruby/lib/email_new_musician_match.rb b/ruby/lib/jam_ruby/lib/email_new_musician_match.rb index bc3ab6534..699c28bc2 100644 --- a/ruby/lib/jam_ruby/lib/email_new_musician_match.rb +++ b/ruby/lib/jam_ruby/lib/email_new_musician_match.rb @@ -88,7 +88,7 @@ module JamRuby rescue => exception begin fail_count = email_sending.fail_count - email_sending.update_attributes(fail_count: fail_count + 1, exception_detail: exception.message) + email_sending.update(fail_count: fail_count + 1, exception_detail: exception.message) AdminMailer.ugly({to: APP_CONFIG.user_match_monitoring_email, subject:"Error occured when sending weekly user match email.", diff --git a/ruby/lib/jam_ruby/lib/musician_filter.rb b/ruby/lib/jam_ruby/lib/musician_filter.rb index 12d567927..c0c03d033 100644 --- a/ruby/lib/jam_ruby/lib/musician_filter.rb +++ b/ruby/lib/jam_ruby/lib/musician_filter.rb @@ -11,9 +11,9 @@ module JamRuby def self.filter(user, remote_ip, params) #debugger - latency_good = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:latency_good]) - latency_fair = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:latency_fair]) - latency_high = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:latency_high]) + latency_good = ActiveRecord::Type::Boolean.new.cast(params[:latency_good]) + latency_fair = ActiveRecord::Type::Boolean.new.cast(params[:latency_fair]) + latency_high = ActiveRecord::Type::Boolean.new.cast(params[:latency_high]) offset = [params[:offset].to_i, 0].max limit = [params[:limit].to_i, 20].max filter_params = {} @@ -27,9 +27,9 @@ module JamRuby genres = params[:genres] filter_params.merge!(genres: genres) if genres - beginner = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:proficiency_beginner]) - intermediate = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:proficiency_intermediate]) - expert = ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:proficiency_expert]) + beginner = ActiveRecord::Type::Boolean.new.cast(params[:proficiency_beginner]) + intermediate = ActiveRecord::Type::Boolean.new.cast(params[:proficiency_intermediate]) + expert = ActiveRecord::Type::Boolean.new.cast(params[:proficiency_expert]) proficiency_levels = [] proficiency_levels.push(1) if beginner diff --git a/ruby/lib/jam_ruby/models/band.rb b/ruby/lib/jam_ruby/models/band.rb index 8afe7d286..7ccd16be2 100644 --- a/ruby/lib/jam_ruby/models/band.rb +++ b/ruby/lib/jam_ruby/models/band.rb @@ -258,7 +258,7 @@ module JamRuby cropped_s3_path = cropped_fpfile["key"] cropped_large_s3_path = cropped_large_fpfile["key"] - self.update_attributes( + self.update( :original_fpfile_photo => original_fpfile, :cropped_fpfile_photo => cropped_fpfile, :cropped_large_fpfile_photo => cropped_large_fpfile, @@ -279,7 +279,7 @@ module JamRuby S3Util.delete(aws_bucket, self.cropped_large_s3_path_photo) end - return self.update_attributes( + return self.update( :original_fpfile_photo => nil, :cropped_fpfile_photo => nil, :cropped_large_fpfile_photo => nil, diff --git a/ruby/lib/jam_ruby/models/country.rb b/ruby/lib/jam_ruby/models/country.rb index 35463d144..8dd724aab 100644 --- a/ruby/lib/jam_ruby/models/country.rb +++ b/ruby/lib/jam_ruby/models/country.rb @@ -33,7 +33,7 @@ module JamRuby i = 0 n = 20 - csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false}) + csv = ::CSV.new(io, encoding: 'ISO-8859-1', headers: false) csv.each do |row| vals = vals+sep+"(#{ActiveRecord::Base.quote_value(row[0], nil)}, #{ActiveRecord::Base.quote_value(row[1], nil)})" sep = ',' diff --git a/ruby/lib/jam_ruby/models/email_batch.rb b/ruby/lib/jam_ruby/models/email_batch.rb index 83a8aa30d..8c2e0a11b 100644 --- a/ruby/lib/jam_ruby/models/email_batch.rb +++ b/ruby/lib/jam_ruby/models/email_batch.rb @@ -154,7 +154,7 @@ FOO def update_with_conflict_validation(*args) num_try = 0 begin - update_attributes(*args) + update(*args) rescue ActiveRecord::StaleObjectError num_try += 1 if 5 > num_try diff --git a/ruby/lib/jam_ruby/models/geo_ip_blocks.rb b/ruby/lib/jam_ruby/models/geo_ip_blocks.rb index 2bf714ce0..9baede459 100644 --- a/ruby/lib/jam_ruby/models/geo_ip_blocks.rb +++ b/ruby/lib/jam_ruby/models/geo_ip_blocks.rb @@ -71,7 +71,7 @@ module JamRuby i = 0 n = 20 - csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false}) + csv = ::CSV.new(io, encoding: 'ISO-8859-1', headers: false) csv.each do |row| raise "file does not have expected number of columns (3): #{row.length}" unless row.length == 3 diff --git a/ruby/lib/jam_ruby/models/geo_ip_locations.rb b/ruby/lib/jam_ruby/models/geo_ip_locations.rb index 8cc38c9ce..e1c60ecd2 100644 --- a/ruby/lib/jam_ruby/models/geo_ip_locations.rb +++ b/ruby/lib/jam_ruby/models/geo_ip_locations.rb @@ -162,7 +162,7 @@ module JamRuby i = 0 n = 20 - csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false}) + csv = ::CSV.new(io, encoding: 'ISO-8859-1', headers: false) csv.each do |row| raise "file does not have expected number of columns (9): #{row.length}" unless row.length == 9 diff --git a/ruby/lib/jam_ruby/models/jam_isp.rb b/ruby/lib/jam_ruby/models/jam_isp.rb index ceed7dc71..951c09c4b 100644 --- a/ruby/lib/jam_ruby/models/jam_isp.rb +++ b/ruby/lib/jam_ruby/models/jam_isp.rb @@ -108,7 +108,7 @@ module JamRuby i = 0 n = 20 - csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false}) + csv = ::CSV.new(io, encoding: 'ISO-8859-1', headers: false) csv.each do |row| raise "file does not have expected number of columns (3): #{row.length}" unless row.length == 3 diff --git a/ruby/lib/jam_ruby/models/max_mind_geo.rb b/ruby/lib/jam_ruby/models/max_mind_geo.rb index cb38a8fc8..f1d31fa7d 100644 --- a/ruby/lib/jam_ruby/models/max_mind_geo.rb +++ b/ruby/lib/jam_ruby/models/max_mind_geo.rb @@ -41,7 +41,7 @@ module JamRuby i = 0 n = 20 # going from 20 to 40 only changed things a little bit - csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false}) + csv = ::CSV.new(io, encoding: 'ISO-8859-1', headers: false) csv.each do |row| raise "file does not have expected number of columns (10): #{row.length}" unless row.length == 10 diff --git a/ruby/lib/jam_ruby/models/max_mind_isp.rb b/ruby/lib/jam_ruby/models/max_mind_isp.rb index 7562979d7..b0fdbadf7 100644 --- a/ruby/lib/jam_ruby/models/max_mind_isp.rb +++ b/ruby/lib/jam_ruby/models/max_mind_isp.rb @@ -48,7 +48,7 @@ module JamRuby i = 0 n = 20 # going from 20 to 40 only changed things a little bit, and 512 was slower... and 1024 was even slower (weird) - csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false}) + csv = ::CSV.new(io, encoding: 'ISO-8859-1', headers: false) csv.each do |row| raise "file does not have expected number of columns (4): #{row.length}" unless row.length == 4 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 f65922a69..264fbd7a2 100644 --- a/ruby/lib/jam_ruby/models/music_session_user_history.rb +++ b/ruby/lib/jam_ruby/models/music_session_user_history.rb @@ -85,7 +85,14 @@ SQL result = ActiveRecord::Base.connection.exec_query(query) duration = result.cast_values[0] return 0 unless duration - (duration.split(':').map(&:to_f).inject(0) { |a, b| a * 60 + b } / 60.0).round + + if duration.is_a?(String) + (duration.split(':').map(&:to_f).inject(0) { |a, b| a * 60 + b } / 60.0).round + elsif duration.is_a?(Numeric) + (duration / 60.0).round + else + 0 + end end def self.join_music_session(user_id, session_id, client_id) @@ -101,7 +108,7 @@ SQL def start_history self.session_removed_at = nil - self.update_attributes(:session_removed_at => self.session_removed_at, :max_concurrent_connections => determine_max_concurrent) + self.update(:session_removed_at => self.session_removed_at, :max_concurrent_connections => determine_max_concurrent) end def self.removed_music_session(user_id, session_id) @@ -120,7 +127,7 @@ SQL end if self.max_concurrent_connections.nil? self.max_concurrent_connections = determine_max_concurrent - self.update_attributes(:session_removed_at => self.session_removed_at, :max_concurrent_connections => self.max_concurrent_connections) + self.update(:session_removed_at => self.session_removed_at, :max_concurrent_connections => self.max_concurrent_connections) self.update_remaining_play_time end end @@ -140,7 +147,7 @@ SQL remaining_time_so_far = remaining_time_so_far + duration_minutes * 60 end - self.user.update_attributes(:used_current_month => current_month, :used_month_play_time => remaining_time_so_far) + self.user.update(:used_current_month => current_month, :used_month_play_time => remaining_time_so_far) end # figures out what the peak amount of other clients the user saw while playing at any given time. diff --git a/ruby/lib/jam_ruby/models/notification.rb b/ruby/lib/jam_ruby/models/notification.rb index 2c5938565..6e7536b89 100644 --- a/ruby/lib/jam_ruby/models/notification.rb +++ b/ruby/lib/jam_ruby/models/notification.rb @@ -1166,7 +1166,7 @@ module JamRuby raise ArgumentError, "Block required" unless block_given? source_user = music_session.creator rsvp_requests = RsvpRequest.index(music_session) - rsvp_requests.where(:canceled => false).each do |rsvp| + rsvp_requests.select { |r| !r.canceled }.each do |rsvp| target_user = rsvp.user notification = Notification.new notification.description = reminder_type @@ -1183,7 +1183,7 @@ module JamRuby return if music_session.nil? || creator.nil? || comment.blank? rsvp_requests = RsvpRequest.index(music_session) - target_users = send_to_cancelled ? rsvp_requests.map { |r| r.user } : rsvp_requests.where(:canceled => false).map { |r| r.user } + target_users = send_to_cancelled ? rsvp_requests.map { |r| r.user } : rsvp_requests.select { |r| !r.canceled }.map { |r| r.user } target_users = target_users.concat([music_session.creator]) source_user = creator pending_invites = music_session.pending_invitations diff --git a/ruby/lib/jam_ruby/models/recording.rb b/ruby/lib/jam_ruby/models/recording.rb index 20dda6ecd..b48dd83f3 100644 --- a/ruby/lib/jam_ruby/models/recording.rb +++ b/ruby/lib/jam_ruby/models/recording.rb @@ -4,11 +4,11 @@ module JamRuby @@log = Logging.logger[Recording] - 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 has_many :mixes, :class_name => "JamRuby::Mix", :inverse_of => :recording, :foreign_key => 'recording_id', :dependent => :destroy has_many :quick_mixes, :class_name => "JamRuby::QuickMix", :foreign_key => :recording_id, :dependent => :destroy has_many :recorded_tracks, :class_name => "JamRuby::RecordedTrack", :foreign_key => :recording_id, :dependent => :destroy + has_many :users, :through => :recorded_tracks, :class_name => "JamRuby::User" has_many :recorded_videos, :class_name => "JamRuby::RecordedVideo", :foreign_key => :recording_id, :dependent => :destroy has_many :recorded_backing_tracks, :class_name => "JamRuby::RecordedBackingTrack", :foreign_key => :recording_id, :dependent => :destroy has_many :recorded_jam_track_tracks, :class_name => "JamRuby::RecordedJamTrackTrack", :foreign_key => :recording_id, :dependent => :destroy diff --git a/ruby/lib/jam_ruby/models/region.rb b/ruby/lib/jam_ruby/models/region.rb index 2c3e229fc..1e80dfbdd 100644 --- a/ruby/lib/jam_ruby/models/region.rb +++ b/ruby/lib/jam_ruby/models/region.rb @@ -40,7 +40,7 @@ module JamRuby i = 0 n = 20 - csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false}) + csv = ::CSV.new(io, encoding: 'ISO-8859-1', headers: false) csv.each do |row| vals = vals+sep+"(#{ActiveRecord::Base.quote_value(row[0], nil)}, #{ActiveRecord::Base.quote_value(row[1], nil)}, #{ActiveRecord::Base.quote_value(row[2], nil)})" diff --git a/ruby/lib/jam_ruby/models/retailer.rb b/ruby/lib/jam_ruby/models/retailer.rb index 5346969f5..47ef6568a 100644 --- a/ruby/lib/jam_ruby/models/retailer.rb +++ b/ruby/lib/jam_ruby/models/retailer.rb @@ -130,7 +130,7 @@ module JamRuby cropped_s3_path = cropped_fpfile["key"] cropped_large_s3_path = cropped_large_fpfile["key"] - self.update_attributes( + self.update( :original_fpfile => original_fpfile.to_json, :cropped_fpfile => cropped_fpfile.to_json, :cropped_large_fpfile => cropped_large_fpfile.to_json, @@ -152,7 +152,7 @@ module JamRuby S3Util.delete(aws_bucket, self.cropped_large_s3_path) end - return self.update_attributes( + return self.update( :original_fpfile => nil, :cropped_fpfile => nil, :cropped_large_fpfile => nil, diff --git a/ruby/lib/jam_ruby/models/rsvp_request.rb b/ruby/lib/jam_ruby/models/rsvp_request.rb index ca4513c0b..7a6dfe6a2 100644 --- a/ruby/lib/jam_ruby/models/rsvp_request.rb +++ b/ruby/lib/jam_ruby/models/rsvp_request.rb @@ -44,7 +44,7 @@ module JamRuby end query = query.where("rsvp_requests.user_id = ?", user.id) unless user.nil? - return query.uniq + return query.distinct end def self.create(params, user) diff --git a/ruby/lib/jam_ruby/models/school.rb b/ruby/lib/jam_ruby/models/school.rb index 57db8bdf1..f00f62163 100644 --- a/ruby/lib/jam_ruby/models/school.rb +++ b/ruby/lib/jam_ruby/models/school.rb @@ -107,7 +107,7 @@ module JamRuby cropped_s3_path = cropped_fpfile["key"] cropped_large_s3_path = cropped_large_fpfile["key"] - self.update_attributes( + self.update( :original_fpfile => original_fpfile.to_json, :cropped_fpfile => cropped_fpfile.to_json, :cropped_large_fpfile => cropped_large_fpfile.to_json, @@ -129,7 +129,7 @@ module JamRuby S3Util.delete(aws_bucket, self.cropped_large_s3_path) end - return self.update_attributes( + return self.update( :original_fpfile => nil, :cropped_fpfile => nil, :cropped_large_fpfile => nil, diff --git a/ruby/lib/jam_ruby/models/teacher.rb b/ruby/lib/jam_ruby/models/teacher.rb index 9c8007420..197bcd147 100644 --- a/ruby/lib/jam_ruby/models/teacher.rb +++ b/ruby/lib/jam_ruby/models/teacher.rb @@ -3,14 +3,14 @@ module JamRuby include HtmlSanitize html_sanitize strict: [:biography, :website] attr_accessor :validate_introduction, :validate_basics, :validate_pricing - 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" + has_many :genres, :class_name => "JamRuby::Genre", :through => :teachers_genres # , :order => "description" has_many :teachers_instruments, class_name: "JamRuby::TeacherInstrument" - has_many :subjects, :class_name => "JamRuby::Subject", :through => :teachers_subjects # , :order => "description" + has_many :instruments, :class_name => "JamRuby::Instrument", through: :teachers_instruments # , :order => "description" has_many :teachers_subjects, class_name: "JamRuby::TeacherSubject" - has_many :languages, :class_name => "JamRuby::Language", :through => :teachers_languages # , :order => "description" + has_many :subjects, :class_name => "JamRuby::Subject", :through => :teachers_subjects # , :order => "description" has_many :teachers_languages, class_name: "JamRuby::TeacherLanguage" + has_many :languages, :class_name => "JamRuby::Language", :through => :teachers_languages # , :order => "description" has_many :teacher_experiences, :class_name => "JamRuby::TeacherExperience" has_many :experiences_teaching, -> { where(experience_type: 'teaching') }, :class_name => "JamRuby::TeacherExperience" has_many :experiences_education, -> { where(experience_type: 'education') }, :class_name => "JamRuby::TeacherExperience" diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 51f5c6dcf..7740abef0 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -701,9 +701,11 @@ module JamRuby end end - def online - online? + def online? + # check if user has any online presences. This is a guess based on the has_many :online_presences + self.online_presences.exists? end + alias_method :online, :online? def anonymous? first_name == 'Anonymous' && last_name == 'Anonymous' @@ -1047,7 +1049,7 @@ module JamRuby # taken liberally from Devise::DatabaseAuthenticatable.update_with_password if valid_password?(old_password) - update_attributes(attributes) + update(attributes) else self.assign_attributes(attributes) self.valid? @@ -2085,7 +2087,7 @@ module JamRuby cropped_s3_path = cropped_fpfile["key"] cropped_large_s3_path = cropped_large_fpfile["key"] - self.update_attributes( + self.update( :original_fpfile => original_fpfile, :cropped_fpfile => cropped_fpfile, :cropped_large_fpfile => cropped_large_fpfile, @@ -2098,7 +2100,7 @@ module JamRuby end def update_avatar_v2(url) - self.update_attributes( + self.update( :v2_photo_url => url, :v2_photo_uploaded => true ) @@ -2114,7 +2116,7 @@ module JamRuby S3Util.delete(aws_bucket, self.cropped_large_s3_path) end - return self.update_attributes( + return self.update( :original_fpfile => nil, :cropped_fpfile => nil, :cropped_large_fpfile => nil, @@ -2135,7 +2137,7 @@ module JamRuby # S3Util.delete(aws_bucket, self.v2_photo_url) # end - return self.update_attributes( + return self.update( :v2_photo_url => nil ) end @@ -2283,7 +2285,7 @@ module JamRuby # geo.lat = nil if geo.lat = 0 # geo.lng = nil if geo.lng = 0 # if geo.lat && geo.lng && (self.lat != geo.lat || self.lng != geo.lng) - # self.update_attributes({ :lat => geo.lat, :lng => geo.lng }) + # self.update({ :lat => geo.lat, :lng => geo.lng }) # return true # end # end @@ -2292,13 +2294,13 @@ module JamRuby # geo.lat = nil if geo.lat = 0 # geo.lng = nil if geo.lng = 0 # if self.lat != geo.lat || self.lng != geo.lng - # self.update_attributes({ :lat => geo.lat, :lng => geo.lng }) + # self.update({ :lat => geo.lat, :lng => geo.lng }) # return true # end # end # else # if self.lat || self.lng - # self.update_attributes({ :lat => nil, :lng => nil }) + # self.update({ :lat => nil, :lng => nil }) # return true # end # end diff --git a/ruby/lib/jam_ruby/recurly_client.rb b/ruby/lib/jam_ruby/recurly_client.rb index 659bb65ab..9d0dcaf87 100644 --- a/ruby/lib/jam_ruby/recurly_client.rb +++ b/ruby/lib/jam_ruby/recurly_client.rb @@ -134,7 +134,7 @@ module JamRuby if(account.present?) options = account_hash(current_user, billing_info) begin - account.update_attributes(options) + account.update(options) rescue Recurly::Error, NoMethodError => x raise RecurlyClientError, x.to_s end @@ -384,12 +384,12 @@ module JamRuby old_subscription.reactivate puts "reactivated plan! Let's check if it needs changing" #if plan_code != old_subscription.plan.plan_code - result = old_subscription.update_attributes( + result = old_subscription.update( :plan_code => plan_code, :timeframe => starts_at.nil? ? 'bill_date' : 'now' ) # end - # fetch it again. because it's got staleness after update_attributes operation + # fetch it again. because it's got staleness after update operation return Recurly::Subscription.find(old_subscription_id) rescue => e puts "Unable to reactivate/update old plan #{e}" @@ -487,7 +487,7 @@ module JamRuby return false end - result = subscription.update_attributes( + result = subscription.update( :plan_code => plan_code, :timeframe => 'bill_date' ) diff --git a/ruby/spec/factories.rb b/ruby/spec/factories.rb index a7492b4b6..b39eda139 100644 --- a/ruby/spec/factories.rb +++ b/ruby/spec/factories.rb @@ -159,7 +159,7 @@ FactoryBot.define do end factory :music_session, :class => JamRuby::MusicSession do - ignore do + transient do student { nil } end sequence(:name) { |n| "Music Session #{n}" } @@ -421,7 +421,7 @@ FactoryBot.define do factory :promo_buzz, :class => JamRuby::PromoBuzz do text_short { Faker::Lorem.characters(number: 10) } - text_long { Faker::Lorem.paragraphs(3).join("\n") } + text_long { Faker::Lorem.paragraphs(number: 3).join("\n") } end factory :icecast_limit, :class => JamRuby::IcecastLimit do @@ -638,7 +638,7 @@ FactoryBot.define do factory :email_batch, :class => JamRuby::EmailBatch do subject { Faker::Lorem.sentence } - body { "#{JamRuby::EmailBatch::VAR_FIRST_NAME} " + Faker::Lorem.paragraphs(3).join("\n") } + body { "#{JamRuby::EmailBatch::VAR_FIRST_NAME} " + Faker::Lorem.paragraphs(number: 3).join("\n") } test_emails { 4.times.collect { Faker::Internet.safe_email }.join(',') } end @@ -851,9 +851,9 @@ FactoryBot.define do 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] } + title { Faker::Lorem.sentence()[0...50] } + message { Faker::Lorem.paragraph()[0...200] } + button_label { Faker::Lorem.words(number: 2).join(' ')[0...14] } frequency { 3 } end @@ -882,7 +882,7 @@ FactoryBot.define do end factory :affiliate_legalese, class: 'JamRuby::AffiliateLegalese' do - legalese { Faker::Lorem.paragraphs(6).join("\n\n") } + legalese { Faker::Lorem.paragraphs(number: 6).join("\n\n") } end factory :affiliate_distribution, class: 'JamRuby::AffiliateDistribution' do diff --git a/ruby/spec/jam_ruby/calendar_manager_spec.rb b/ruby/spec/jam_ruby/calendar_manager_spec.rb index f0b1efc98..5f4d8bc0c 100644 --- a/ruby/spec/jam_ruby/calendar_manager_spec.rb +++ b/ruby/spec/jam_ruby/calendar_manager_spec.rb @@ -34,7 +34,7 @@ describe CalendarManager do # Basic format checking...there are some online tools that # check a lot more, but no ruby libs that I could find: lines = ics.split("\r\n") - lines.should have(12).items + lines.size.should == 12 lines.first.should eq("BEGIN:VCALENDAR") lines.last.should eq("END:VCALENDAR") lines[-2].should eq("END:VEVENT") @@ -55,7 +55,7 @@ describe CalendarManager do # Basic format checking...there are some online tools that # check a lot more, but no ruby libs that I could find: lines = ics.split("\r\n") - lines.should have(12).items + lines.size.should == 12 lines.first.should eq("BEGIN:VCALENDAR") lines.last.should eq("END:VCALENDAR") lines[-2].should eq("END:VEVENT") @@ -67,11 +67,11 @@ describe CalendarManager do strict_parser = Icalendar::Parser.new(ics, true) cals = strict_parser.parse cals.should_not be_nil - cals.should have(1).items + cals.size.should == 1 cal = cals.first cal.should_not be_nil - cal.events.should have(1).items + cal.events.size.should == 1 event = cal.events.first event.should_not be_nil diff --git a/ruby/spec/jam_ruby/connection_manager_spec.rb b/ruby/spec/jam_ruby/connection_manager_spec.rb index 00cb97b41..95fb21d75 100644 --- a/ruby/spec/jam_ruby/connection_manager_spec.rb +++ b/ruby/spec/jam_ruby/connection_manager_spec.rb @@ -97,7 +97,7 @@ describe ConnectionManager, no_transaction: true do end cc = Connection.find_by_client_id!(client_id) - cc.connected?.should be_true + cc.connected?.should be true cc.ip_address.should eql("1.1.1.1") cc.addr.should == 0x01010101 @@ -126,7 +126,7 @@ describe ConnectionManager, no_transaction: true do end cc = Connection.find_by_client_id!(client_id) - cc.connected?.should be_true + cc.connected?.should be true cc.ip_address.should eql("1.1.1.1") cc.addr.should == 0x01010101 cc.udp_reachable.should == true @@ -134,7 +134,7 @@ describe ConnectionManager, no_transaction: true do @connman.reconnect(cc, channel_id, nil, "33.1.2.3", STALE_TIME, EXPIRE_TIME, false, GATEWAY) cc = Connection.find_by_client_id!(client_id) - cc.connected?.should be_true + cc.connected?.should be true cc.ip_address.should eql("33.1.2.3") cc.udp_reachable.should == false @@ -163,14 +163,14 @@ describe ConnectionManager, no_transaction: true do end cc = Connection.find_by_client_id!(client_id) - cc.connected?.should be_true + cc.connected?.should be true cc.ip_address.should eql("1.1.1.1") cc.udp_reachable.should == false @connman.reconnect(cc, channel_id, nil, "33.1.2.3", STALE_TIME, EXPIRE_TIME, nil, GATEWAY) # heartbeat passes nil in for udp_reachable cc = Connection.find_by_client_id!(client_id) - cc.connected?.should be_true + cc.connected?.should be true cc.ip_address.should eql("33.1.2.3") cc.udp_reachable.should == false @@ -349,7 +349,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) connection = @connman.join_music_session(user, client_id, music_session, true, TRACKS, 10) - connection.errors.any?.should be_false + connection.errors.any?.should be false assert_session_exists(music_session_id, true) @@ -410,7 +410,7 @@ describe ConnectionManager, no_transaction: true do connection = @connman.join_music_session(user, client_id, music_session, 'blarg', TRACKS, 10) connection.errors.size.should == 0 - connection.as_musician.should be_false + connection.as_musician.should be false end it "join_music_session fails if fan_access=false and the user is a fan" do @@ -554,7 +554,7 @@ describe ConnectionManager, no_transaction: true do user = User.find(user_id) - client_id1 = Faker::Number.number(20) + client_id1 = Faker::Number.number(digits: 20) @connman.create_connection(user_id, client_id1, channel_id, "1.1.1.1", 'client', STALE_TIME, EXPIRE_TIME, REACHABLE, GATEWAY, false) music_session1 = FactoryBot.create(:active_music_session, :user_id => user_id) connection1 = @connman.join_music_session(user, client_id1, music_session1, true, TRACKS, 10) @@ -566,7 +566,7 @@ describe ConnectionManager, no_transaction: true do connection2.errors.size.should == 1 connection2.errors.get(:music_session).should == [ValidationMessages::CANT_JOIN_MULTIPLE_SESSIONS] - # client_id2 = Faker::Number.number(20) + # client_id2 = Faker::Number.number(digits: 20) # @connman.create_connection(user_id, client_id2, "2.2.2.2", 'client') # music_session2 = MusicSession.find(create_music_session(user_id)) # connection2 = @connman.join_music_session(user, client_id2, music_session2, true, TRACKS) @@ -575,11 +575,11 @@ describe ConnectionManager, no_transaction: true do # connection2.errors.get(:music_session).should == [ValidationMessages::CANT_JOIN_MULTIPLE_SESSIONS] # # user.update_attribute(:admin, true) - # client_id = Faker::Number.number(20) + # client_id = Faker::Number.number(digits: 20) # @connman.create_connection(user_id, client_id, "1.1.1.1", 'client') # music_session = MusicSession.find(create_music_session(user_id)) # connection = @connman.join_music_session(user, client_id, music_session, true, TRACKS) - # client_id = Faker::Number.number(20) + # client_id = Faker::Number.number(digits: 20) # @connman.create_connection(user_id, client_id, Faker::Internet.ip_v4_address, 'client') # music_session = MusicSession.find(create_music_session(user_id)) # connection = @connman.join_music_session(user, client_id, music_session, true, TRACKS) 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 790c50567..4357897a2 100644 --- a/ruby/spec/jam_ruby/flows/monthly_recurring_lesson_spec.rb +++ b/ruby/spec/jam_ruby/flows/monthly_recurring_lesson_spec.rb @@ -33,27 +33,27 @@ describe "Monthly Recurring Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_normal(user, teacher_user, valid_recurring_slots, "Hey I've heard of you before.", true, LessonBooking::PAYMENT_STYLE_MONTHLY, 60) - booking.errors.any?.should be_false - booking.card_presumed_ok.should be_false + booking.errors.any?.should be false + booking.card_presumed_ok.should be false booking.user.should eql user - booking.card_presumed_ok.should be_false - booking.same_school.should be_false - booking.same_school_free.should be_false + booking.card_presumed_ok.should be false + booking.same_school.should be false + booking.same_school_free.should be false booking.should eql user.unprocessed_normal_lesson - booking.sent_notices.should be_false + booking.sent_notices.should be false booking.booked_price.should eql 30.00 ########## Need validate their credit card token = create_stripe_token result = user.payment_update({token: token, zip: '78759', normal: true, booking_id: booking.id}) booking.reload - booking.card_presumed_ok.should be_true - booking.errors.any?.should be_false + booking.card_presumed_ok.should be true + booking.errors.any?.should be false booking = result[:lesson] lesson = booking.lesson_sessions[0] - lesson.errors.any?.should be_false + lesson.errors.any?.should be false - booking.sent_notices.should be_true + booking.sent_notices.should be true lesson.music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson.amount_charged.should be 0.0 lesson.reload @@ -127,7 +127,7 @@ describe "Monthly Recurring Lesson Flow" do end # get acceptance emails, as well as 'your stuff is accepted' UserMailer.deliveries.length.should eql 2 - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.slot.should eql student_counter lesson_session.status.should eql LessonSession::STATUS_APPROVED @@ -162,7 +162,7 @@ describe "Monthly Recurring Lesson Flow" do LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -184,8 +184,8 @@ describe "Monthly Recurring Lesson Flow" do lesson_purchase.price_in_cents.should eql prorated_cents teacher_distribution = lesson_purchase.teacher_distribution teacher_distribution.amount_in_cents.should eql prorated_cents - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be false user.sales.length.should eql 1 sale = user.sales.first sale.stripe_charge_id.should_not be_nil @@ -204,7 +204,7 @@ describe "Monthly Recurring Lesson Flow" do TeacherPayment.count.should eql 0 TeacherPayment.hourly_check teacher_distribution.reload - teacher_distribution.distributed.should be_true + teacher_distribution.distributed.should be true TeacherPayment.count.should eql 1 payment = TeacherPayment.first payment.amount_in_cents.should eql prorated_cents @@ -229,7 +229,7 @@ describe "Monthly Recurring Lesson Flow" do # background code comes around and analyses the session LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -306,27 +306,27 @@ describe "Monthly Recurring Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_normal(user, teacher_user, valid_recurring_slots, "Hey I've heard of you before.", true, LessonBooking::PAYMENT_STYLE_MONTHLY, 60) - booking.errors.any?.should be_false - booking.card_presumed_ok.should be_false + booking.errors.any?.should be false + booking.card_presumed_ok.should be false booking.user.should eql user - booking.card_presumed_ok.should be_false - booking.same_school.should be_true - booking.same_school_free.should be_false + booking.card_presumed_ok.should be false + booking.same_school.should be true + booking.same_school_free.should be false booking.should eql user.unprocessed_normal_lesson - booking.sent_notices.should be_false + booking.sent_notices.should be false booking.booked_price.should eql 30.00 ########## Need validate their credit card token = create_stripe_token result = user.payment_update({token: token, zip: '78759', normal: true, booking_id: booking.id}) booking.reload - booking.card_presumed_ok.should be_true - booking.errors.any?.should be_false + booking.card_presumed_ok.should be true + booking.errors.any?.should be false booking = result[:lesson] lesson = booking.lesson_sessions[0] - lesson.errors.any?.should be_false + lesson.errors.any?.should be false - booking.sent_notices.should be_true + booking.sent_notices.should be true lesson.music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson.amount_charged.should be 0.0 lesson.reload @@ -400,7 +400,7 @@ describe "Monthly Recurring Lesson Flow" do end # get acceptance emails, as well as 'your stuff is accepted' UserMailer.deliveries.length.should eql 2 - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.slot.should eql student_counter lesson_session.status.should eql LessonSession::STATUS_APPROVED @@ -435,7 +435,7 @@ describe "Monthly Recurring Lesson Flow" do LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -457,12 +457,12 @@ describe "Monthly Recurring Lesson Flow" do lesson_purchase.price_in_cents.should eql prorated_cents teacher_distribution = lesson_purchase.teacher_distribution teacher_distribution.amount_in_cents.should eql prorated_cents - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be false education_distribution = lesson_purchase.education_distribution education_distribution.amount_in_cents.should eql (prorated_cents * 0.0625).round - education_distribution.ready.should be_true - education_distribution.distributed.should be_false + education_distribution.ready.should be true + education_distribution.distributed.should be false user.sales.length.should eql 1 sale = user.sales.first sale.stripe_charge_id.should_not be_nil @@ -481,7 +481,7 @@ describe "Monthly Recurring Lesson Flow" do TeacherPayment.count.should eql 0 TeacherPayment.hourly_check teacher_distribution.reload - teacher_distribution.distributed.should be_true + teacher_distribution.distributed.should be true TeacherPayment.count.should eql 2 payment = teacher_distribution.teacher_payment payment.amount_in_cents.should eql prorated_cents @@ -491,7 +491,7 @@ describe "Monthly Recurring Lesson Flow" do payment.teacher.should eql teacher_user payment.teacher_distribution.should eql teacher_distribution education_distribution.reload - education_distribution.distributed.should be_true + education_distribution.distributed.should be true education_amt = (prorated_cents * 0.0625).round payment = education_distribution.teacher_payment @@ -517,7 +517,7 @@ describe "Monthly Recurring Lesson Flow" do # background code comes around and analyses the session LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -546,18 +546,18 @@ describe "Monthly Recurring Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_normal(user, teacher_user, valid_recurring_slots, "Hey I've heard of you before.", true, LessonBooking::PAYMENT_STYLE_MONTHLY, 60) - booking.errors.any?.should be_false - booking.card_presumed_ok.should be_false + booking.errors.any?.should be false + booking.card_presumed_ok.should be false booking.user.should eql user - booking.sent_notices.should be_false + booking.sent_notices.should be false token = create_stripe_token result = user.payment_update({token: token, zip: '78759', normal: true, booking_id: booking.id}) booking.reload - booking.card_presumed_ok.should be_true - booking.errors.any?.should be_false + booking.card_presumed_ok.should be true + booking.errors.any?.should be false - booking.sent_notices.should be_true + booking.sent_notices.should be true booking.booked_price.should eql 30.00 @@ -575,7 +575,7 @@ describe "Monthly Recurring Lesson Flow" do 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 + lesson_session.errors.any?.should be false booking.reload booking.errors.any?.should be false lesson_session.lesson_booking.errors.any?.should be false @@ -628,7 +628,7 @@ describe "Monthly Recurring Lesson Flow" do end # get acceptance emails, as well as 'your stuff is accepted' UserMailer.deliveries.length.should eql 2 - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.slot.should eql student_counter lesson_session.status.should eql LessonSession::STATUS_APPROVED @@ -663,7 +663,7 @@ describe "Monthly Recurring Lesson Flow" do LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -700,7 +700,7 @@ describe "Monthly Recurring Lesson Flow" do # background code comes around and analyses the session LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW diff --git a/ruby/spec/jam_ruby/flows/normal_lesson_spec.rb b/ruby/spec/jam_ruby/flows/normal_lesson_spec.rb index a8914f3c1..8c9528eaf 100644 --- a/ruby/spec/jam_ruby/flows/normal_lesson_spec.rb +++ b/ruby/spec/jam_ruby/flows/normal_lesson_spec.rb @@ -33,12 +33,12 @@ describe "Normal Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_normal(user, teacher_user, valid_single_slots, "Hey I've heard of you before.", false, LessonBooking::PAYMENT_STYLE_SINGLE, 60) - booking.errors.any?.should be_false - booking.card_presumed_ok.should be_false + booking.errors.any?.should be false + booking.card_presumed_ok.should be false booking.user.should eql user - booking.card_presumed_ok.should be_false + booking.card_presumed_ok.should be false booking.should eql user.unprocessed_normal_lesson - booking.sent_notices.should be_false + booking.sent_notices.should be false booking.booked_price.should eql 30.00 ########## Need validate their credit card @@ -46,10 +46,10 @@ describe "Normal Lesson Flow" do result = user.payment_update({token: token, zip: '78759', normal: true, booking_id: booking.id}) booking = result[:lesson] lesson = booking.lesson_sessions[0] - booking.errors.any?.should be_false - lesson.errors.any?.should be_false - booking.card_presumed_ok.should be_true - booking.sent_notices.should be_true + booking.errors.any?.should be false + lesson.errors.any?.should be false + booking.card_presumed_ok.should be true + booking.sent_notices.should be true lesson.music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson.amount_charged.should be 0.0 lesson.reload @@ -71,7 +71,7 @@ describe "Normal Lesson Flow" do UserMailer.deliveries.clear lesson_session.accept({message: 'Yeah I got this', slot: booking.default_slot.id, update_all: false, accepter: teacher_user}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.slot.should eql booking.default_slot lesson_session.status.should eql LessonSession::STATUS_APPROVED @@ -111,7 +111,7 @@ describe "Normal Lesson Flow" do user.lesson_purchases.length.should eql 0 LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -127,15 +127,15 @@ describe "Normal Lesson Flow" do lesson_session.reload teacher_distribution = lesson_session.teacher_distribution teacher_distribution.amount_in_cents.should eql 3000 - teacher_distribution.ready.should be_false - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be false + teacher_distribution.distributed.should be false # let's reattempt right away; this should have no effect because we only try to bill once per 24 hours LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -151,7 +151,7 @@ describe "Normal Lesson Flow" do LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -167,7 +167,7 @@ describe "Normal Lesson Flow" do LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -193,11 +193,11 @@ describe "Normal Lesson Flow" do payment.fee_in_cents.should eql 0 lesson_session.billing_attempts.should eql 4 - lesson_session.post_processed.should be_true + lesson_session.post_processed.should be true LessonPaymentCharge.count.should eql 1 lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -217,8 +217,8 @@ describe "Normal Lesson Flow" do lesson_session.reload teacher_distribution = lesson_session.teacher_distribution teacher_distribution.amount_in_cents.should eql 3000 - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be false lesson_purchase = user.lesson_purchases[0] lesson_purchase.price.should eql 30.00 lesson_purchase.lesson_package_type.is_normal?.should eql true @@ -249,7 +249,7 @@ describe "Normal Lesson Flow" do TeacherPayment.hourly_check TeacherPayment.count.should eql 1 teacher_distribution.reload - teacher_distribution.distributed.should be_true + teacher_distribution.distributed.should be true payment = TeacherPayment.first payment.amount_in_cents.should eql 3000 @@ -259,8 +259,8 @@ describe "Normal Lesson Flow" do payment.teacher.should eql teacher_user payment.teacher_distribution.should eql teacher_distribution lesson_session.lesson_booking.status.should eql LessonBooking::STATUS_COMPLETED - lesson_session.lesson_booking.success.should be_true - lesson_session.teacher.has_booked_test_drive_with_student?(user).should be_false + lesson_session.lesson_booking.success.should be true + lesson_session.teacher.has_booked_test_drive_with_student?(user).should be false end end @@ -273,13 +273,13 @@ describe "Normal Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_normal(user, teacher_user, valid_single_slots, "Hey I've heard of you before.", false, LessonBooking::PAYMENT_STYLE_SINGLE, 60) - booking.errors.any?.should be_false - booking.card_presumed_ok.should be_false + booking.errors.any?.should be false + booking.card_presumed_ok.should be false booking.user.should eql user - booking.card_presumed_ok.should be_false - booking.same_school_free.should be_false + booking.card_presumed_ok.should be false + booking.same_school_free.should be false booking.should eql user.unprocessed_normal_lesson - booking.sent_notices.should be_false + booking.sent_notices.should be false booking.booked_price.should eql 30.00 ########## Need validate their credit card @@ -287,10 +287,10 @@ describe "Normal Lesson Flow" do result = user.payment_update({token: token, zip: '78759', normal: true, booking_id: booking.id}) booking = result[:lesson] lesson = booking.lesson_sessions[0] - booking.errors.any?.should be_false - lesson.errors.any?.should be_false - booking.card_presumed_ok.should be_true - booking.sent_notices.should be_true + booking.errors.any?.should be false + lesson.errors.any?.should be false + booking.card_presumed_ok.should be true + booking.sent_notices.should be true lesson.music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson.amount_charged.should eql 0.0 lesson.reload @@ -361,7 +361,7 @@ describe "Normal Lesson Flow" do UserMailer.deliveries.clear lesson_session.accept({message: 'Yeah I got this', slot: student_counter.id, update_all: false,accepter: teacher_user}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.slot.should eql student_counter lesson_session.status.should eql LessonSession::STATUS_APPROVED @@ -398,7 +398,7 @@ describe "Normal Lesson Flow" do LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -412,8 +412,8 @@ describe "Normal Lesson Flow" do teacher_distribution = lesson_session.teacher_distribution - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_true + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be true education_distribution = lesson_session.education_distribution education_distribution.should be_nil lesson_session.billed.should be true @@ -469,15 +469,15 @@ describe "Normal Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_normal(user, teacher_user, valid_single_slots, "Hey I've heard of you before.", false, LessonBooking::PAYMENT_STYLE_SINGLE, 60) - booking.errors.any?.should be_false - booking.school.should be_true - booking.card_presumed_ok.should be_false + booking.errors.any?.should be false + booking.school.should be true + booking.card_presumed_ok.should be false booking.user.should eql user - booking.same_school_free.should be_false + booking.same_school_free.should be false #user.unprocessed_normal_lesson.should be_nil - booking.sent_notices.should be_false + booking.sent_notices.should be false booking.booked_price.should eql 30.00 - booking.is_requested?.should be_true + booking.is_requested?.should be true booking.lesson_sessions[0].music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) LessonPaymentCharge.count.should eql 1 @@ -487,11 +487,11 @@ describe "Normal Lesson Flow" do result = user.payment_update({token: token, zip: '78759', normal: true, booking_id: booking.id}) booking = result[:lesson] lesson = booking.lesson_sessions[0] - booking.errors.any?.should be_false - lesson.errors.any?.should be_false - booking.card_presumed_ok.should be_true - booking.sent_notices.should be_true - booking.school.is_guitar_center?.should be_true + booking.errors.any?.should be false + lesson.errors.any?.should be false + booking.card_presumed_ok.should be true + booking.sent_notices.should be true + booking.school.is_guitar_center?.should be true lesson.music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson.amount_charged.should eql 0.0 lesson.reload @@ -561,7 +561,7 @@ describe "Normal Lesson Flow" do UserMailer.deliveries.clear lesson_session.accept({message: 'Yeah I got this', slot: student_counter.id, update_all: false, accepter: teacher_user}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.slot.should eql student_counter lesson_session.status.should eql LessonSession::STATUS_APPROVED @@ -597,11 +597,11 @@ describe "Normal Lesson Flow" do # background code comes around and analyses the session LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW - lesson_session.billed.should be_true + lesson_session.billed.should be true if lesson_session.billing_error_detail puts "testdrive flow #{lesson_session.billing_error_detail}" # this should not occur, but helps a great deal if a regression occurs and running all the tests end @@ -614,8 +614,8 @@ describe "Normal Lesson Flow" do lesson_session.reload teacher_distribution = lesson_session.teacher_distribution teacher_distribution.amount_in_cents.should eql 3000 - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be false lesson_session.teacher_distributions.count.should eql 1 education_distribution = lesson_session.education_distribution @@ -627,7 +627,7 @@ describe "Normal Lesson Flow" do user.sales.length.should eql 1 lesson_session.amount_charged.should eql 32.48 lesson_session.billing_error_reason.should be_nil - lesson_session.sent_billing_notices.should be_true + lesson_session.sent_billing_notices.should be true user.reload user.remaining_test_drives.should eql 0 UserMailer.deliveries.length.should eql 2 # one for student, one for teacher @@ -640,7 +640,7 @@ describe "Normal Lesson Flow" do TeacherDistribution.count.should eql 1 teacher_distribution.reload - teacher_distribution.distributed.should be_true + teacher_distribution.distributed.should be true payment = teacher_distribution.teacher_payment payment.amount_in_cents.should eql 3000 @@ -650,7 +650,7 @@ describe "Normal Lesson Flow" do payment.teacher.should eql teacher_user payment.teacher_distribution.should eql teacher_distribution lesson_session.lesson_booking.status.should eql LessonBooking::STATUS_COMPLETED - lesson_session.lesson_booking.success.should be_true + lesson_session.lesson_booking.success.should be true end @@ -673,15 +673,15 @@ describe "Normal Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_normal(user, teacher_user, valid_single_slots, "Hey I've heard of you before.", false, LessonBooking::PAYMENT_STYLE_SINGLE, 60) - booking.errors.any?.should be_false - booking.school.should be_true - booking.card_presumed_ok.should be_false + booking.errors.any?.should be false + booking.school.should be true + booking.card_presumed_ok.should be false booking.user.should eql user - booking.same_school_free.should be_false + booking.same_school_free.should be false #user.unprocessed_normal_lesson.should be_nil - booking.sent_notices.should be_false + booking.sent_notices.should be false booking.booked_price.should eql 30.00 - booking.is_requested?.should be_true + booking.is_requested?.should be true booking.lesson_sessions[0].music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) LessonPaymentCharge.count.should eql 1 @@ -691,10 +691,10 @@ describe "Normal Lesson Flow" do result = user.payment_update({token: token, zip: '78759', normal: true, booking_id: booking.id}) booking = result[:lesson] lesson = booking.lesson_sessions[0] - booking.errors.any?.should be_false - lesson.errors.any?.should be_false - booking.card_presumed_ok.should be_true - booking.sent_notices.should be_true + booking.errors.any?.should be false + lesson.errors.any?.should be false + booking.card_presumed_ok.should be true + booking.sent_notices.should be true lesson.music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson.amount_charged.should eql 0.0 lesson.reload @@ -764,7 +764,7 @@ describe "Normal Lesson Flow" do UserMailer.deliveries.clear lesson_session.accept({message: 'Yeah I got this', slot: student_counter.id, update_all: false, accepter: teacher_user}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.slot.should eql student_counter lesson_session.status.should eql LessonSession::STATUS_APPROVED @@ -800,11 +800,11 @@ describe "Normal Lesson Flow" do # background code comes around and analyses the session LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW - lesson_session.billed.should be_true + lesson_session.billed.should be true if lesson_session.billing_error_detail puts "testdrive flow #{lesson_session.billing_error_detail}" # this should not occur, but helps a great deal if a regression occurs and running all the tests end @@ -817,8 +817,8 @@ describe "Normal Lesson Flow" do lesson_session.reload teacher_distribution = lesson_session.teacher_distribution teacher_distribution.amount_in_cents.should eql 3000 - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be false lesson_session.teacher_distributions.count.should eql 1 education_distribution = lesson_session.education_distribution @@ -830,7 +830,7 @@ describe "Normal Lesson Flow" do user.sales.length.should eql 1 lesson_session.amount_charged.should eql 32.48 lesson_session.billing_error_reason.should be_nil - lesson_session.sent_billing_notices.should be_true + lesson_session.sent_billing_notices.should be true user.reload user.remaining_test_drives.should eql 0 UserMailer.deliveries.length.should eql 2 # one for student, one for teacher @@ -843,7 +843,7 @@ describe "Normal Lesson Flow" do TeacherDistribution.count.should eql 1 teacher_distribution.reload - teacher_distribution.distributed.should be_false + teacher_distribution.distributed.should be false payment = teacher_distribution.teacher_payment payment.amount_in_cents.should eql 3000 @@ -853,7 +853,7 @@ describe "Normal Lesson Flow" do payment.teacher.should eql teacher_user payment.teacher_distribution.should eql teacher_distribution lesson_session.lesson_booking.status.should eql LessonBooking::STATUS_COMPLETED - lesson_session.lesson_booking.success.should be_true + lesson_session.lesson_booking.success.should be true end @@ -876,15 +876,15 @@ describe "Normal Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_normal(user, teacher_user, valid_single_slots, "Hey I've heard of you before.", false, LessonBooking::PAYMENT_STYLE_SINGLE, 60) - booking.errors.any?.should be_false - booking.school.should be_true - booking.card_presumed_ok.should be_false + booking.errors.any?.should be false + booking.school.should be true + booking.card_presumed_ok.should be false booking.user.should eql user - booking.same_school_free.should be_false + booking.same_school_free.should be false #user.unprocessed_normal_lesson.should be_nil - booking.sent_notices.should be_false + booking.sent_notices.should be false booking.booked_price.should eql 30.00 - booking.is_requested?.should be_true + booking.is_requested?.should be true booking.lesson_sessions[0].music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) LessonPaymentCharge.count.should eql 1 @@ -894,10 +894,10 @@ describe "Normal Lesson Flow" do result = user.payment_update({token: token, zip: '78759', normal: true, booking_id: booking.id}) booking = result[:lesson] lesson = booking.lesson_sessions[0] - booking.errors.any?.should be_false - lesson.errors.any?.should be_false - booking.card_presumed_ok.should be_true - booking.sent_notices.should be_true + booking.errors.any?.should be false + lesson.errors.any?.should be false + booking.card_presumed_ok.should be true + booking.sent_notices.should be true lesson.music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson.amount_charged.should eql 0.0 lesson.reload @@ -967,7 +967,7 @@ describe "Normal Lesson Flow" do UserMailer.deliveries.clear lesson_session.accept({message: 'Yeah I got this', slot: student_counter.id, update_all: false, accepter: teacher_user}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.slot.should eql student_counter lesson_session.status.should eql LessonSession::STATUS_APPROVED @@ -1003,11 +1003,11 @@ describe "Normal Lesson Flow" do # background code comes around and analyses the session LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW - lesson_session.billed.should be_true + lesson_session.billed.should be true if lesson_session.billing_error_detail puts "testdrive flow #{lesson_session.billing_error_detail}" # this should not occur, but helps a great deal if a regression occurs and running all the tests end @@ -1020,14 +1020,14 @@ describe "Normal Lesson Flow" do lesson_session.reload teacher_distribution = lesson_session.teacher_distribution teacher_distribution.amount_in_cents.should eql 3000 - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be false lesson_session.teacher_distributions.count.should eql 2 education_distribution = lesson_session.education_distribution education_distribution.amount_in_cents.should eql (3000 * 0.0625).round - education_distribution.ready.should be_true - education_distribution.distributed.should be_false + education_distribution.ready.should be true + education_distribution.distributed.should be false lesson_session.billed.should be true user.reload @@ -1035,7 +1035,7 @@ describe "Normal Lesson Flow" do user.sales.length.should eql 1 lesson_session.amount_charged.should eql 32.48 lesson_session.billing_error_reason.should be_nil - lesson_session.sent_billing_notices.should be_true + lesson_session.sent_billing_notices.should be true user.reload user.remaining_test_drives.should eql 0 UserMailer.deliveries.length.should eql 2 # one for student, one for teacher @@ -1049,9 +1049,9 @@ describe "Normal Lesson Flow" do teacher_distribution.reload - teacher_distribution.distributed.should be_true + teacher_distribution.distributed.should be true education_distribution.reload - education_distribution.distributed.should be_true + education_distribution.distributed.should be true education_amt = (3000 * 0.0625).round payment = education_distribution.teacher_payment @@ -1069,7 +1069,7 @@ describe "Normal Lesson Flow" do payment.teacher.should eql teacher_user payment.teacher_distribution.should eql teacher_distribution lesson_session.lesson_booking.status.should eql LessonBooking::STATUS_COMPLETED - lesson_session.lesson_booking.success.should be_true + lesson_session.lesson_booking.success.should be true end it "works (retailer on retailer)" do @@ -1096,16 +1096,16 @@ describe "Normal Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_normal(user, teacher_user, valid_single_slots, "Hey I've heard of you before.", false, LessonBooking::PAYMENT_STYLE_SINGLE, 60) - booking.errors.any?.should be_false + booking.errors.any?.should be false booking.retailer.should eql retailer - booking.card_presumed_ok.should be_false + booking.card_presumed_ok.should be false booking.user.should eql user - booking.same_school_free.should be_false - booking.same_retailer.should be_true + booking.same_school_free.should be false + booking.same_retailer.should be true #user.unprocessed_normal_lesson.should be_nil - booking.sent_notices.should be_false + booking.sent_notices.should be false booking.booked_price.should eql 30.00 - booking.is_requested?.should be_true + booking.is_requested?.should be true booking.lesson_sessions[0].music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) LessonPaymentCharge.count.should eql 1 @@ -1115,10 +1115,10 @@ describe "Normal Lesson Flow" do result = user.payment_update({token: token, zip: '78759', normal: true, booking_id: booking.id}) booking = result[:lesson] lesson = booking.lesson_sessions[0] - booking.errors.any?.should be_false - lesson.errors.any?.should be_false - booking.card_presumed_ok.should be_true - booking.sent_notices.should be_true + booking.errors.any?.should be false + lesson.errors.any?.should be false + booking.card_presumed_ok.should be true + booking.sent_notices.should be true lesson.music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson.amount_charged.should eql 0.0 lesson.reload @@ -1188,7 +1188,7 @@ describe "Normal Lesson Flow" do UserMailer.deliveries.clear lesson_session.accept({message: 'Yeah I got this', slot: student_counter.id, update_all: false, accepter: teacher_user}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.slot.should eql student_counter lesson_session.status.should eql LessonSession::STATUS_APPROVED @@ -1224,11 +1224,11 @@ describe "Normal Lesson Flow" do # background code comes around and analyses the session LessonSession.hourly_check lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW - lesson_session.billed.should be_true + lesson_session.billed.should be true if lesson_session.billing_error_detail puts "testdrive flow #{lesson_session.billing_error_detail}" # this should not occur, but helps a great deal if a regression occurs and running all the tests end @@ -1243,15 +1243,15 @@ describe "Normal Lesson Flow" do teacher_distribution = lesson_session.teacher_distribution teacher_distribution.amount_in_cents.should eql (3000 * teacher_split_pct).round teacher_distribution.teacher_fee_in_cents.should eql (teacher_distribution.amount_in_cents * (teacher_split_pct * (retailer.jamkazam_rate + APP_CONFIG.stripe[:charge_fee]))).round - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be false lesson_session.teacher_distributions.count.should eql 2 retailer_distribution = lesson_session.retailer_distribution retailer_distribution.amount_in_cents.should eql (3000 * retailer_split_pct).round retailer_distribution.teacher_fee_in_cents.should eql (retailer_distribution.amount_in_cents * (retailer_split_pct * (retailer.jamkazam_rate + APP_CONFIG.stripe[:charge_fee]))).round - retailer_distribution.ready.should be_true - retailer_distribution.distributed.should be_false + retailer_distribution.ready.should be true + retailer_distribution.distributed.should be false lesson_session.billed.should be true user.reload @@ -1259,7 +1259,7 @@ describe "Normal Lesson Flow" do user.sales.length.should eql 1 lesson_session.amount_charged.should eql 32.48 lesson_session.billing_error_reason.should be_nil - lesson_session.sent_billing_notices.should be_true + lesson_session.sent_billing_notices.should be true user.reload user.remaining_test_drives.should eql 0 UserMailer.deliveries.length.should eql 2 # one for student, one for teacher @@ -1273,9 +1273,9 @@ describe "Normal Lesson Flow" do teacher_distribution.reload - teacher_distribution.distributed.should be_true + teacher_distribution.distributed.should be true retailer_distribution.reload - retailer_distribution.distributed.should be_true + retailer_distribution.distributed.should be true retailer_amt = (3000 * retailer_split_pct).round payment = retailer_distribution.teacher_payment @@ -1293,7 +1293,7 @@ describe "Normal Lesson Flow" do payment.teacher.should eql teacher_user payment.teacher_distribution.should eql teacher_distribution lesson_session.lesson_booking.status.should eql LessonBooking::STATUS_COMPLETED - lesson_session.lesson_booking.success.should be_true + lesson_session.lesson_booking.success.should be true end it "affiliate gets their cut" do @@ -1324,7 +1324,7 @@ describe "Normal Lesson Flow" do user.save! lesson = normal_lesson(user, teacher_user, {accept: true, finish:true}) - lesson.errors.any?.should be_false + lesson.errors.any?.should be false user.sales.count.should eql 1 user.sales[0].sale_line_items[0].affiliate_distributions.count.should eql 1 diff --git a/ruby/spec/jam_ruby/flows/recurring_lesson_spec.rb b/ruby/spec/jam_ruby/flows/recurring_lesson_spec.rb index d998a12b2..0ba06e42a 100644 --- a/ruby/spec/jam_ruby/flows/recurring_lesson_spec.rb +++ b/ruby/spec/jam_ruby/flows/recurring_lesson_spec.rb @@ -21,12 +21,12 @@ describe "Recurring Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_normal(user, teacher_user, valid_recurring_slots, "Hey I've heard of you before.", true, LessonBooking::PAYMENT_STYLE_SINGLE, 60) - booking.errors.any?.should be_false - booking.card_presumed_ok.should be_false + booking.errors.any?.should be false + booking.card_presumed_ok.should be false booking.user.should eql user - booking.card_presumed_ok.should be_false + booking.card_presumed_ok.should be false booking.should eql user.unprocessed_normal_lesson - booking.sent_notices.should be_false + booking.sent_notices.should be false booking.booked_price.should eql 30.00 ########## Need validate their credit card @@ -34,10 +34,10 @@ describe "Recurring Lesson Flow" do result = user.payment_update({token: token, zip: '78759', normal: true, booking_id: booking.id}) booking = result[:lesson] lesson = booking.lesson_sessions[0] - booking.errors.any?.should be_false - lesson.errors.any?.should be_false - booking.card_presumed_ok.should be_true - booking.sent_notices.should be_true + booking.errors.any?.should be false + lesson.errors.any?.should be false + booking.card_presumed_ok.should be true + booking.sent_notices.should be true lesson.music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson.amount_charged.should be 0.0 lesson.reload @@ -114,7 +114,7 @@ describe "Recurring Lesson Flow" do end # get acceptance emails, as well as 'your stuff is accepted' UserMailer.deliveries.length.should eql 2 - lesson_session1.errors.any?.should be_false + lesson_session1.errors.any?.should be false lesson_session1.reload lesson_session1.slot.should eql student_counter lesson_session2 = booking.lesson_sessions.order(:created_at).last @@ -159,7 +159,7 @@ describe "Recurring Lesson Flow" do # background code comes around and analyses the session LessonSession.hourly_check lesson_session1.reload - lesson_session1.analysed.should be_true + lesson_session1.analysed.should be true analysis = lesson_session1.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW diff --git a/ruby/spec/jam_ruby/flows/testdrive_lesson_spec.rb b/ruby/spec/jam_ruby/flows/testdrive_lesson_spec.rb index 82a16de48..6f020d308 100644 --- a/ruby/spec/jam_ruby/flows/testdrive_lesson_spec.rb +++ b/ruby/spec/jam_ruby/flows/testdrive_lesson_spec.rb @@ -36,13 +36,13 @@ describe "TestDrive Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_test_drive(user, teacher_user, valid_single_slots, "Hey I've heard of you before.") - booking.errors.any?.should be_false - booking.card_presumed_ok.should be_false + booking.errors.any?.should be false + booking.card_presumed_ok.should be false booking.user.should eql user - booking.card_presumed_ok.should be_false + booking.card_presumed_ok.should be false booking.should eql user.unprocessed_test_drive - booking.sent_notices.should be_false - teacher_user.has_booked_test_drive_with_student?(user).should be_true + booking.sent_notices.should be false + teacher_user.has_booked_test_drive_with_student?(user).should be true user.reload user.remaining_test_drives.should eql 0 @@ -51,18 +51,18 @@ describe "TestDrive Lesson Flow" do token = create_stripe_token result = user.payment_update({token: token, zip: '78759', test_drive: true, booking_id: booking.id}) booking = result[:lesson] - booking.errors.any?.should be_false + booking.errors.any?.should be false lesson = booking.lesson_sessions[0] - lesson.errors.any?.should be_false + lesson.errors.any?.should be false test_drive = result[:test_drive] - test_drive.errors.any?.should be_false + test_drive.errors.any?.should be false user.reload user.remaining_test_drives.should eql 1 - booking.card_presumed_ok.should be_true - booking.sent_notices.should be_true + booking.card_presumed_ok.should be true + booking.sent_notices.should be true lesson.music_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson.reload @@ -144,7 +144,7 @@ describe "TestDrive Lesson Flow" do UserMailer.deliveries.clear lesson_session.accept({message: 'Yeah I got this', slot: student_counter.id, update_all: false, accepter: teacher_user}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.slot.should eql student_counter lesson_session.status.should eql LessonSession::STATUS_APPROVED @@ -183,7 +183,7 @@ describe "TestDrive Lesson Flow" do lesson.analyse lesson.session_completed lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -206,20 +206,20 @@ describe "TestDrive Lesson Flow" do found_student_email = true end end - found_student_email.should be_true + found_student_email.should be true teacher_distribution = lesson_session.teacher_distribution teacher_distribution.amount_in_cents.should eql 1000 - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be false LessonBooking.hourly_check LessonSession.hourly_check teacher_distribution.reload teacher_distribution.amount_in_cents.should eql 1000 - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be false TeacherPayment.count.should eql 0 TeacherPayment.hourly_check @@ -237,8 +237,8 @@ describe "TestDrive Lesson Flow" do teacher_distribution.reload teacher_distribution.amount_in_cents.should eql 1000 - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_true + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be true teacher_payment.teacher_payment_charge.amount_in_cents.should eql (1000 + 1000 * APP_CONFIG.stripe[:ach_pct]).round teacher_payment.teacher_payment_charge.fee_in_cents.should eql 0 @@ -249,10 +249,10 @@ describe "TestDrive Lesson Flow" do sale.sale_line_items[0].affiliate_distributions.count.should eql 0 lesson_session.lesson_booking.status.should eql LessonBooking::STATUS_COMPLETED - lesson_session.lesson_booking.success.should be_true + lesson_session.lesson_booking.success.should be true LessonBooking.bookings(user, teacher_user, nil).count.should eql 1 LessonBooking.engaged_bookings(user, teacher_user, nil).count.should eql 1 - teacher_user.has_booked_test_drive_with_student?(user).should be_true + teacher_user.has_booked_test_drive_with_student?(user).should be true booking.reload booking.lesson_sessions.length.should eql 1 @@ -271,14 +271,14 @@ describe "TestDrive Lesson Flow" do # user has no test drives, no credit card on file, but attempts to book a lesson booking = LessonBooking.book_test_drive(user, teacher_user, valid_single_slots, "Hey I've heard of you before.") - booking.errors.any?.should be_false - booking.card_presumed_ok.should be_false + booking.errors.any?.should be false + booking.card_presumed_ok.should be false booking.user.should eql user - booking.sent_notices.should be_true + booking.sent_notices.should be true booking.posa_card.should eql card_lessons - booking.posa_card_purchased.should be_true + booking.posa_card_purchased.should be true user.unprocessed_test_drive.should be_nil - teacher_user.has_booked_test_drive_with_student?(user).should be_true + teacher_user.has_booked_test_drive_with_student?(user).should be true user.reload user.jamclass_credits.should eql 3 @@ -349,7 +349,7 @@ describe "TestDrive Lesson Flow" do UserMailer.deliveries.clear lesson_session.accept({message: 'Yeah I got this', slot: student_counter.id, update_all: false, accepter: teacher_user}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.slot.should eql student_counter lesson_session.status.should eql LessonSession::STATUS_APPROVED @@ -388,7 +388,7 @@ describe "TestDrive Lesson Flow" do lesson_session.analyse lesson_session.session_completed lesson_session.reload - lesson_session.analysed.should be_true + lesson_session.analysed.should be true analysis = lesson_session.analysis analysis["reason"].should eql LessonSessionAnalyser::STUDENT_FAULT analysis["student"].should eql LessonSessionAnalyser::NO_SHOW @@ -411,20 +411,20 @@ describe "TestDrive Lesson Flow" do found_student_email = true end end - found_student_email.should be_true + found_student_email.should be true teacher_distribution = lesson_session.teacher_distribution teacher_distribution.amount_in_cents.should eql 1000 - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be false LessonBooking.hourly_check LessonSession.hourly_check teacher_distribution.reload teacher_distribution.amount_in_cents.should eql 1000 - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_false + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be false TeacherPayment.count.should eql 0 TeacherPayment.hourly_check @@ -442,8 +442,8 @@ describe "TestDrive Lesson Flow" do teacher_distribution.reload teacher_distribution.amount_in_cents.should eql 1000 - teacher_distribution.ready.should be_true - teacher_distribution.distributed.should be_true + teacher_distribution.ready.should be true + teacher_distribution.distributed.should be true teacher_payment.teacher_payment_charge.amount_in_cents.should eql (1000 + 1000 * APP_CONFIG.stripe[:ach_pct]).round teacher_payment.teacher_payment_charge.fee_in_cents.should eql 0 @@ -454,10 +454,10 @@ describe "TestDrive Lesson Flow" do sale.sale_line_items[0].affiliate_distributions.count.should eql 0 lesson_session.lesson_booking.status.should eql LessonBooking::STATUS_COMPLETED - lesson_session.lesson_booking.success.should be_true + lesson_session.lesson_booking.success.should be true LessonBooking.bookings(user, teacher_user, nil).count.should eql 1 LessonBooking.engaged_bookings(user, teacher_user, nil).count.should eql 1 - teacher_user.has_booked_test_drive_with_student?(user).should be_true + teacher_user.has_booked_test_drive_with_student?(user).should be true end # VRFS-4069 @@ -469,9 +469,9 @@ describe "TestDrive Lesson Flow" do booking = LessonBooking.book_test_drive(user, teacher_user, slots, "Hey I've heard of you before.") - booking.errors.any?.should be_false + booking.errors.any?.should be false lesson = booking.lesson_sessions[0] - booking.card_presumed_ok.should be_false + booking.card_presumed_ok.should be false user.reload user.remaining_test_drives.should eql 0 @@ -483,7 +483,7 @@ describe "TestDrive Lesson Flow" do user.remaining_test_drives.should eql 0 booking.reload booking.status.should eql LessonBooking::STATUS_CANCELED - teacher_user.has_booked_test_drive_with_student?(user).should be_false + teacher_user.has_booked_test_drive_with_student?(user).should be false end it "cancels with credit card" do @@ -512,7 +512,7 @@ describe "TestDrive Lesson Flow" do found_student_email = true end end - found_student_email.should be_true + found_student_email.should be true end # tests that the correct emails are sent out after test drives are done @@ -530,8 +530,8 @@ describe "TestDrive Lesson Flow" do end end - found_no_credit_email.should be_true - found_no_success_email.should be_true + found_no_credit_email.should be true + found_no_success_email.should be true UserMailer.deliveries.clear user.reload @@ -556,9 +556,9 @@ describe "TestDrive Lesson Flow" do paid_but_no_show = true end end - done_not_completed.should be_true - paid_but_no_show.should be_true - completed_test_drive.should be_false + done_not_completed.should be true + paid_but_no_show.should be true + completed_test_drive.should be false UserMailer.deliveries.clear @@ -580,8 +580,8 @@ describe "TestDrive Lesson Flow" do end # You successfully completed a lesson with #{@student.name}" - completed_test_drive.should be_true - paid.should be_true + completed_test_drive.should be true + paid.should be true end end diff --git a/ruby/spec/jam_ruby/lib/elasticsearch_spec.rb b/ruby/spec/jam_ruby/lib/elasticsearch_spec.rb index cadc42d79..10ee4c008 100644 --- a/ruby/spec/jam_ruby/lib/elasticsearch_spec.rb +++ b/ruby/spec/jam_ruby/lib/elasticsearch_spec.rb @@ -506,6 +506,6 @@ describe "Elasticsearch"do #client.smash_indices succeeded = JamRuby::ElasticSearch.new.session_ratings(music_session, me, body) #SearchClient.index(id: tag.id, index: "tags_development", body: string) - succeeded.should be_true + succeeded.should be true end end 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 941053dd3..d96f80392 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 @@ -38,7 +38,7 @@ describe EmailNewMusicianMatch do it "does not sent to whom have not been opted to receive emails" do JamRuby::EmailNewMusicianMatch.send_new_musicians - ActionMailer::Base.deliveries.map{|d| d['to'].to_s }.include?("david@example.com").should be_falsey + ActionMailer::Base.deliveries.map{|d| d['to'].to_s }.include?("david@example.com").should be falsey end it "delivers the new musicians notification email" do diff --git a/ruby/spec/jam_ruby/lib/profanity_spec.rb b/ruby/spec/jam_ruby/lib/profanity_spec.rb index 4da77b657..562d908fc 100644 --- a/ruby/spec/jam_ruby/lib/profanity_spec.rb +++ b/ruby/spec/jam_ruby/lib/profanity_spec.rb @@ -5,25 +5,25 @@ describe Profanity do describe "profanity_filter" do it "can handle a nil input" do - Profanity.is_profane?(nil).should be_false + Profanity.is_profane?(nil).should be false end it "can handle a blank input" do - Profanity.is_profane?('').should be_false + Profanity.is_profane?('').should be false end it "can handle a clean input" do - Profanity.is_profane?('you are a clean input').should be_false + Profanity.is_profane?('you are a clean input').should be false end it "can handle a profane input" do - Profanity.is_profane?('fuck you!').should be_true + Profanity.is_profane?('fuck you!').should be true end it "is not fooled by punctuation" do - Profanity.is_profane?('fuck-you!').should be_true - Profanity.is_profane?('???$$fuck-you!').should be_true - Profanity.is_profane?('--!fuck-you!').should be_true + Profanity.is_profane?('fuck-you!').should be true + Profanity.is_profane?('???$$fuck-you!').should be true + Profanity.is_profane?('--!fuck-you!').should be true end end 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 db790b633..01b18ee6a 100644 --- a/ruby/spec/jam_ruby/models/active_music_session_spec.rb +++ b/ruby/spec/jam_ruby/models/active_music_session_spec.rb @@ -19,7 +19,7 @@ describe ActiveMusicSession do begin ActiveMusicSession.participant_create(user, music_session.id, "junk", true, nil, 5) - false.should be_true + false.should be true rescue JamRuby::JamRecordNotFound => e e.record_type.should eql "Connection" e.missing_message.should eql "Unable to find connection by client_id junk" @@ -483,9 +483,9 @@ describe ActiveMusicSession do it "offset/limit" do # put creators in the session creator_conn_1.join_the_session(music_session_1.music_session, true, tracks, creator_1, 10) - creator_conn_1.errors.any?.should be_false + creator_conn_1.errors.any?.should be false creator_conn_2.join_the_session(music_session_2.music_session, true, tracks, creator_2, 10) - creator_conn_2.errors.any?.should be_false + creator_conn_2.errors.any?.should be false music_sessions = ActiveMusicSession.friend_active_index(searcher_1, {}) music_sessions.length.should == 2 @@ -643,9 +643,9 @@ describe ActiveMusicSession do it "offset/limit" do # put creators in the session creator_conn_1.join_the_session(music_session_1.music_session, true, tracks, creator_1, 10) - creator_conn_1.errors.any?.should be_false + creator_conn_1.errors.any?.should be false creator_conn_2.join_the_session(music_session_2.music_session, true, tracks, creator_2, 10) - creator_conn_2.errors.any?.should be_false + creator_conn_2.errors.any?.should be false # set up some scores to control sorting Score.createx(searcher_conn_1.locidispid, searcher_conn_1.client_id, searcher_conn_1.addr, creator_conn_1.locidispid, creator_conn_1.client_id, creator_conn_1.addr, good_network_score, nil) @@ -835,7 +835,7 @@ describe ActiveMusicSession do it "is_recording? returns false if not recording" do user1 = FactoryBot.create(:user) music_session = FactoryBot.build(:active_music_session, :creator => user1) - music_session.is_recording?.should be_false + music_session.is_recording?.should be false end @@ -856,7 +856,7 @@ describe ActiveMusicSession do it "allow a jam track to be associated" do # simple success case; just open the jam track and observe the state of the session is correct @music_session.open_jam_track(@user1, @jam_track) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.reload @music_session.jam_track.should == @jam_track @music_session.jam_track_initiator.should == @user1 @@ -865,9 +865,9 @@ describe ActiveMusicSession do it "allow a jam track to be closed" do # simple success case; close an opened jam track and observe the state of the session is correct @music_session.open_jam_track(@user1, @jam_track) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.close_jam_track - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.reload @music_session.jam_track.should be_nil @music_session.jam_track_initiator.should be_nil @@ -877,34 +877,34 @@ describe ActiveMusicSession do pending "needs fixing" # if a jam track is open, don't allow another to be opened @music_session.open_jam_track(@user1, @jam_track) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.open_jam_track(@user1, @jam_track) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:jam_track] == [ValidationMessages::JAM_TRACK_ALREADY_OPEN] end it "disallow a jam track to be opened when recording is ongoing" do @recording = Recording.start(@music_session, @user1) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.open_jam_track(@user1, @jam_track) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:jam_track] == [ValidationMessages::RECORDING_ALREADY_IN_PROGRESS] end it "disallow a jam track to be opened when recording is playing back" do # create a recording, and open it for play back @recording = Recording.start(@music_session, @user1) - @recording.errors.any?.should be_false + @recording.errors.any?.should be false @recording.stop @recording.reload @claimed_recording = @recording.claim(@user1, "name", "description", Genre.first, true) - @claimed_recording.errors.any?.should be_false + @claimed_recording.errors.any?.should be false @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false # while it's open, try to open a jam track @music_session.open_jam_track(@user1, @jam_track) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:jam_track] == [ValidationMessages::CLAIMED_RECORDING_ALREADY_IN_PROGRESS] end @@ -936,7 +936,7 @@ describe ActiveMusicSession do end it "is_recording? returns true if recording" do - @music_session.is_recording?.should be_true + @music_session.is_recording?.should be true end it "stop_recording should return recording object if recording" do @@ -948,16 +948,16 @@ describe ActiveMusicSession do before(:each) do @recording = Recording.start(@music_session, @user1) - @recording.errors.any?.should be_false + @recording.errors.any?.should be false @recording.stop @recording.reload @claimed_recording = @recording.claim(@user1, "name", "description", Genre.first, true) - @claimed_recording.errors.any?.should be_false + @claimed_recording.errors.any?.should be false end it "allow a claimed recording to be associated" do @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.reload @music_session.claimed_recording.should == @claimed_recording @music_session.claimed_recording_initiator.should == @user1 @@ -965,9 +965,9 @@ describe ActiveMusicSession do it "allow a claimed recording to be removed" do @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.claimed_recording_stop - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.reload @music_session.claimed_recording.should be_nil @music_session.claimed_recording_initiator.should be_nil @@ -976,9 +976,9 @@ describe ActiveMusicSession do it "disallow a claimed recording to be started when already started by someone else" do @user2 = FactoryBot.create(:user) @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.claimed_recording_start(@user2, @claimed_recording) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:claimed_recording] == [ValidationMessages::CLAIMED_RECORDING_ALREADY_IN_PROGRESS] end @@ -986,9 +986,9 @@ describe ActiveMusicSession do @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 + @music_session.errors.any?.should be false @music_session.claimed_recording_start(@user1, @claimed_recording2) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true end it "disallow a claimed recording to be started when jam track is open" do @@ -996,11 +996,11 @@ describe ActiveMusicSession do @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 + @music_session.errors.any?.should be false # and try to open a recording for playback @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:claimed_recording] == [ValidationMessages::JAM_TRACK_ALREADY_OPEN] end @@ -1009,22 +1009,22 @@ describe ActiveMusicSession do # open the backing track @backing_track = "foo.mp3" @music_session.open_backing_track(@user1, @backing_track) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false # and try to open a recording for playback @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:claimed_recording] == [ValidationMessages::BACKING_TRACK_ALREADY_OPEN] end it "disallow a claimed recording to be started when metronome is open" do # open the metronome @music_session.open_metronome(@user1) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false # and try to open a recording for playback @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:claimed_recording] == [ValidationMessages::METRONOME_ALREADY_OPEN] end end @@ -1090,27 +1090,27 @@ describe ActiveMusicSession do it "joins the session with no video" do creator_conn_1.join_the_session(music_session_1.music_session, true, tracks, creator_1, 10) - creator_conn_1.errors.any?.should be_false + creator_conn_1.errors.any?.should be false music_sessions = ActiveMusicSession.index(creator_1) music_sessions.should_not be_nil music_sessions.length.should == 1 - music_sessions[0].connections.should have(1).items - music_sessions[0].connections.should have(1).items - music_sessions[0].connections[0].tracks.should have(1).items - music_sessions[0].connections[0].video_sources.should have(0).items + music_sessions[0].connections.size.should == 1 + music_sessions[0].connections.size.should == 1 + music_sessions[0].connections[0].tracks.size.should == 1 + music_sessions[0].connections[0].video_sources.size.should == 0 end it "joins the session with video" do creator_conn_1.join_the_session(music_session_1.music_session, true, tracks, creator_1, 10, nil, nil, videos) - creator_conn_1.errors.any?.should be_false + creator_conn_1.errors.any?.should be false music_sessions = ActiveMusicSession.index(creator_1) music_sessions.should_not be_nil music_sessions.length.should == 1 - creator_conn_1.video_sources.should have(1).items - music_sessions[0].connections.should have(1).items - music_sessions[0].connections[0].video_sources.should have(1).items - music_sessions[0].connections[0].tracks.should have(1).items + creator_conn_1.video_sources.size.should == 1 + music_sessions[0].connections.size.should == 1 + music_sessions[0].connections[0].video_sources.size.should == 1 + music_sessions[0].connections[0].tracks.size.should == 1 end end @@ -1130,7 +1130,7 @@ describe ActiveMusicSession do it "allow a backing track to be associated" do # simple success case; just open the backing track and observe the state of the session is correct @music_session.open_backing_track(@user1, @backing_track) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.reload @music_session.backing_track_path.should == @backing_track @music_session.backing_track_initiator.should == @user1 @@ -1139,9 +1139,9 @@ describe ActiveMusicSession do it "allow a backing track to be closed" do # simple success case; close an opened backing track and observe the state of the session is correct @music_session.open_backing_track(@user1, @backing_track) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.close_backing_track - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.reload @music_session.backing_track_path.should be_nil @music_session.backing_track_initiator.should be_nil @@ -1150,34 +1150,34 @@ describe ActiveMusicSession do it "disallow a backing track to be opened when another is already opened" do # if a backing track is open, don't allow another to be opened @music_session.open_backing_track(@user1, @backing_track) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.open_backing_track(@user1, @backing_track) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:backing_track] == [ValidationMessages::BACKING_TRACK_ALREADY_OPEN] end it "disallow a backing track to be opened when recording is ongoing" do @recording = Recording.start(@music_session, @user1) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.open_backing_track(@user1, @backing_track) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:backing_track] == [ValidationMessages::RECORDING_ALREADY_IN_PROGRESS] end it "disallow a backing track to be opened when recording is playing back" do # create a recording, and open it for play back @recording = Recording.start(@music_session, @user1) - @recording.errors.any?.should be_false + @recording.errors.any?.should be false @recording.stop @recording.reload @claimed_recording = @recording.claim(@user1, "name", "description", Genre.first, true) - @claimed_recording.errors.any?.should be_false + @claimed_recording.errors.any?.should be false @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false # while it's open, try to open a jam track @music_session.open_backing_track(@user1, @backing_track) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:backing_track] == [ValidationMessages::CLAIMED_RECORDING_ALREADY_IN_PROGRESS] end @@ -1226,7 +1226,7 @@ describe ActiveMusicSession do it "allow a metronome to be activated" do # simple success case; just open the metronome and observe the state of the session is correct @music_session.open_metronome(@user1) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.reload @music_session.metronome_active.should == true @music_session.metronome_initiator.should == @user1 @@ -1235,36 +1235,36 @@ describe ActiveMusicSession do it "allow a metronome to be closed" do # simple success case; close an opened metronome and observe the state of the session is correct @music_session.open_metronome(@user1) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.close_metronome - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.reload - @music_session.metronome_active.should be_false + @music_session.metronome_active.should be false @music_session.metronome_initiator.should be_nil end it "disallow a metronome to be opened when recording is ongoing" do @recording = Recording.start(@music_session, @user1) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.open_metronome(@user1) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:metronome] == [ValidationMessages::RECORDING_ALREADY_IN_PROGRESS] end it "disallow a metronome to be opened when recording is playing back" do # create a recording, and open it for play back @recording = Recording.start(@music_session, @user1) - @recording.errors.any?.should be_false + @recording.errors.any?.should be false @recording.stop @recording.reload @claimed_recording = @recording.claim(@user1, "name", "description", Genre.first, true) - @claimed_recording.errors.any?.should be_false + @claimed_recording.errors.any?.should be false @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false # while it's open, try to open a jam track @music_session.open_metronome(@user1) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:metronome] == [ValidationMessages::CLAIMED_RECORDING_ALREADY_IN_PROGRESS] end diff --git a/ruby/spec/jam_ruby/models/affiliate_partner_spec.rb b/ruby/spec/jam_ruby/models/affiliate_partner_spec.rb index 1d8ea0435..c9897a640 100644 --- a/ruby/spec/jam_ruby/models/affiliate_partner_spec.rb +++ b/ruby/spec/jam_ruby/models/affiliate_partner_spec.rb @@ -39,7 +39,7 @@ describe AffiliatePartner do it "user-partner association" do user_partner = FactoryBot.create(:user, affiliate_partner: partner) user_partner.affiliate_partner.should_not be_nil - user_partner.affiliate_partner.present?.should be_true + user_partner.affiliate_partner.present?.should be true end it 'has user referrals' do @@ -109,7 +109,7 @@ describe AffiliatePartner do it "user with no affiliate relationship" do shopping_cart = ShoppingCart.create user, jam_track, 1 - user.should_attribute_sale?(shopping_cart).should be_false + user.should_attribute_sale?(shopping_cart).should be false end it "user with an affiliate relationship buying a JamTrack" do @@ -140,23 +140,23 @@ describe AffiliatePartner do user.created_at = (365 * 3 + 1).days.ago user.save! shopping_cart = ShoppingCart.create user, jam_track, 1, false - user.should_attribute_sale?(shopping_cart).should be_false + user.should_attribute_sale?(shopping_cart).should be false end end describe "created_within_affiliate_window" do it "user created very recently" do - partner.created_within_affiliate_window(user, Time.now).should be_true + partner.created_within_affiliate_window(user, Time.now).should be true end it "user created 3 years, 1 day ago" do days_future = 365 * 3 + 1 - partner.created_within_affiliate_window(user, days_future.days.from_now).should be_false + partner.created_within_affiliate_window(user, days_future.days.from_now).should be false end it "user created 1 day before 3 years" do days_future = 365 * 3 - 1 - partner.created_within_affiliate_window(user, days_future.days.from_now).should be_true + partner.created_within_affiliate_window(user, days_future.days.from_now).should be true end end @@ -677,35 +677,35 @@ describe AffiliatePartner do quarter_previous = AffiliateQuarterlyPayment.find_by_quarter_and_year_and_affiliate_partner_id!(3, 2014, partner1.id) quarter_previous.due_amount_in_cents.should eq(0) - quarter_previous.closed.should be_true + quarter_previous.closed.should be true quarter = AffiliateQuarterlyPayment.find_by_quarter_and_year_and_affiliate_partner_id!(0, 2015, partner1.id) quarter.due_amount_in_cents.should eq(0) - quarter.closed.should be_false + quarter.closed.should be false month_previous= AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(10, 2014, partner1.id) month_previous.due_amount_in_cents.should eq(0) - month_previous.closed.should be_true + month_previous.closed.should be true month_previous.jamtracks_sold.should eq(0) month_previous= AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(11, 2014, partner1.id) month_previous.due_amount_in_cents.should eq(0) - month_previous.closed.should be_true + month_previous.closed.should be true month_previous.jamtracks_sold.should eq(0) month_previous= AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(12, 2014, partner1.id) month_previous.due_amount_in_cents.should eq(0) - month_previous.closed.should be_true + month_previous.closed.should be true month_previous.jamtracks_sold.should eq(0) month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(1, 2015, partner1.id) month_previous.due_amount_in_cents.should eq(0) - month_previous.closed.should be_true + month_previous.closed.should be true month_previous.jamtracks_sold.should eq(0) month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(2, 2015, partner1.id) month_previous.due_amount_in_cents.should eq(0) - month_previous.closed.should be_true + month_previous.closed.should be true month.jamtracks_sold.should eq(0) month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(3, 2015, partner1.id) month_previous.due_amount_in_cents.should eq(0) - month_previous.closed.should be_true + month_previous.closed.should be true month_previous.jamtracks_sold.should eq(0) @@ -722,36 +722,36 @@ describe AffiliatePartner do quarter = AffiliateQuarterlyPayment.find_by_quarter_and_year_and_affiliate_partner_id!(0, 2015, partner1.id) quarter.due_amount_in_cents.should eq(0) quarter.jamtracks_sold.should eq(0) - quarter.closed.should be_true + quarter.closed.should be true quarter2 = AffiliateQuarterlyPayment.find_by_quarter_and_year_and_affiliate_partner_id!(1, 2015, partner1.id) quarter2.due_amount_in_cents.should eq(25) quarter2.jamtracks_sold.should eq(1) - quarter2.closed.should be_false + quarter2.closed.should be false month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(1, 2015, partner1.id) month.due_amount_in_cents.should eq(0) month.jamtracks_sold.should eq(0) - month.closed.should be_true + month.closed.should be true month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(2, 2015, partner1.id) month.due_amount_in_cents.should eq(0) month.jamtracks_sold.should eq(0) - month.closed.should be_true + month.closed.should be true month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(3, 2015, partner1.id) month.due_amount_in_cents.should eq(0) month.jamtracks_sold.should eq(0) - month.closed.should be_true + month.closed.should be true month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(4, 2015, partner1.id) month.due_amount_in_cents.should eq(25) month.jamtracks_sold.should eq(1) - month.closed.should be_false + month.closed.should be false month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(5, 2015, partner1.id) month.due_amount_in_cents.should eq(0) month.jamtracks_sold.should eq(0) - month.closed.should be_false + month.closed.should be false month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(6, 2015, partner1.id) month.due_amount_in_cents.should eq(0) month.jamtracks_sold.should eq(0) - month.closed.should be_false + month.closed.should be false # now sneak in a purchase in the 1st quarter, which makes no sense, but proves that closed quarters are not touched @@ -767,19 +767,19 @@ describe AffiliatePartner do quarter = AffiliateQuarterlyPayment.find_by_quarter_and_year_and_affiliate_partner_id!(0, 2015, partner1.id) quarter.due_amount_in_cents.should eq(0) quarter.jamtracks_sold.should eq(0) - quarter.closed.should be_true + quarter.closed.should be true month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(1, 2015, partner1.id) month.due_amount_in_cents.should eq(0) - month.closed.should be_true + month.closed.should be true month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(2, 2015, partner1.id) month.due_amount_in_cents.should eq(0) month.jamtracks_sold.should eq(0) - month.closed.should be_true + month.closed.should be true month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(3, 2015, partner1.id) month.due_amount_in_cents.should eq(0) month.jamtracks_sold.should eq(0) - month.closed.should be_true + month.closed.should be true end it "successive for affiliate subscriptions and JamTrack Sales" do @@ -816,40 +816,40 @@ describe AffiliatePartner do quarter_previous = AffiliateQuarterlyPayment.find_by_quarter_and_year_and_affiliate_partner_id!(3, 2014, partner1.id) quarter_previous.due_amount_in_cents.should eq(0) - quarter_previous.closed.should be_true + quarter_previous.closed.should be true quarter = AffiliateQuarterlyPayment.find_by_quarter_and_year_and_affiliate_partner_id!(0, 2015, partner1.id) quarter.due_amount_in_cents.should eq(55) - quarter.closed.should be_false + quarter.closed.should be false month_previous= AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(10, 2014, partner1.id) month_previous.due_amount_in_cents.should eq(0) - month_previous.closed.should be_true + month_previous.closed.should be true month_previous.jamtracks_sold.should eq(0) month_previous= AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(11, 2014, partner1.id) month_previous.due_amount_in_cents.should eq(0) - month_previous.closed.should be_true + month_previous.closed.should be true month_previous.jamtracks_sold.should eq(0) month_previous= AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(12, 2014, partner1.id) month_previous.due_amount_in_cents.should eq(0) - month_previous.closed.should be_true + month_previous.closed.should be true month_previous.jamtracks_sold.should eq(0) month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(1, 2015, partner1.id) month.due_amount_in_cents.should eq(55) - month.closed.should be_false + month.closed.should be false month.jamtracks_sold.should eq(1) month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(2, 2015, partner1.id) month.due_amount_in_cents.should eq(0) - month.closed.should be_false + month.closed.should be false month.jamtracks_sold.should eq(0) month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(3, 2015, partner1.id) month.due_amount_in_cents.should eq(0) - month.closed.should be_false + month.closed.should be false month.jamtracks_sold.should eq(0) #user of partner 1 purchases a JamTrack in 1st quarter, which makes no sense, but proves that closed quarters are not touched @@ -865,22 +865,22 @@ describe AffiliatePartner do month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(1, 2015, partner1.id) month.due_amount_in_cents.should eq(55) - month.closed.should be_true + month.closed.should be true month.jamtracks_sold.should eq(1) month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(2, 2015, partner1.id) month.due_amount_in_cents.should eq(0) - month.closed.should be_true + month.closed.should be true month.jamtracks_sold.should eq(0) month = AffiliateMonthlyPayment.find_by_month_and_year_and_affiliate_partner_id!(3, 2015, partner1.id) month.due_amount_in_cents.should eq(0) #because this quarter has been closed before - month.closed.should be_true + month.closed.should be true month.jamtracks_sold.should eq(0) quarter = AffiliateQuarterlyPayment.find_by_quarter_and_year_and_affiliate_partner_id!(0, 2015, partner1.id) quarter.due_amount_in_cents.should eq(55) - quarter.closed.should be_true + quarter.closed.should be true quarter.jamtracks_sold.should eq(1) end @@ -1031,10 +1031,10 @@ describe AffiliatePartner do AffiliatePartner.tally_up(last_day_of_year) AffiliatePartner.tally_up(first_day_of_next_year) quarterly_payment = AffiliateQuarterlyPayment.where(year: 2016, quarter: 0, affiliate_partner_id: partner.id).first - quarterly_payment.closed.should be_false + quarterly_payment.closed.should be false AffiliatePartner.tally_up(Date.new(2016, 01, 02)) quarterly_payment.reload - quarterly_payment.closed.should be_false + quarterly_payment.closed.should be false end end 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 f59cd5e51..492470a25 100644 --- a/ruby/spec/jam_ruby/models/affiliate_referral_visit_spec.rb +++ b/ruby/spec/jam_ruby/models/affiliate_referral_visit_spec.rb @@ -19,22 +19,22 @@ describe AffiliateReferralVisit do describe "track" do it "succeeds" do visit = AffiliateReferralVisit.track( valid_track_options ) - visit.valid?.should be_true + visit.valid?.should be true end it "never fails with error" do visit = AffiliateReferralVisit.track( {}) - visit.valid?.should be_false + visit.valid?.should be false options = valid_track_options options[:affiliate_id] = 111 visit = AffiliateReferralVisit.track( options) - visit.valid?.should be_true + visit.valid?.should be true options = valid_track_options options[:current_user] = user visit = AffiliateReferralVisit.track( options) - visit.valid?.should be_true + visit.valid?.should be true end end end diff --git a/ruby/spec/jam_ruby/models/band_location_spec.rb b/ruby/spec/jam_ruby/models/band_location_spec.rb index b219ab4c4..29bf533f8 100644 --- a/ruby/spec/jam_ruby/models/band_location_spec.rb +++ b/ruby/spec/jam_ruby/models/band_location_spec.rb @@ -18,7 +18,7 @@ describe Band do it "should have updated lat/lng values" do pending 'distance search changes' - @band.update_attributes({ :city => @geocode2.city, + @band.update({ :city => @geocode2.city, :state => @geocode2.region, :country => @geocode2.country, }) @@ -32,7 +32,7 @@ describe Band do pending 'distance search changes' it "should have nil lat/lng values without address" do @band.skip_location_validation = true - @band.update_attributes({ :city => nil, + @band.update({ :city => nil, :state => nil, :country => nil, }) diff --git a/ruby/spec/jam_ruby/models/band_spec.rb b/ruby/spec/jam_ruby/models/band_spec.rb index b202d1019..07b13f99e 100644 --- a/ruby/spec/jam_ruby/models/band_spec.rb +++ b/ruby/spec/jam_ruby/models/band_spec.rb @@ -33,15 +33,15 @@ describe Band do describe 'with instruments' do it 'builds with instruments' do band.musician_instruments << FactoryBot.build(:musician_instrument, player: band) - band.musician_instruments.should have(1).items - band.instruments.should have(1).items + band.musician_instruments.size.should == 1 + band.instruments.size.should == 1 end it 'creates with instruments' do FactoryBot.create(:musician_instrument, player: band) band.reload - band.musician_instruments.should have(1).items - band.instruments.should have(1).items + band.musician_instruments.size.should == 1 + band.instruments.size.should == 1 end end @@ -55,16 +55,16 @@ describe Band do describe 'band validations' do it "minimum genres" do - new_band.save.should be_false + new_band.save.should be false new_band.errors[:genres].should == [ValidationMessages::BAND_GENRE_MINIMUM_NOT_MET] new_band.genres = [Genre.first] - new_band.save.should be_true + new_band.save.should be true end it "maximum genres" do new_band.genres = Genre.limit(4) - new_band.save.should be_false + new_band.save.should be false new_band.errors[:genres].should == [ValidationMessages::BAND_GENRE_LIMIT_EXCEEDED] end end @@ -72,23 +72,23 @@ describe Band do describe "save" do it "genres validate" do band=Band.save(user, band_params_no_genre) - band.errors.any?.should be_true + band.errors.any?.should be true band.errors[:genres].should == [ValidationMessages::BAND_GENRE_MINIMUM_NOT_MET] band = Band.save(user, band_params) - band.errors.any?.should be_false + band.errors.any?.should be false # Save again without a genre and make sure we get an error: p = band_params_no_genre.clone p[:id] = band.id band = Band.save(user, p) - band.errors.any?.should be_true + band.errors.any?.should be true band.errors[:genres].should == [ValidationMessages::BAND_GENRE_MINIMUM_NOT_MET] end it "can succeed" do band = Band.save(user, band_params) - band.errors.any?.should be_false + band.errors.any?.should be false band.name.should == band_params[:name] band.biography.should == band_params[:biography] band.genres.should == [Genre.find(band_params[:genres][0])] @@ -110,7 +110,7 @@ describe Band do parms[:concert_count]=3 band = Band.save(user, parms) - band.errors.any?.should be_false + band.errors.any?.should be false band.paid_gigs.should == true band.free_gigs.should == false @@ -130,17 +130,17 @@ describe Band do it "can update" do band = Band.save(user, band_params) - band.errors.any?.should be_false + band.errors.any?.should be false band_params[:id] = band.id band_params[:name] = "changed name" band = Band.save(user, band_params) - band.errors.any?.should be_false + band.errors.any?.should be false Band.find(band.id).name.should == band_params[:name] end it "stops non-members from updating" do band = Band.save(user, band_params) - band.errors.any?.should be_false + band.errors.any?.should be false band_params[:id] = band.id band_params[:name] = "changed name" expect{ Band.save(user2, band_params) }.to raise_error(ValidationMessages::USER_NOT_BAND_MEMBER_VALIDATION_ERROR) @@ -150,13 +150,13 @@ describe Band do describe "validate" do it "can pass" do band = Band.build_band(user, band_params) - band.valid?.should be_true + band.valid?.should be true end it "can fail" do band_params[:name] = nil band = Band.build_band(user, band_params) - band.valid?.should be_false + band.valid?.should be false band.errors[:name].should == ["can't be blank"] end end @@ -189,8 +189,8 @@ describe Band do band_in_austin.reload # you don't know which GeoIpLocation it'll be. So we need to check both - [30.2076, 32.7825].include?(band_in_austin.lat).should be_true - [-97.8587, -96.8207].include?(band_in_austin.lng).should be_true + [30.2076, 32.7825].include?(band_in_austin.lat).should be true + [-97.8587, -96.8207].include?(band_in_austin.lng).should be true end it "updates to null if no matching location available" do diff --git a/ruby/spec/jam_ruby/models/claimed_recording_spec.rb b/ruby/spec/jam_ruby/models/claimed_recording_spec.rb index 676c94949..78aadff27 100644 --- a/ruby/spec/jam_ruby/models/claimed_recording_spec.rb +++ b/ruby/spec/jam_ruby/models/claimed_recording_spec.rb @@ -32,9 +32,9 @@ describe ClaimedRecording do it "with default case" do valid_claimed_recording make_claim - @claimed_recording.errors.any?.should be_false + @claimed_recording.errors.any?.should be false @recording.reload - @recording.recorded_tracks.first.discard.should be_false + @recording.recorded_tracks.first.discard.should be false end end @@ -43,7 +43,7 @@ describe ClaimedRecording do valid_claimed_recording @name = nil make_claim - @claimed_recording.errors.any?.should be_true + @claimed_recording.errors.any?.should be true @claimed_recording.errors[:name].length.should == 2 @claimed_recording.errors[:name].select { |value| value.include?("can't be blank") }.length.should == 1 @claimed_recording.errors[:name].select { |value| value.include?("is too short") }.length.should == 1 @@ -55,7 +55,7 @@ describe ClaimedRecording do valid_claimed_recording @name = "a" make_claim - @claimed_recording.errors.any?.should be_true + @claimed_recording.errors.any?.should be true @claimed_recording.errors[:name].length.should == 1 @claimed_recording.errors[:name].select { |value| value.include?("is too short") }.length.should == 1 end @@ -66,7 +66,7 @@ describe ClaimedRecording do valid_claimed_recording @description = nil make_claim - @claimed_recording.errors.any?.should be_false + @claimed_recording.errors.any?.should be false end end @@ -75,7 +75,7 @@ describe ClaimedRecording do valid_claimed_recording @is_public = nil make_claim - @claimed_recording.errors.any?.should be_true + @claimed_recording.errors.any?.should be true @claimed_recording.errors[:is_public].length.should == 1 @claimed_recording.errors[:is_public].should == ["is not included in the list"] end @@ -86,7 +86,7 @@ describe ClaimedRecording do valid_claimed_recording @genre = nil make_claim - @claimed_recording.errors.any?.should be_true + @claimed_recording.errors.any?.should be true @claimed_recording.errors[:genre].length.should == 1 @claimed_recording.errors[:genre].should == ["can't be blank"] end @@ -97,7 +97,7 @@ describe ClaimedRecording do valid_claimed_recording make_claim duplicate = @recording.claim(@user, "name", "description", @genre, true) - duplicate.valid?.should be_false + duplicate.valid?.should be false duplicate.errors[:user_id].should == ['has already been taken'] end end diff --git a/ruby/spec/jam_ruby/models/connection_spec.rb b/ruby/spec/jam_ruby/models/connection_spec.rb index 465b3716a..37dcae03a 100644 --- a/ruby/spec/jam_ruby/models/connection_spec.rb +++ b/ruby/spec/jam_ruby/models/connection_spec.rb @@ -18,7 +18,7 @@ describe JamRuby::Connection do :ip_address => "1.1.1.1", :client_id => "1") - connection.idle?.should be_true + connection.idle?.should be true end it 'transitions properly' do @@ -29,15 +29,15 @@ describe JamRuby::Connection do :client_id => "1") connection.connect! - connection.connected?.should be_true + connection.connected?.should be true connection.state_message.should == 'Connected' connection.stale! - connection.stale?.should be_true + connection.stale?.should be true connection.state_message.should == 'Stale' connection.expire! - connection.destroyed?.should be_true + connection.destroyed?.should be true end it 'updates user lat/lng' do @@ -63,13 +63,13 @@ describe JamRuby::Connection do it "prevent negative or 0" do conn.last_jam_audio_latency = 0 - conn.save.should be_false + conn.save.should be false conn.errors[:last_jam_audio_latency].should == ['must be greater than 0'] end it "prevent non numerical" do conn.last_jam_audio_latency = 'a' - conn.save.should be_false + conn.save.should be false conn.errors[:last_jam_audio_latency].should == ['is not a number'] end end @@ -77,29 +77,29 @@ describe JamRuby::Connection do describe "triggers" do describe "manage_user_online" do it "offline for new user" do - user.online.should be_false + user.online.should be false end it "online/offline based on connection up/down" do conn.touch # make a connection user.reload - user.online.should be_true + user.online.should be true conn.delete user.reload - user.online.should be_false + user.online.should be false end it "verify that online up/down is only for affected user (no spillover)" do user2 = FactoryBot.create(:user) - user2.online.should be_false + user2.online.should be false conn.touch user.reload user2.reload - user.online.should be_true - user2.online.should be_false # make sure there is no spillover to unrelated users + user.online.should be true + user2.online.should be false # make sure there is no spillover to unrelated users conn2 = FactoryBot.create(:connection, :user => user2, @@ -110,21 +110,21 @@ describe JamRuby::Connection do user.reload user2.reload - user.online.should be_true - user2.online.should be_true + user.online.should be true + user2.online.should be true # whack one of the connections conn.delete user.reload user2.reload - user.online.should be_false - user2.online.should be_true + user.online.should be false + user2.online.should be true conn2.delete user.reload user2.reload - user.online.should be_false - user2.online.should be_false + user.online.should be false + user2.online.should be false end it "n connections" do @@ -136,15 +136,15 @@ describe JamRuby::Connection do :client_id => "2") user.reload - user.online.should be_true + user.online.should be true conn.delete user.reload - user.online.should be_true + user.online.should be true conn2.delete user.reload - user.online.should be_false + user.online.should be false end end diff --git a/ruby/spec/jam_ruby/models/country_spec.rb b/ruby/spec/jam_ruby/models/country_spec.rb index f8e1356f8..a5c57fb34 100644 --- a/ruby/spec/jam_ruby/models/country_spec.rb +++ b/ruby/spec/jam_ruby/models/country_spec.rb @@ -35,7 +35,7 @@ describe Country do # verify we can swap out tables Country.after_maxmind_import - table_exists?('countries_copied').should be_false + table_exists?('countries_copied').should be false result = Country.connection.execute("SELECT * FROM countries") result.ntuples.should == 1 list_indexes('countries').should =~ [] 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 c7487e58e..b2dea1d20 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 @@ -83,9 +83,9 @@ describe EmailBatchScheduledSessions do 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.rsvp_request_slot.update(chosen: true) # oo = FactoryBot.create(:rsvp_request, :user => vocalist, :rsvp_slot => oo) - # oo.rsvp_request_slot.update_attributes(chosen: true) + # oo.rsvp_request_slot.update(chosen: true) expect(drummer.instruments.include?(drums)).to eq(true) expect(drummer.instruments.include?(guitar)).to eq(true) diff --git a/ruby/spec/jam_ruby/models/event_session_spec.rb b/ruby/spec/jam_ruby/models/event_session_spec.rb index 98157c132..2b173d79c 100644 --- a/ruby/spec/jam_ruby/models/event_session_spec.rb +++ b/ruby/spec/jam_ruby/models/event_session_spec.rb @@ -9,7 +9,7 @@ describe EventSession do it "requires a parent event" do event_session = FactoryBot.build(:event_session) - event_session.save.should be_false + event_session.save.should be false event_session.errors[:event].should == ["can't be blank"] end @@ -18,7 +18,7 @@ describe EventSession do 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.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 cfff34b1e..78237b307 100644 --- a/ruby/spec/jam_ruby/models/event_spec.rb +++ b/ruby/spec/jam_ruby/models/event_spec.rb @@ -9,7 +9,7 @@ describe Event do it "should not have duplicate slugs" do event1 = FactoryBot.create(:event) dup = FactoryBot.build(:event, slug: event1.slug) - dup.save.should be_false + dup.save.should be false dup.errors[:slug].should == ["has already been taken"] end diff --git a/ruby/spec/jam_ruby/models/feed_spec.rb b/ruby/spec/jam_ruby/models/feed_spec.rb index 14ef89fa4..39e6bfae5 100644 --- a/ruby/spec/jam_ruby/models/feed_spec.rb +++ b/ruby/spec/jam_ruby/models/feed_spec.rb @@ -314,7 +314,7 @@ describe Feed do user1.bands << band user1.save! music_session = FactoryBot.create(:active_music_session, band: band) - music_session.music_session.fan_access.should be_true + music_session.music_session.fan_access.should be true feeds, next_page = Feed.index(user1, band: band.id) feeds.length.should == 1 @@ -329,12 +329,12 @@ describe Feed do user1.bands << band user1.save! music_session = FactoryBot.create(:active_music_session, band: band, fan_access: false) - music_session.music_session.fan_access.should be_false + music_session.music_session.fan_access.should be false feeds, next_page = Feed.index(user1, band: band.id) feeds.length.should == 1 feeds[0].music_session.should == music_session.music_session - feeds[0].music_session.fan_access.should be_false + feeds[0].music_session.fan_access.should be false feeds, next_page = Feed.index(user2, band: band.id) @@ -407,13 +407,13 @@ describe Feed do it "shows private sessions to you and to others" do music_session = FactoryBot.create(:active_music_session, fan_access: false) - music_session.music_session.fan_access.should be_false + music_session.music_session.fan_access.should be false 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 feeds[0].music_session.should == music_session.music_session - feeds[0].music_session.fan_access.should be_false + feeds[0].music_session.fan_access.should be false feeds, next_page = Feed.index(user2, user: user1.id) diff --git a/ruby/spec/jam_ruby/models/feedback_spec.rb b/ruby/spec/jam_ruby/models/feedback_spec.rb index 71d6eff5f..480a92869 100644 --- a/ruby/spec/jam_ruby/models/feedback_spec.rb +++ b/ruby/spec/jam_ruby/models/feedback_spec.rb @@ -14,13 +14,13 @@ describe Feedback do feedback.save end - it { feedback.valid?.should be_false } + it { feedback.valid?.should be false } it { feedback.errors.keys.length.should == 2} it { feedback.errors["email"].length.should == 2} - it { feedback.errors["email"][0].include?("blank").should be_true} - it { feedback.errors["email"][1].include?("invalid").should be_true} + it { feedback.errors["email"][0].include?("blank").should be true} + it { feedback.errors["email"][1].include?("invalid").should be true} it { feedback.errors["body"].length.should == 1} - it { feedback.errors["body"][0].include?("blank").should be_true} + it { feedback.errors["body"][0].include?("blank").should be true} it { CorpMailer.deliveries.length.should == 0} end @@ -32,10 +32,10 @@ describe Feedback do feedback.save end - it { feedback.valid?.should be_false } + it { feedback.valid?.should be false } it { feedback.errors.keys.length.should == 1} it { feedback.errors["email"].length.should == 1} - it { feedback.errors["email"][0].include?("invalid").should be_true} + it { feedback.errors["email"][0].include?("invalid").should be true} it { CorpMailer.deliveries.length.should == 0} end @@ -46,7 +46,7 @@ describe Feedback do feedback.save end - it { feedback.valid?.should be_true } + it { feedback.valid?.should be true } it { feedback.errors.keys.length.should == 0 } it { CorpMailer.deliveries.length.should == 0} # turned off due to spam end diff --git a/ruby/spec/jam_ruby/models/friendship_spec.rb b/ruby/spec/jam_ruby/models/friendship_spec.rb index d112442cf..ae1cd49f9 100644 --- a/ruby/spec/jam_ruby/models/friendship_spec.rb +++ b/ruby/spec/jam_ruby/models/friendship_spec.rb @@ -10,8 +10,8 @@ describe Friendship do end it "can create two-way friendship" do - user1.friends?(user2).should be_true - user2.friends?(user1).should be_true + user1.friends?(user2).should be true + user2.friends?(user1).should be true end it "should track user progression" do diff --git a/ruby/spec/jam_ruby/models/generic_state_spec.rb b/ruby/spec/jam_ruby/models/generic_state_spec.rb index 671daeaba..8c93b2ffb 100644 --- a/ruby/spec/jam_ruby/models/generic_state_spec.rb +++ b/ruby/spec/jam_ruby/models/generic_state_spec.rb @@ -9,7 +9,7 @@ describe GenericState do end def rails_env (env) - JamRuby::Environment.should_receive(:mode).any_number_of_times.and_return(env) + JamRuby::Environment.stub(:mode).and_return(env) end describe "allow_emails?" do @@ -19,7 +19,7 @@ describe GenericState do rails_env('production') stub_const("ENV", {'BUILD_NUMBER' => 1}) - GenericState.allow_emails?.should be_true + GenericState.allow_emails?.should be true end it "no emails if database is production and env is production, no build number" do @@ -27,20 +27,20 @@ describe GenericState do rails_env('production') stub_const("ENV", {'BUILD_NUMBER' => nil}) - GenericState.allow_emails?.should be_false + GenericState.allow_emails?.should be false end it "allows emails if database is development and env is development" do database_env('development') rails_env('development') - GenericState.allow_emails?.should be_true + GenericState.allow_emails?.should be true end it "no emails if database development, and environment is test" do database_env('development') rails_env('test') - GenericState.allow_emails?.should be_false + GenericState.allow_emails?.should be false end it "no emails if database production, and environment is development" do @@ -48,14 +48,14 @@ describe GenericState do rails_env('development') stub_const("ENV", {'BUILD_NUMBER' => 1}) - GenericState.allow_emails?.should be_false + GenericState.allow_emails?.should be false end it "no emails if database production, and environment is test" do database_env('production') rails_env('development') - GenericState.allow_emails?.should be_false + GenericState.allow_emails?.should be false end end end \ No newline at end of file diff --git a/ruby/spec/jam_ruby/models/geo_ip_blocks_spec.rb b/ruby/spec/jam_ruby/models/geo_ip_blocks_spec.rb index ead018c39..ea76d9d98 100644 --- a/ruby/spec/jam_ruby/models/geo_ip_blocks_spec.rb +++ b/ruby/spec/jam_ruby/models/geo_ip_blocks_spec.rb @@ -59,7 +59,7 @@ describe GeoIpBlocks do # verify we can swap out tables GeoIpBlocks.after_maxmind_import - table_exists?('geoipblocks_copied').should be_false + table_exists?('geoipblocks_copied').should be false result = GeoIpBlocks.connection.execute("SELECT * FROM geoipblocks") result.ntuples.should == 3 list_indexes('geoipblocks').should =~ [GeoIpBlocks::GEOIPBLOCKS_INDEX_NAME] diff --git a/ruby/spec/jam_ruby/models/geo_ip_locations_spec.rb b/ruby/spec/jam_ruby/models/geo_ip_locations_spec.rb index 89bb3f8c4..ad62f486f 100644 --- a/ruby/spec/jam_ruby/models/geo_ip_locations_spec.rb +++ b/ruby/spec/jam_ruby/models/geo_ip_locations_spec.rb @@ -92,12 +92,12 @@ describe GeoIpLocations do # verify we can swap out tables GeoIpLocations.after_maxmind_import - table_exists?('geoiplocations_copied').should be_false + table_exists?('geoiplocations_copied').should be false result = GeoIpLocations.connection.execute("SELECT * FROM geoiplocations") result.ntuples.should == 3 list_indexes('geoiplocations').should =~ [GeoIpLocations::PRIMARY_KEY_NAME, GeoIpLocations::GEOIPLOCATIONS_INDEX_NAME] - table_exists?('cities_copied').should be_false + table_exists?('cities_copied').should be false result = GeoIpLocations.connection.execute("SELECT * FROM cities") result.ntuples.should == 1 list_indexes('cities').should =~ [] diff --git a/ruby/spec/jam_ruby/models/get_work_spec.rb b/ruby/spec/jam_ruby/models/get_work_spec.rb index 81003a938..c86d2f06d 100644 --- a/ruby/spec/jam_ruby/models/get_work_spec.rb +++ b/ruby/spec/jam_ruby/models/get_work_spec.rb @@ -99,7 +99,7 @@ describe GetWork do 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 + (list == [other_connection1.client_id] || list == [other_connection2.client_id]).should be true # we don't know which one it'll pick GetWork.get_work_list(other_connection1).should =~ [my_connection.client_id, other_connection2.client_id] GetWork.get_work_list(other_connection2).should =~ [my_connection.client_id, other_connection1.client_id] end @@ -164,7 +164,7 @@ describe GetWork do break if swapped end - swapped.should be_true + swapped.should be true end it "excludes udp unreachable clients" do @@ -365,12 +365,12 @@ describe GetWork do # failures shold keep increment, but the user should not yet in_scoring_timeout? because it's only one failure connection1.scoring_failures.should == APP_CONFIG.scoring_timeout_threshold + 1 - connection1.in_scoring_timeout?.should be_false + connection1.in_scoring_timeout?.should be false expect(connection1.scoring_timeout).to be_within(1.second).of(original_timeout1) connection1.scoring_timeout_occurrences.should == 1 connection2.scoring_failures.should == APP_CONFIG.scoring_timeout_threshold + 1 - connection2.in_scoring_timeout?.should be_false + connection2.in_scoring_timeout?.should be false expect(connection2.scoring_timeout).to be_within(1.second).of(original_timeout2) connection2.scoring_timeout_occurrences.should == 1 end @@ -386,12 +386,12 @@ describe GetWork do connection2.reload connection1.scoring_failures.should == 0 - connection1.in_scoring_timeout?.should be_false + connection1.in_scoring_timeout?.should be false expect(connection1.scoring_timeout).to be_within(1.second).of(original_timeout1) connection1.scoring_timeout_occurrences.should == 1 connection2.scoring_failures.should == 0 - connection2.in_scoring_timeout?.should be_false + connection2.in_scoring_timeout?.should be false expect(connection2.scoring_timeout).to be_within(1.second).of(original_timeout2) connection2.scoring_timeout_occurrences.should == 1 end @@ -410,12 +410,12 @@ describe GetWork do connection1.scoring_failures.should == APP_CONFIG.scoring_timeout_threshold connection1.scoring_failures_offset.should == APP_CONFIG.scoring_timeout_threshold - connection1.in_scoring_timeout?.should be_true + connection1.in_scoring_timeout?.should be true expect(connection1.scoring_timeout).to be_within(1.second).of(APP_CONFIG.scoring_timeout_minutes.minutes.from_now) connection1.scoring_timeout_occurrences.should == 2 connection2.scoring_failures.should == APP_CONFIG.scoring_timeout_threshold connection2.scoring_failures_offset.should == APP_CONFIG.scoring_timeout_threshold - connection2.in_scoring_timeout?.should be_true + connection2.in_scoring_timeout?.should be true expect(connection2.scoring_timeout).to be_within(1.second).of(APP_CONFIG.scoring_timeout_minutes.minutes.from_now) connection2.scoring_timeout_occurrences.should == 2 end @@ -431,12 +431,12 @@ describe GetWork do connection1.scoring_failures.should == APP_CONFIG.scoring_timeout_threshold * 2 # because this user keeps failing with no good scores connection1.scoring_failures_offset.should == APP_CONFIG.scoring_timeout_threshold * 2 # because this user keeps failing with no good scores - connection1.in_scoring_timeout?.should be_true + connection1.in_scoring_timeout?.should be true expect(connection1.scoring_timeout).to be_within(1.second).of(APP_CONFIG.scoring_timeout_minutes.minutes.from_now) connection1.scoring_timeout_occurrences.should == 2 connection2.scoring_failures.should == APP_CONFIG.scoring_timeout_threshold * 2 # because this user keeps failing with no good scores connection2.scoring_failures_offset.should == APP_CONFIG.scoring_timeout_threshold * 2 # because this user keeps failing with no good scores - connection2.in_scoring_timeout?.should be_true + connection2.in_scoring_timeout?.should be true expect(connection2.scoring_timeout).to be_within(1.second).of(APP_CONFIG.scoring_timeout_minutes.minutes.from_now) connection2.scoring_timeout_occurrences.should == 2 end 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 1c37b5383..f60d86e3c 100644 --- a/ruby/spec/jam_ruby/models/icecast_admin_authentication_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_admin_authentication_spec.rb @@ -7,7 +7,7 @@ describe IcecastAdminAuthentication do let(:builder) { ::Builder::XmlMarkup.new(:target => output, :indent => 1) } it "save error" do - admin.save.should be_false + admin.save.should be false admin.errors[:source_pass].length.should == 2 admin.errors[:admin_user].length.should == 2 admin.errors[:admin_pass].length.should == 2 @@ -16,13 +16,13 @@ describe IcecastAdminAuthentication do end it "save" do - admin.source_pass = Faker::Lorem.characters(10) - admin.admin_user = Faker::Lorem.characters(10) - admin.admin_pass = Faker::Lorem.characters(10) - admin.relay_user = Faker::Lorem.characters(10) - admin.relay_pass = Faker::Lorem.characters(10) + admin.source_pass = Faker::Lorem.characters(number: 10) + admin.admin_user = Faker::Lorem.characters(number: 10) + admin.admin_pass = Faker::Lorem.characters(number: 10) + admin.relay_user = Faker::Lorem.characters(number: 10) + admin.relay_pass = Faker::Lorem.characters(number: 10) - admin.save.should be_true + admin.save.should be true admin.dumpXml(builder) diff --git a/ruby/spec/jam_ruby/models/icecast_directory_spec.rb b/ruby/spec/jam_ruby/models/icecast_directory_spec.rb index 91d93174f..b83c10fe8 100644 --- a/ruby/spec/jam_ruby/models/icecast_directory_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_directory_spec.rb @@ -20,15 +20,15 @@ describe IcecastDirectory do end it "save error" do - dir.save.should be_false + dir.save.should be false dir.errors[:yp_url].length.should == 1 dir.errors[:yp_url_timeout].length.should == 0 end it "save" do - dir.yp_url = Faker::Lorem.characters(10) + dir.yp_url = Faker::Lorem.characters(number: 10) dir.yp_url_timeout = 20 - dir.save.should be_true + dir.save.should be true dir.dumpXml(builder) output.rewind diff --git a/ruby/spec/jam_ruby/models/icecast_limit_spec.rb b/ruby/spec/jam_ruby/models/icecast_limit_spec.rb index f0593f701..3fb04d449 100644 --- a/ruby/spec/jam_ruby/models/icecast_limit_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_limit_spec.rb @@ -8,7 +8,7 @@ describe IcecastLimit do it "save defaults" do - limit.save.should be_true + limit.save.should be true limit.dumpXml(builder) output.rewind @@ -41,7 +41,7 @@ describe IcecastLimit do limit.source_timeout = 30 limit.burst_size = 1000 - limit.save.should be_true + limit.save.should be true limit.dumpXml(builder) output.rewind diff --git a/ruby/spec/jam_ruby/models/icecast_logging_spec.rb b/ruby/spec/jam_ruby/models/icecast_logging_spec.rb index b2ed415ca..f50784e87 100644 --- a/ruby/spec/jam_ruby/models/icecast_logging_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_logging_spec.rb @@ -7,14 +7,14 @@ describe IcecastLogging do let(:builder) { ::Builder::XmlMarkup.new(:target => output, :indent => 1) } it "save works by default db values" do - logging.save.should be_true + logging.save.should be true logging.access_log.should == 'access.log' logging.error_log.should == 'error.log' end it "save" do - logging.access_log = Faker::Lorem.characters(10) - logging.error_log = Faker::Lorem.characters(10) + logging.access_log = Faker::Lorem.characters(number: 10) + logging.error_log = Faker::Lorem.characters(number: 10) logging.log_level = 4 logging.log_size = 20000 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 f43a5c0ff..bedfadde0 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 @@ -8,7 +8,7 @@ describe IcecastMasterServerRelay do it "should not save" do - relay.save.should be_false + relay.save.should be false relay.errors[:master_pass].should == ["can't be blank", "is too short (minimum is 5 characters)"] relay.errors[:master_username].should == ["can't be blank", "is too short (minimum is 5 characters)"] relay.errors[:master_server].should == ["is too short (minimum is 1 character)"] diff --git a/ruby/spec/jam_ruby/models/icecast_mount_spec.rb b/ruby/spec/jam_ruby/models/icecast_mount_spec.rb index 7c4cd18bf..445699e22 100644 --- a/ruby/spec/jam_ruby/models/icecast_mount_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_mount_spec.rb @@ -8,24 +8,24 @@ describe IcecastMount do it "save error" do mount = IcecastMount.new - mount.save.should be_false + mount.save.should be false mount.errors[:name].should == ["can't be blank", "must start with /"] end it "save" do mount = IcecastMount.new - mount.name = "/" + Faker::Lorem.characters(10) - mount.stream_name = Faker::Lorem.characters(10) - mount.stream_description = Faker::Lorem.characters(10) - mount.stream_url = Faker::Lorem.characters(10) - mount.genre = Faker::Lorem.characters(10) - mount.source_username = Faker::Lorem.characters(10) - mount.source_pass = Faker::Lorem.characters(10) - mount.intro = Faker::Lorem.characters(10) - mount.fallback_mount = Faker::Lorem.characters(10) - mount.on_connect = Faker::Lorem.characters(10) - mount.on_disconnect = Faker::Lorem.characters(10) + mount.name = "/" + Faker::Lorem.characters(number: 10) + mount.stream_name = Faker::Lorem.characters(number: 10) + mount.stream_description = Faker::Lorem.characters(number: 10) + mount.stream_url = Faker::Lorem.characters(number: 10) + mount.genre = Faker::Lorem.characters(number: 10) + mount.source_username = Faker::Lorem.characters(number: 10) + mount.source_pass = Faker::Lorem.characters(number: 10) + mount.intro = Faker::Lorem.characters(number: 10) + mount.fallback_mount = Faker::Lorem.characters(number: 10) + mount.on_connect = Faker::Lorem.characters(number: 10) + mount.on_disconnect = Faker::Lorem.characters(number: 10) mount.fallback_override = true mount.fallback_when_full = true mount.max_listeners = 1000 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 7ad39d2f7..a6b117d6a 100644 --- a/ruby/spec/jam_ruby/models/icecast_mount_template_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_mount_template_spec.rb @@ -5,7 +5,7 @@ describe IcecastMountTemplate do let(:mount_template) { template = FactoryBot.create(:icecast_mount_template) } it "save" do - mount_template.errors.any?.should be_false + mount_template.errors.any?.should be false end describe "poke configs" do diff --git a/ruby/spec/jam_ruby/models/icecast_path_spec.rb b/ruby/spec/jam_ruby/models/icecast_path_spec.rb index 8d145fd42..01c1481a7 100644 --- a/ruby/spec/jam_ruby/models/icecast_path_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_path_spec.rb @@ -7,7 +7,7 @@ describe IcecastPath do let(:builder) { ::Builder::XmlMarkup.new(:target => output, :indent => 1) } it "save default" do - path.save.should be_true + path.save.should be true path.dumpXml(builder) output.rewind @@ -29,16 +29,16 @@ describe IcecastPath do end it "save set values" do - path.base_dir = Faker::Lorem.characters(10) - path.log_dir = Faker::Lorem.characters(10) - path.pid_file = Faker::Lorem.characters(10) - path.web_root = Faker::Lorem.characters(10) - path.admin_root = Faker::Lorem.characters(10) - path.allow_ip = Faker::Lorem.characters(10) - path.deny_ip = Faker::Lorem.characters(10) - path.alias_source = Faker::Lorem.characters(10) - path.alias_dest = Faker::Lorem.characters(10) - path.save.should be_true + path.base_dir = Faker::Lorem.characters(number: 10) + path.log_dir = Faker::Lorem.characters(number: 10) + path.pid_file = Faker::Lorem.characters(number: 10) + path.web_root = Faker::Lorem.characters(number: 10) + path.admin_root = Faker::Lorem.characters(number: 10) + path.allow_ip = Faker::Lorem.characters(number: 10) + path.deny_ip = Faker::Lorem.characters(number: 10) + path.alias_source = Faker::Lorem.characters(number: 10) + path.alias_dest = Faker::Lorem.characters(number: 10) + path.save.should be true path.dumpXml(builder) output.rewind diff --git a/ruby/spec/jam_ruby/models/icecast_relay_spec.rb b/ruby/spec/jam_ruby/models/icecast_relay_spec.rb index 880c54b02..fcadeb7b6 100644 --- a/ruby/spec/jam_ruby/models/icecast_relay_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_relay_spec.rb @@ -8,14 +8,14 @@ describe IcecastRelay do it "should not save" do - relay.save.should be_false + relay.save.should be false relay.errors[:mount].should == ["can't be blank"] relay.errors[:server].should == ["can't be blank"] end it "save" do - relay.mount = Faker::Lorem.characters(10) - relay.server = Faker::Lorem.characters(10) + relay.mount = Faker::Lorem.characters(number: 10) + relay.server = Faker::Lorem.characters(number: 10) relay.relay_shoutcast_metadata = false relay.save! 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 e1cc37567..c1391abfa 100644 --- a/ruby/spec/jam_ruby/models/icecast_source_change_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_source_change_spec.rb @@ -6,7 +6,7 @@ describe IcecastSourceChange do it "validates" do bad_change = IcecastSourceChange.new - bad_change.save.should be_false + bad_change.save.should be false bad_change.errors[:change_type].should == ["is not included in the list"] bad_change.errors[:source_direction].should == ["is not included in the list"] bad_change.errors[:success].should == ["is not included in the list"] diff --git a/ruby/spec/jam_ruby/models/icecast_template_spec.rb b/ruby/spec/jam_ruby/models/icecast_template_spec.rb index 1e5926939..32f39ed57 100644 --- a/ruby/spec/jam_ruby/models/icecast_template_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_template_spec.rb @@ -5,7 +5,7 @@ describe IcecastTemplate do let(:template) { template = FactoryBot.create(:icecast_template_minimal) } it "save" do - template.errors.any?.should be_false + template.errors.any?.should be false end describe "poke configs" do 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 6ee133d9c..0b2967273 100644 --- a/ruby/spec/jam_ruby/models/icecast_user_authentication_spec.rb +++ b/ruby/spec/jam_ruby/models/icecast_user_authentication_spec.rb @@ -7,7 +7,7 @@ describe IcecastUserAuthentication do let(:builder) { ::Builder::XmlMarkup.new(:target => output, :indent => 1) } it "save error" do - auth.save.should be_false + auth.save.should be false auth.errors[:mount_add].should == ["can't be blank"] auth.errors[:mount_remove].should == ["can't be blank"] auth.errors[:listener_add].should == ["can't be blank"] @@ -17,12 +17,12 @@ describe IcecastUserAuthentication do end it "save" do - auth.mount_add = Faker::Lorem.characters(10) - auth.mount_remove = Faker::Lorem.characters(10) - auth.listener_add = Faker::Lorem.characters(10) - auth.listener_remove = Faker::Lorem.characters(10) - auth.unused_username = Faker::Lorem.characters(10) - auth.unused_pass = Faker::Lorem.characters(10) + auth.mount_add = Faker::Lorem.characters(number: 10) + auth.mount_remove = Faker::Lorem.characters(number: 10) + auth.listener_add = Faker::Lorem.characters(number: 10) + auth.listener_remove = Faker::Lorem.characters(number: 10) + auth.unused_username = Faker::Lorem.characters(number: 10) + auth.unused_pass = Faker::Lorem.characters(number: 10) auth.save! diff --git a/ruby/spec/jam_ruby/models/invitation_spec.rb b/ruby/spec/jam_ruby/models/invitation_spec.rb index 5b6ecb89d..6dd849a59 100644 --- a/ruby/spec/jam_ruby/models/invitation_spec.rb +++ b/ruby/spec/jam_ruby/models/invitation_spec.rb @@ -15,7 +15,7 @@ describe ActiveMusicSession do invitation = Invitation.new(:sender => user1, :receiver => user2, :music_session => music_session.music_session) invitation.save - invitation.save.should be_false + invitation.save.should be false invitation.errors.size.should == 1 invitation.errors.get(:receiver).should == [Invitation::FRIENDSHIP_REQUIRED_VALIDATION_ERROR] end @@ -35,7 +35,7 @@ describe ActiveMusicSession do invitation = Invitation.new(:sender => user1, :receiver => user2, :music_session => music_session.music_session) - invitation.save.should be_true + invitation.save.should be true end it 'can create invitation to a user who made a join_request' do @@ -51,7 +51,7 @@ describe ActiveMusicSession do invitation = Invitation.new(:sender => user1, :receiver => user2, :music_session => music_session.music_session, :join_request => join_request) - invitation.save.should be_true + invitation.save.should be true end it 'cant create invitation to a user who did not make a join_request and is not a friend' do @@ -68,7 +68,7 @@ describe ActiveMusicSession do invitation = Invitation.new(:sender => user1, :receiver => user2, :music_session => music_session.music_session, :join_request => join_request) - invitation.save.should be_false + invitation.save.should be false invitation.errors.get(:join_request).should == [Invitation::JOIN_REQUEST_IS_NOT_FOR_RECEIVER_AND_MUSIC_SESSION ] end end diff --git a/ruby/spec/jam_ruby/models/invited_user_spec.rb b/ruby/spec/jam_ruby/models/invited_user_spec.rb index 876245ab5..e2753456e 100644 --- a/ruby/spec/jam_ruby/models/invited_user_spec.rb +++ b/ruby/spec/jam_ruby/models/invited_user_spec.rb @@ -90,7 +90,7 @@ describe InvitedUser do invited_user.email.should_not be_nil invited_user.sender.should_not be_nil invited_user.note.should be_nil - invited_user.invited_by_administrator?.should be_false + invited_user.invited_by_administrator?.should be false #invited_user.sender.reload invited_user.sender.first_invited_at.should_not be_nil end @@ -106,14 +106,14 @@ describe InvitedUser do invited_user.email.should_not be_nil invited_user.sender.should_not be_nil invited_user.note.should be_nil - invited_user.invited_by_administrator?.should be_true + invited_user.invited_by_administrator?.should be true end it 'create an invitation from no one in particular' do # create the invitation from the end-user invited_user = FactoryBot.build(:invited_user) - invited_user.invited_by_administrator?.should be_true + invited_user.invited_by_administrator?.should be true end it 'email is sent automatically by virtue of observer' do @@ -133,12 +133,12 @@ describe InvitedUser do # create the invitation from the end-user invited_user = FactoryBot.create(:invited_user, :sender => user1) - invited_user.accepted.should be_false + invited_user.accepted.should be false invited_user.accept! invited_user.save - invited_user.accepted.should be_true + invited_user.accepted.should be true end it 'checks can invite' do @@ -150,7 +150,7 @@ describe InvitedUser do # create the invitation from the end-user invited_user = FactoryBot.build(:invited_user, :sender => user1) invited_user.save - invited_user.errors.any?.should be_true + invited_user.errors.any?.should be true end it 'list invites for a user' do @@ -174,7 +174,7 @@ describe InvitedUser do invited_user = FactoryBot.create(:invited_user, :sender => user1) invited_user.note = 'fuck you' invited_user.save - invited_user.valid?.should be_false + invited_user.valid?.should be false end it 'accepts empty emails' do diff --git a/ruby/spec/jam_ruby/models/isp_score_batch_spec.rb b/ruby/spec/jam_ruby/models/isp_score_batch_spec.rb index 4cc204c27..24b97e5aa 100644 --- a/ruby/spec/jam_ruby/models/isp_score_batch_spec.rb +++ b/ruby/spec/jam_ruby/models/isp_score_batch_spec.rb @@ -5,15 +5,15 @@ describe IspScoreBatch do let (:score) {IspScoreBatch.new} it "valid json" do score.json_scoring_data = "{}" - score.save.should be_true + score.save.should be true end it "no json" do - score.save.should be_false + score.save.should be false end it "invalid json" do score.json_scoring_data = "blurp a durp" - score.save.should be_false + score.save.should be false end end diff --git a/ruby/spec/jam_ruby/models/jam_isp_spec.rb b/ruby/spec/jam_ruby/models/jam_isp_spec.rb index aaff7bcba..15b5d2c9e 100644 --- a/ruby/spec/jam_ruby/models/jam_isp_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_isp_spec.rb @@ -85,17 +85,17 @@ describe JamIsp do # verify we can swap out tables JamIsp.after_maxmind_import - table_exists?('jamisp_copied').should be_false + table_exists?('jamisp_copied').should be false result = JamIsp.connection.execute("SELECT * FROM jamisp") result.ntuples.should == 1 list_indexes('jamisp').should =~ [JamIsp::JAMISP_GEOM_INDEX_NAME, JamIsp::JAMISP_COID_INDEX_NAME] - table_exists?('jamcompany_copied').should be_false + table_exists?('jamcompany_copied').should be false result = JamIsp.connection.execute("SELECT * FROM jamcompany") result.ntuples.should == 1 list_indexes('jamcompany').should =~ [JamIsp::JAMCOMPANY_UNIQUE_INDEX, JamIsp::JAMCOMPANY_PRIMARY_KEY_NAME] - table_exists?('geoipisp_copied').should be_false + table_exists?('geoipisp_copied').should be false result = JamIsp.connection.execute("SELECT * FROM geoipisp") result.ntuples.should == 1 list_indexes('geoipisp').should =~ [JamIsp::GEOIPISP_INDEX_NAME] 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 399876a3b..84977bea6 100644 --- a/ruby/spec/jam_ruby/models/jam_track_mixdown_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_mixdown_spec.rb @@ -37,35 +37,35 @@ describe JamTrackMixdown do it "validates empty settings" do invalid = FactoryBot.build(:jam_track_mixdown, settings: {}.to_json) invalid.save - invalid.errors.any?.should be_true + 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 = FactoryBot.build(:jam_track_mixdown, settings: {"speed" => "5"}.to_json) invalid.save - invalid.errors.any?.should be_true + invalid.errors.any?.should be true invalid.errors["settings"].should eq(["has non-integer speed"]) end it "validates pitch numeric" do invalid = FactoryBot.build(:jam_track_mixdown, settings: {"pitch" => "5"}.to_json) invalid.save - invalid.errors.any?.should be_true + invalid.errors.any?.should be true invalid.errors["settings"].should eq(["has non-integer pitch"]) end it "validates speed not-float" do invalid = FactoryBot.build(:jam_track_mixdown, settings: {"speed" => 5.5}.to_json) invalid.save - invalid.errors.any?.should be_true + invalid.errors.any?.should be true invalid.errors["settings"].should eq(["has non-integer speed"]) end it "validates pitch not-float" do invalid = FactoryBot.build(:jam_track_mixdown, settings: {"pitch" => 10.5}.to_json) invalid.save - invalid.errors.any?.should be_true + invalid.errors.any?.should be true invalid.errors["settings"].should eq(["has non-integer pitch"]) end end 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 e39125d2a..7a2186541 100644 --- a/ruby/spec/jam_ruby/models/jam_track_right_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_right_spec.rb @@ -24,7 +24,7 @@ describe JamTrackRight do 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.valid?.should be false right_2.errors[:user_id].should == ['has already been taken'] end end @@ -79,7 +79,7 @@ describe JamTrackRight do jam_track_track[:url_48].should == jam_track_track.manually_uploaded_filename(:url_48) # verify it's on S3 - s3.exists?(jam_track_track[:url_48]).should be_true + s3.exists?(jam_track_track[:url_48]).should be true s3.length(jam_track_track[:url_48]).should == File.size?(ogg_path) jam_track_right = JamTrackRight.create(:user=>user, :jam_track=>jam_track) @@ -92,12 +92,12 @@ describe JamTrackRight do # verify it's on S3 url = jam_track_right[:url_48] s3 = S3Manager.new(APP_CONFIG.aws_bucket, APP_CONFIG.aws_access_key_id, APP_CONFIG.aws_secret_access_key) - s3.exists?(url).should be_true + s3.exists?(url).should be true s3.length(url).should > File.size?(ogg_path) JamTrackRight.ready_to_clean.count.should == 0 jam_track_right.destroy - s3.exists?(url).should be_false + s3.exists?(url).should be false end end @@ -115,14 +115,14 @@ describe JamTrackRight do it "valid track with no rights to it by querying user" do jam_track = FactoryBot.create(:jam_track) keys = JamTrackRight.list_keys(user, [jam_track.id]) - keys.should have(1).items + keys.size.should == 1 keys[0]['private_key'].should be_nil end it "valid track with rights to it by querying user" do 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.size.should == 1 keys[0].id.should == jam_track_right.jam_track.id keys[0]['private_key_44'].should_not be_nil keys[0]['private_key_48'].should_not be_nil @@ -249,8 +249,8 @@ describe JamTrackRight do it "allows redemption (success)" do jam_track_right.guard_against_fraud(user, first_fingerprint, remote_ip).should be_nil - jam_track_right.valid?.should be_true - jam_track_right.redeemed_and_fingerprinted.should be_true + jam_track_right.valid?.should be true + jam_track_right.redeemed_and_fingerprinted.should be true mf = MachineFingerprint.find_by_fingerprint('all') @@ -273,7 +273,7 @@ describe JamTrackRight do jam_track_right.save! jam_track_right.guard_against_fraud(user, new_fingerprint, remote_ip).should be_nil - jam_track_right.valid?.should be_true + jam_track_right.valid?.should be true # and no new fingerprints MachineFingerprint.count.should eq(0) @@ -284,10 +284,10 @@ describe JamTrackRight do MachineFingerprint.count.should eq(2) jam_track_right_purchased.guard_against_fraud(user, new_fingerprint, remote_ip).should be_nil - jam_track_right_purchased.valid?.should be_true - jam_track_right_purchased.redeemed_and_fingerprinted.should be_false # fingerprint should not be set on normal purchase + jam_track_right_purchased.valid?.should be true + jam_track_right_purchased.redeemed_and_fingerprinted.should be false # fingerprint should not be set on normal purchase - jam_track_right.redeemed_and_fingerprinted.should be_true # should still be redeemed_and fingerprinted; just checking for weird side-effects + jam_track_right.redeemed_and_fingerprinted.should be true # should still be redeemed_and fingerprinted; just checking for weird side-effects # no new fingerprints MachineFingerprint.count.should eq(2) diff --git a/ruby/spec/jam_ruby/models/jam_track_spec.rb b/ruby/spec/jam_ruby/models/jam_track_spec.rb index 739b1d92d..cc3cc5682 100644 --- a/ruby/spec/jam_ruby/models/jam_track_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_spec.rb @@ -252,60 +252,60 @@ describe JamTrack do describe "price" do it "0.99" do - FactoryBot.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 - FactoryBot.build(:jam_track, price: 1).valid?.should be_true + FactoryBot.build(:jam_track, price: 1).valid?.should be true end it "100" do - FactoryBot.build(:jam_track, price: 100).valid?.should be_true + FactoryBot.build(:jam_track, price: 100).valid?.should be true end it "100.1" do - FactoryBot.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 - FactoryBot.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 = FactoryBot.build(:jam_track, price: 100.123) - jam_track.valid?.should be_false + jam_track.valid?.should be false jam_track.errors[:price].should == ['is invalid'] end end describe "reproduction_royalty_amount" do it "0.99" do - FactoryBot.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 - FactoryBot.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 - FactoryBot.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 - FactoryBot.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 - FactoryBot.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 - FactoryBot.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 = FactoryBot.build(:jam_track, reproduction_royalty_amount: 100.12345) - jam_track.valid?.should be_false + jam_track.valid?.should be false jam_track.errors[:reproduction_royalty_amount].should == ['is invalid'] end 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 8d7a26ef5..1069d8244 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 @@ -8,11 +8,11 @@ describe JamTrackTapIn do end it "offset must be specified" do - FactoryBot.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 - FactoryBot.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 a914ab99f..f9d03e89b 100644 --- a/ruby/spec/jam_ruby/models/jam_track_track_spec.rb +++ b/ruby/spec/jam_ruby/models/jam_track_track_spec.rb @@ -23,7 +23,7 @@ describe JamTrackTrack do it "jam_track required" do pending "Need to be not mandatory because of activeadmin" jam_track = FactoryBot.build(:jam_track_track, jam_track: nil) - jam_track.valid?.should be_false + jam_track.valid?.should be false jam_track.errors[:jam_track].should == ["can't be blank"] end end @@ -59,7 +59,7 @@ describe JamTrackTrack do jam_track_track[:url_48].should == jam_track_track.manually_uploaded_filename(:url_48) # verify it's on S3 - s3.exists?(jam_track_track[:url_48]).should be_true + s3.exists?(jam_track_track[:url_48]).should be true s3.length(jam_track_track[:url_48]).should == 'abc'.length # download it via signed URL, and check contents diff --git a/ruby/spec/jam_ruby/models/jamblaster_spec.rb b/ruby/spec/jam_ruby/models/jamblaster_spec.rb index 276da0565..035c0171a 100644 --- a/ruby/spec/jam_ruby/models/jamblaster_spec.rb +++ b/ruby/spec/jam_ruby/models/jamblaster_spec.rb @@ -19,7 +19,7 @@ describe Jamblaster do it "creates new" do jb = Jamblaster.bootstrap('abcd') jb.should_not be_nil - jb.errors.any?.should be_false + jb.errors.any?.should be false found = Jamblaster.find_by_serial_no('abcd') diff --git a/ruby/spec/jam_ruby/models/join_request_spec.rb b/ruby/spec/jam_ruby/models/join_request_spec.rb index d20c8bfd3..8373ad935 100644 --- a/ruby/spec/jam_ruby/models/join_request_spec.rb +++ b/ruby/spec/jam_ruby/models/join_request_spec.rb @@ -8,7 +8,7 @@ describe JoinRequest do 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 + join_request.save.should be true join_requests = JoinRequest.index(user1) join_requests.length.should == 1 @@ -22,7 +22,7 @@ describe JoinRequest do 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 + join_request.save.should be false join_request.errors.size.should == 1 join_request.errors.get(:user).should == [JoinRequest::REQUESTOR_MUST_BE_A_MUSICIAN] end @@ -32,11 +32,11 @@ describe JoinRequest do 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 + join_request.save.should be true join_request2 = JoinRequest.new(:user => user1, :music_session => music_session.music_session, :text => "Let me join yo") - join_request2.save.should be_false + join_request2.save.should be false join_request2.errors.get(:user_id) == ["has already been taken"] end @@ -46,6 +46,6 @@ describe JoinRequest do 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 + join_request.valid?.should be false end end diff --git a/ruby/spec/jam_ruby/models/latency_tester_spec.rb b/ruby/spec/jam_ruby/models/latency_tester_spec.rb index 7a111bdab..daf99ecfa 100644 --- a/ruby/spec/jam_ruby/models/latency_tester_spec.rb +++ b/ruby/spec/jam_ruby/models/latency_tester_spec.rb @@ -18,7 +18,7 @@ describe LatencyTester do describe "connect" do it "no existing latency tester" do latency_tester = LatencyTester.connect(params) - latency_tester.errors.any?.should be_false + latency_tester.errors.any?.should be false latency_tester.connection.ip_address.should == params[:ip_address] latency_tester.connection.stale_time.should == params[:connection_stale_time] latency_tester.connection.expire_time.should == params[:connection_expire_time] diff --git a/ruby/spec/jam_ruby/models/lesson_booking_spec.rb b/ruby/spec/jam_ruby/models/lesson_booking_spec.rb index b5a3d739f..b9ce096ee 100644 --- a/ruby/spec/jam_ruby/models/lesson_booking_spec.rb +++ b/ruby/spec/jam_ruby/models/lesson_booking_spec.rb @@ -213,7 +213,7 @@ describe LessonBooking do purchase.billing_error_reason.should eql "stripe" purchase.billing_error_detail.should include("Cannot charge a customer that has no active card") purchase.billing_attempts.should eql 1 - booking.is_suspended?.should be_false + booking.is_suspended?.should be false purchase.billed.should be false day = day + 1 time = day.to_time @@ -223,7 +223,7 @@ describe LessonBooking do purchase.reload purchase.billing_attempts.should eql 2 booking.reload - booking.is_suspended?.should be_false + booking.is_suspended?.should be false purchase.billed.should be false day = day + 1 @@ -234,7 +234,7 @@ describe LessonBooking do purchase.reload purchase.billing_attempts.should eql 3 booking.reload - booking.is_suspended?.should be_false + booking.is_suspended?.should be false purchase.billed.should be false day = day + 1 @@ -245,7 +245,7 @@ describe LessonBooking do purchase.reload purchase.billing_attempts.should eql 4 booking.reload - booking.is_suspended?.should be_false + booking.is_suspended?.should be false purchase.billed.should be false day = day + 1 @@ -256,7 +256,7 @@ describe LessonBooking do purchase.reload purchase.billing_attempts.should eql 5 booking.reload - booking.is_suspended?.should be_true + booking.is_suspended?.should be true purchase.billed.should be false # now that it's suspended, let's unsuspend it @@ -284,7 +284,7 @@ describe LessonBooking do purchase.last_billing_attempt_at.should eql time purchase.sent_billing_notices.should eql true booking.reload - booking.is_suspended?.should be_false + booking.is_suspended?.should be false end it "missed meetings deduct on next month" do @@ -391,8 +391,8 @@ describe LessonBooking do it "allows long message to flow through chat" do - user.has_free_lessons?.should be_true - booking = LessonBooking.book_test_drive(user, teacher_user, valid_single_slots, Faker::Lorem.characters(10000)) + user.has_free_lessons?.should be true + booking = LessonBooking.book_test_drive(user, teacher_user, valid_single_slots, Faker::Lorem.characters(number: 10000)) booking.errors.any?.should be false @@ -458,7 +458,7 @@ describe LessonBooking do end it "allows long message to flow through chat" do - booking = LessonBooking.book_test_drive(user, teacher_user, valid_single_slots, Faker::Lorem.characters(10000)) + booking = LessonBooking.book_test_drive(user, teacher_user, valid_single_slots, Faker::Lorem.characters(number: 10000)) booking.errors.any?.should be false @@ -540,7 +540,7 @@ describe LessonBooking do end it "allows long message to flow through chat" do - booking = LessonBooking.book_normal(user, teacher_user, valid_recurring_slots, Faker::Lorem.characters(10000), true, LessonBooking::PAYMENT_STYLE_WEEKLY, 60) + booking = LessonBooking.book_normal(user, teacher_user, valid_recurring_slots, Faker::Lorem.characters(number: 10000), true, LessonBooking::PAYMENT_STYLE_WEEKLY, 60) booking.errors.any?.should be false @@ -667,7 +667,7 @@ describe LessonBooking do UserMailer.deliveries.clear Timecop.freeze(7.days.ago) lesson_session.cancel({canceler: teacher_user, message: 'meh', slot: booking.default_slot.id, update_all: false}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.status.should eql LessonSession::STATUS_CANCELED lesson_session.reload @@ -683,7 +683,7 @@ describe LessonBooking do lesson_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson_session.accept({accepter: teacher_user, message: 'Yeah I got this', slot: booking.default_slot.id, update_all: false}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_APPROVED lesson_session.reload lesson_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) @@ -691,7 +691,7 @@ describe LessonBooking do UserMailer.deliveries.clear Timecop.freeze(7.days.ago) lesson_session.cancel({canceler: user, message: 'meh', slot: booking.default_slot.id, update_all: false}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.status.should eql LessonSession::STATUS_CANCELED booking.reload @@ -707,7 +707,7 @@ describe LessonBooking do lesson_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson_session.accept({accepter: teacher_user, message: 'Yeah I got this', slot: booking.default_slot.id, update_all: true}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_APPROVED lesson_session.reload lesson_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) @@ -718,7 +718,7 @@ describe LessonBooking do UserMailer.deliveries.clear Timecop.freeze(7.days.ago) lesson_session.cancel({canceler: user, message: 'meh', slot: booking.default_slot.id, update_all: false}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_CANCELED lesson_session.reload lesson_session.canceler.should eql user @@ -736,7 +736,7 @@ describe LessonBooking do lesson_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) lesson_session.accept({accepter: teacher_user, message: 'Yeah I got this', slot: booking.default_slot.id, update_all: false}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_APPROVED lesson_session.reload lesson_session.scheduled_start.should eql booking.default_slot.scheduled_time(0) @@ -752,7 +752,7 @@ describe LessonBooking do UserMailer.should_receive(:teacher_lesson_canceled).exactly(0).times lesson_session.cancel({canceler: user, message: 'meh', slot: booking.default_slot.id, update_all: true}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.status.should eql LessonSession::STATUS_CANCELED booking.reload @@ -778,7 +778,7 @@ describe LessonBooking do booking.reload booking.status.should eql LessonBooking::STATUS_APPROVED booking.lesson_sessions.count.should eql 1 - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.reload lesson_session.status.should eql LessonSession::STATUS_APPROVED lesson_session.scheduled_start.should eql counter.scheduled_time(0) @@ -800,7 +800,7 @@ describe LessonBooking do booking.counter_slot.should be_nil lesson_session.accept({accepter: teacher_user, message: 'Yeah I got this', slot: counter.id, update_all: false}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_APPROVED lesson_session.reload lesson_session.scheduled_start.should eql counter.scheduled_time(0) @@ -831,7 +831,7 @@ describe LessonBooking do Timecop.freeze(Time.now + 10) lesson_session.accept({accepter: teacher_user, message: 'Yeah I got this', slot: counter.id}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_APPROVED booking.reload booking.status.should eql LessonSession::STATUS_APPROVED @@ -858,7 +858,7 @@ describe LessonBooking do lesson_session.scheduled_start.should eql counter.scheduled_time(0) lesson_session.accept({accepter: teacher_user, message: 'OK, lets fix just this one', slot: counter2.id}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_APPROVED booking.reload lesson_session.reload @@ -884,7 +884,7 @@ describe LessonBooking do lesson_session.accept({accepter: teacher_user, message: 'OK, lets fix all of them', slot: counter3.id}) - lesson_session.errors.any?.should be_false + lesson_session.errors.any?.should be false lesson_session.status.should eql LessonSession::STATUS_APPROVED booking.reload booking.counter_slot.should be_nil 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 b34bce68d..50b840d55 100644 --- a/ruby/spec/jam_ruby/models/lesson_payment_charge_spec.rb +++ b/ruby/spec/jam_ruby/models/lesson_payment_charge_spec.rb @@ -34,7 +34,7 @@ describe TeacherPaymentCharge, no_transaction: true do charge = LessonPaymentCharge.first charge.billing_attempts.should eql 1 - charge.billed.should be_true + charge.billed.should be true charge.billing_error_reason.should eql 'bad logic after stripe call' Sale.count.should eql 0 @@ -51,7 +51,7 @@ describe TeacherPaymentCharge, no_transaction: true do charge = LessonPaymentCharge.first charge.billing_attempts.should eql 1 - charge.billed.should be_true + charge.billed.should be true charge.billing_error_reason.should eql 'bad logic after stripe call' Sale.count.should eql 0 diff --git a/ruby/spec/jam_ruby/models/lesson_session_spec.rb b/ruby/spec/jam_ruby/models/lesson_session_spec.rb index b77c87e85..c24de6fc2 100644 --- a/ruby/spec/jam_ruby/models/lesson_session_spec.rb +++ b/ruby/spec/jam_ruby/models/lesson_session_spec.rb @@ -21,7 +21,7 @@ describe LessonSession do 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 + lesson.errors.any?.should be true lesson.errors[:counter_slot].should eql ["Only 'update all' counter-proposals are allowed for un-approved, recurring lessons", "Only 'recurring' counter-proposals are allowed for un-approved, recurring lessons"] lesson.reload lesson.counter_slot.should be_nil @@ -29,7 +29,7 @@ describe LessonSession do 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 + lesson.errors.any?.should be false lesson.reload lesson.status.should eql LessonSession::STATUS_REQUESTED lesson.has_recurring_counter?.should be true @@ -39,7 +39,7 @@ describe LessonSession do 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 + lesson.errors.any?.should be false lesson.reload lesson.status.should eql LessonSession::STATUS_REQUESTED lesson.counter_slot.should be_nil @@ -47,7 +47,7 @@ describe LessonSession do lesson.lesson_booking.counter_slot.id.should eql counter2.id lesson.accept({accepter: user, message: "burp", slot: counter2.id}) - lesson.errors.any?.should be_false + lesson.errors.any?.should be false lesson.reload lesson.counter_slot.should be_nil lesson.status.should eql LessonSession::STATUS_APPROVED @@ -56,7 +56,7 @@ describe LessonSession do 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 + lesson.errors.any?.should be false lesson.reload lesson.counter_slot.should be_nil lesson.status.should eql LessonSession::STATUS_APPROVED @@ -66,7 +66,7 @@ describe LessonSession do 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 + lesson.errors.any?.should be false lesson.reload lesson.counter_slot.should be_nil lesson.status.should eql LessonSession::STATUS_APPROVED @@ -82,7 +82,7 @@ describe LessonSession do 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 + lesson1.errors.any?.should be false lesson1.reload lesson2.reload lesson1.status.should eql LessonSession::STATUS_APPROVED @@ -95,7 +95,7 @@ describe LessonSession do 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 + lesson1.errors.any?.should be false lesson1.reload lesson2.reload lesson1.status.should eql LessonSession::STATUS_APPROVED @@ -130,7 +130,7 @@ describe LessonSession do 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 + lesson1.errors.any?.should be false lesson1.reload lesson2.reload lesson1.status.should eql LessonSession::STATUS_APPROVED @@ -144,7 +144,7 @@ describe LessonSession do 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 + lesson1.errors.any?.should be false lesson1.reload lesson2.reload lesson1.status.should eql LessonSession::STATUS_APPROVED @@ -182,7 +182,7 @@ describe LessonSession do 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 + lesson1.errors.any?.should be false lesson1.reload lesson2.reload lesson1.status.should eql LessonSession::STATUS_APPROVED @@ -270,7 +270,7 @@ describe LessonSession do LessonSession.auto_cancel lesson_session.reload - lesson_session.lesson_booking.active.should be_false + lesson_session.lesson_booking.active.should be false lesson_session.status.should eql LessonSession::STATUS_UNCONFIRMED lesson_session.lesson_booking.status.should eql LessonSession::STATUS_UNCONFIRMED end @@ -293,7 +293,7 @@ describe LessonSession do describe "remind_counters" do it "finds old requested and pokes teacher" do lesson_session1 = normal_lesson(user, teacher, {}) - lesson_session1.sent_counter_reminder.should be_false + lesson_session1.sent_counter_reminder.should be false lesson_session1.status.should eql LessonSession::STATUS_REQUESTED mailer = mock mailer.should_receive(:deliver_now).twice @@ -362,7 +362,7 @@ describe LessonSession do acceptor: teacher, slot: slot.id }) - lesson.errors.any?.should be_true + lesson.errors.any?.should be true lesson.errors[:slot].should eql ["is in the past"] end @@ -376,7 +376,7 @@ describe LessonSession do accepter: teacher, slot: slotRecurring1.id }) - lesson.errors.any?.should be_false + lesson.errors.any?.should be false end it "cancel in the past is OK" do @@ -389,7 +389,7 @@ describe LessonSession do canceler: teacher, slot: slot }) - lesson.errors.any?.should be_false + lesson.errors.any?.should be false lesson.reload lesson.status.should eql LessonSession::STATUS_CANCELED lesson.lesson_booking.status.should eql LessonSession::STATUS_CANCELED @@ -495,10 +495,10 @@ describe LessonSession do 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 + connection1.errors.any?.should be false connection2.can_join_music_session - connection2.errors.any?.should be_false + connection2.errors.any?.should be false end end describe "upcoming_sessions_reminder" do @@ -508,15 +508,15 @@ describe LessonSession do LessonSession.upcoming_sessions_reminder #UserMailer.deliveries.count.should eql 2 lesson.touch - lesson.sent_starting_notice.should be_false - lesson.is_approved?.should be_true + lesson.sent_starting_notice.should be false + lesson.is_approved?.should be true lesson.music_session.scheduled_start = 15.minutes.from_now lesson.music_session.save! LessonSession.upcoming_sessions_reminder UserMailer.deliveries.count.should eql 2 UserMailer.deliveries.clear lesson.reload - lesson.sent_starting_notice.should be_true + lesson.sent_starting_notice.should be true LessonSession.upcoming_sessions_reminder UserMailer.deliveries.count.should eql 0 end @@ -529,15 +529,15 @@ describe LessonSession do LessonSession.upcoming_sessions_reminder_early #UserMailer.deliveries.count.should eql 2 lesson.touch - lesson.sent_early_starting_notice.should be_false - lesson.is_approved?.should be_true + lesson.sent_early_starting_notice.should be false + lesson.is_approved?.should be true lesson.music_session.scheduled_start = 78.minutes.from_now lesson.music_session.save! LessonSession.upcoming_sessions_reminder_early UserMailer.deliveries.count.should eql 2 UserMailer.deliveries.clear lesson.reload - lesson.sent_early_starting_notice.should be_true + lesson.sent_early_starting_notice.should be true LessonSession.upcoming_sessions_reminder_early UserMailer.deliveries.count.should eql 0 end @@ -582,9 +582,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 1 user.sent_take_2nd_flesson_email_times.should eql 0 user.sent_take_plesson_email_times.should eql 0 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false #RSpec::Mocks.space.proxy_for(mailer).reset #RSpec::Mocks.space.proxy_for(UserMailer).reset UserMailer.deliveries.clear @@ -594,9 +594,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 1 user.sent_take_2nd_flesson_email_times.should eql 0 user.sent_take_plesson_email_times.should eql 0 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false #RSpec::Mocks.space.proxy_for(mailer).reset #RSpec::Mocks.space.proxy_for(UserMailer).reset UserMailer.deliveries.clear @@ -609,9 +609,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 2 user.sent_take_2nd_flesson_email_times.should eql 0 user.sent_take_plesson_email_times.should eql 0 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false #RSpec::Mocks.space.proxy_for(mailer).reset #RSpec::Mocks.space.proxy_for(UserMailer).reset UserMailer.deliveries.clear @@ -624,9 +624,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 0 user.sent_take_plesson_email_times.should eql 0 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false #RSpec::Mocks.space.proxy_for(mailer).reset #RSpec::Mocks.space.proxy_for(UserMailer).reset UserMailer.deliveries.clear @@ -637,9 +637,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 0 user.sent_take_plesson_email_times.should eql 0 - user.stuck_take_flesson.should be_true - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be true + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false #RSpec::Mocks.space.proxy_for(mailer).reset #RSpec::Mocks.space.proxy_for(UserMailer).reset UserMailer.deliveries.clear @@ -652,9 +652,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 0 user.sent_take_plesson_email_times.should eql 0 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false Timecop.travel(Date.today + 3) mailer.should_receive(:deliver_now).once @@ -664,9 +664,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 1 user.sent_take_plesson_email_times.should eql 0 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false Timecop.travel(Date.today + 3) mailer.should_receive(:deliver_now).once @@ -676,9 +676,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 2 user.sent_take_plesson_email_times.should eql 0 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false Timecop.travel(Date.today + 3) mailer.should_receive(:deliver_now).once @@ -688,9 +688,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 3 user.sent_take_plesson_email_times.should eql 0 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false Timecop.travel(Date.today + 3) LessonSession.onboarding_email_reminders @@ -698,9 +698,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 3 user.sent_take_plesson_email_times.should eql 0 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_true - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be true + user.stuck_take_plesson.should be false user.second_onboarding_free_lesson_at = Time.now user.save! @@ -710,9 +710,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 3 user.sent_take_plesson_email_times.should eql 0 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false Timecop.travel(Date.today + 3) mailer.should_receive(:deliver_now).once @@ -722,9 +722,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 3 user.sent_take_plesson_email_times.should eql 1 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false Timecop.travel(Date.today + 3) mailer.should_receive(:deliver_now).once @@ -734,9 +734,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 3 user.sent_take_plesson_email_times.should eql 2 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false Timecop.travel(Date.today + 3) mailer.should_receive(:deliver_now).once @@ -746,9 +746,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 3 user.sent_take_plesson_email_times.should eql 3 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_false + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be false Timecop.travel(Date.today + 3) LessonSession.onboarding_email_reminders @@ -756,9 +756,9 @@ describe LessonSession do user.sent_take_flesson_email_times.should eql 3 user.sent_take_2nd_flesson_email_times.should eql 3 user.sent_take_plesson_email_times.should eql 3 - user.stuck_take_flesson.should be_false - user.stuck_take_2nd_flesson.should be_false - user.stuck_take_plesson.should be_true + user.stuck_take_flesson.should be false + user.stuck_take_2nd_flesson.should be false + user.stuck_take_plesson.should be true end end diff --git a/ruby/spec/jam_ruby/models/mix_spec.rb b/ruby/spec/jam_ruby/models/mix_spec.rb index aca4ad006..0300cf6c6 100755 --- a/ruby/spec/jam_ruby/models/mix_spec.rb +++ b/ruby/spec/jam_ruby/models/mix_spec.rb @@ -14,7 +14,7 @@ describe Mix do @recording = Recording.start(@music_session, @user) @recording.stop @recording.claim(@user, "name", "description", Genre.first, true) - @recording.errors.any?.should be_false + @recording.errors.any?.should be false @mix = Mix.schedule(@recording) @mix.reload end @@ -51,7 +51,7 @@ describe Mix do @mix.finish(1, "abc", 1, "def") @mix.reload - @mix.errors.any?.should be_false + @mix.errors.any?.should be false @user2 = FactoryBot.create(:user) diff --git a/ruby/spec/jam_ruby/models/music_session_spec.rb b/ruby/spec/jam_ruby/models/music_session_spec.rb index 8731dfcfb..d681efdb2 100644 --- a/ruby/spec/jam_ruby/models/music_session_spec.rb +++ b/ruby/spec/jam_ruby/models/music_session_spec.rb @@ -14,7 +14,7 @@ describe MusicSession do it "genre must be set" do music_session = FactoryBot.build(:music_session) music_session.genre = nil - music_session.save.should be_false + music_session.save.should be false music_session.errors[:genre].should == ["can't be blank"] end @@ -25,7 +25,7 @@ describe MusicSession do 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.update({:description => "Session2", :genre => genre1}) session.reload session.description.should == "Session2" session.genre.should == genre1 @@ -35,7 +35,7 @@ describe MusicSession do 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.valid?.should be false music_session.errors["legal_terms"].should == ["is not included in the list"] end @@ -43,7 +43,7 @@ describe MusicSession do 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 + music_session.valid?.should be false end end @@ -73,7 +73,7 @@ describe MusicSession do it "wide open scheduled session" do session = MusicSession.create(creator, open_params) - session.valid?.should be_true + session.valid?.should be true # verify that scheduled_start is now 5 hours ahead of what was specified (CST during summer is -5 offset) session.scheduled_start.utc.should == DateTime.new(2014,07,11,3,00,0) @@ -85,7 +85,7 @@ describe MusicSession do it "works with UTC timezone" do open_params[:timezone] = 'UTC,Etc/UTC' session = MusicSession.create(creator, open_params) - session.valid?.should be_true + session.valid?.should be true # verify that scheduled_start is now 5 hours ahead of what was specified (CST during summer is -5 offset) session.scheduled_start.should == DateTime.new(2014,07,10,22,00,0) end @@ -95,7 +95,7 @@ describe MusicSession do open_params[:scheduled_start] = nil open_params[:scheduled_duration] = nil session = MusicSession.create(creator, open_params) - session.valid?.should be_true + session.valid?.should be true session.scheduled_start.should be_nil end end @@ -168,7 +168,7 @@ describe MusicSession do it "is_recording? returns false if not recording" do user1 = FactoryBot.create(:user) music_session = FactoryBot.build(:active_music_session, :creator => user1) - music_session.is_recording?.should be_false + music_session.is_recording?.should be false end describe "recordings" do @@ -196,7 +196,7 @@ describe MusicSession do end it "is_recording? returns true if recording" do - @music_session.is_recording?.should be_true + @music_session.is_recording?.should be true end it "stop_recording should return recording object if recording" do @@ -208,16 +208,16 @@ describe MusicSession do before(:each) do @recording = Recording.start(@music_session, @user1) - @recording.errors.any?.should be_false + @recording.errors.any?.should be false @recording.stop @recording.reload @claimed_recording = @recording.claim(@user1, "name", "description", Genre.first, true) - @claimed_recording.errors.any?.should be_false + @claimed_recording.errors.any?.should be false end it "allow a claimed recording to be associated" do @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.reload @music_session.claimed_recording.should == @claimed_recording @music_session.claimed_recording_initiator.should == @user1 @@ -225,9 +225,9 @@ describe MusicSession do it "allow a claimed recording to be removed" do @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.claimed_recording_stop - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.reload @music_session.claimed_recording.should be_nil @music_session.claimed_recording_initiator.should be_nil @@ -236,9 +236,9 @@ describe MusicSession do it "disallow a claimed recording to be started when already started by someone else" do @user2 = FactoryBot.create(:user) @music_session.claimed_recording_start(@user1, @claimed_recording) - @music_session.errors.any?.should be_false + @music_session.errors.any?.should be false @music_session.claimed_recording_start(@user2, @claimed_recording) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true @music_session.errors[:claimed_recording] == [ValidationMessages::CLAIMED_RECORDING_ALREADY_IN_PROGRESS] end @@ -246,9 +246,9 @@ describe MusicSession do @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 + @music_session.errors.any?.should be false @music_session.claimed_recording_start(@user1, @claimed_recording2) - @music_session.errors.any?.should be_true + @music_session.errors.any?.should be true end end end @@ -986,11 +986,11 @@ describe MusicSession do music_session1.description = "Hey!" music_session1.save! - music_session1.scheduling_info_changed.should be_false + music_session1.scheduling_info_changed.should be false music_session1.scheduled_start = Time.now - 1.days music_session1.save! - music_session1.scheduling_info_changed.should be_true + music_session1.scheduling_info_changed.should be true end end 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 d7c12bf85..b5054d49b 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 @@ -73,7 +73,7 @@ describe MusicSessionUserHistory do end it "when history1 only" do - user_history1.save.should be_true + user_history1.save.should be true user_history1.reload user_history1.end_history user_history1.max_concurrent_connections.should == 1 @@ -82,7 +82,7 @@ describe MusicSessionUserHistory do it "history2 ends before history1 starts" do user_history2.created_at = user_history1.created_at - 2 user_history2.session_removed_at = user_history1.created_at - 1 - user_history2.save.should be_true + user_history2.save.should be true user_history1.reload user_history2.reload user_history1.end_history @@ -92,7 +92,7 @@ describe MusicSessionUserHistory do it "history2 starts after history1 starts" do user_history2.created_at = user_history1.created_at + 1 user_history2.session_removed_at = user_history1.created_at + 2 - user_history2.save.should be_true + user_history2.save.should be true user_history1.reload user_history2.reload user_history1.end_history @@ -104,8 +104,8 @@ describe MusicSessionUserHistory do user_history2.created_at = user_history1.created_at - 1 user_history2.session_removed_at = user_history1.created_at + 2 - #user_history1.save.should be_true - user_history2.save.should be_true + #user_history1.save.should be true + user_history2.save.should be true expect(user_history1.session_removed_at).to be > user_history1.created_at expect(user_history2.session_removed_at).to be > user_history2.created_at @@ -122,8 +122,8 @@ describe MusicSessionUserHistory do user_history2.created_at = user_history1.created_at + 1 user_history2.session_removed_at = user_history1.created_at + 4 - user_history1.save.should be_true - user_history2.save.should be_true + user_history1.save.should be true + user_history2.save.should be true user_history1.reload user_history2.reload @@ -138,8 +138,8 @@ describe MusicSessionUserHistory do user_history1.session_removed_at = user_history1.created_at + 3 user_history2.created_at = user_history1.created_at + 1 user_history2.session_removed_at = user_history1.created_at + 2 - user_history1.save.should be_true - user_history2.save.should be_true + user_history1.save.should be true + user_history2.save.should be true user_history1.reload user_history2.reload user_history1.end_history @@ -155,9 +155,9 @@ describe MusicSessionUserHistory do user_history2.session_removed_at = user_history1.created_at + 2 user_history3.created_at = user_history1.created_at + 3 user_history3.session_removed_at = user_history1.created_at + 4 - user_history1.save.should be_true - user_history2.save.should be_true - user_history3.save.should be_true + user_history1.save.should be true + user_history2.save.should be true + user_history3.save.should be true user_history1.reload user_history2.reload user_history3.reload @@ -176,9 +176,9 @@ describe MusicSessionUserHistory do user_history2.session_removed_at = user_history1.created_at + 2 user_history3.created_at = user_history1.created_at + 3 user_history3.session_removed_at = user_history1.created_at + 4 - user_history1.save.should be_true - user_history2.save.should be_true - user_history3.save.should be_true + user_history1.save.should be true + user_history2.save.should be true + user_history3.save.should be true user_history1.reload user_history2.reload user_history3.reload @@ -197,9 +197,9 @@ describe MusicSessionUserHistory do user_history2.session_removed_at = user_history1.created_at + 3 user_history3.created_at = user_history1.created_at + 2 user_history3.session_removed_at = user_history1.created_at + 4 - user_history1.save.should be_true - user_history2.save.should be_true - user_history3.save.should be_true + user_history1.save.should be true + user_history2.save.should be true + user_history3.save.should be true user_history1.reload user_history2.reload user_history3.reload @@ -214,7 +214,7 @@ describe MusicSessionUserHistory do user_history2.created_at = user_history1.created_at - 2 user_history2.session_removed_at = user_history1.created_at - 1 - user_history2.save.should be_true + user_history2.save.should be true user_history2.reload user_history1.end_history @@ -228,7 +228,7 @@ describe MusicSessionUserHistory do user_history2.created_at = user_history1.session_removed_at + 1 user_history2.session_removed_at = user_history1.session_removed_at + 2 - user_history2.save.should be_true + user_history2.save.should be true user_history2.reload user_history1.end_history @@ -245,8 +245,8 @@ describe MusicSessionUserHistory do user_history2.created_at = user_history1.created_at + 1*60 user_history2.session_removed_at = user_history1.created_at + 3*60 - user_history1.save.should be_true - user_history2.save.should be_true + user_history1.save.should be true + user_history2.save.should be true user_history1.reload user_history2.reload @@ -261,8 +261,8 @@ describe MusicSessionUserHistory do user_history2.created_at = user_history1.created_at + 1*60 user_history2.session_removed_at = user_history1.created_at + 3*60 - user_history1.save.should be_true - user_history2.save.should be_true + user_history1.save.should be true + user_history2.save.should be true user_history1.reload user_history2.reload diff --git a/ruby/spec/jam_ruby/models/notification_spec.rb b/ruby/spec/jam_ruby/models/notification_spec.rb index 773a61335..ab3a86c03 100644 --- a/ruby/spec/jam_ruby/models/notification_spec.rb +++ b/ruby/spec/jam_ruby/models/notification_spec.rb @@ -37,7 +37,7 @@ describe Notification do result end - describe "unred notifications", focus: true do + describe "unred notifications" do it "returns unread notifications" do notification = Notification.send_friend_request(@friend_request.id, @sender.id, @receiver.id) unread = Notification.unread @@ -56,7 +56,7 @@ describe Notification do calls = count_publish_to_user_calls notification = Notification.send_friend_request(@friend_request.id, @sender.id, @receiver.id) - notification.errors.any?.should be_false + notification.errors.any?.should be false UserMailer.deliveries.length.should == 1 calls[:count].should == 0 end @@ -68,7 +68,7 @@ describe Notification do calls = count_publish_to_user_calls notification = Notification.send_friend_request(@friend_request.id, @sender.id, @receiver.id) - notification.errors.any?.should be_false + notification.errors.any?.should be false UserMailer.deliveries.length.should == 0 calls[:count].should == 0 end @@ -78,7 +78,7 @@ describe Notification do calls = count_publish_to_user_calls notification = Notification.send_friend_request(@friend_request.id, @sender.id, @receiver.id) - notification.errors.any?.should be_false + notification.errors.any?.should be false UserMailer.deliveries.length.should == 0 calls[:count].should == 1 end @@ -724,11 +724,11 @@ describe Notification do calls = count_publish_to_user_calls calls[:count].should == 0 - mail.html_part.body.include?("is scheduled for tomorrow").should be_true - mail.text_part.body.include?("is scheduled for tomorrow").should be_true + mail.html_part.body.include?("is scheduled for tomorrow").should be true + mail.text_part.body.include?("is scheduled for tomorrow").should be true - mail.html_part.body.include?("starts in 1 hour").should be_false - mail.text_part.body.include?("starts in 1 hour").should be_false + mail.html_part.body.include?("starts in 1 hour").should be false + mail.text_part.body.include?("starts in 1 hour").should be false end it "sends email 1 hour before" do @@ -742,11 +742,11 @@ describe Notification do UserMailer.deliveries.length.should == 1 calls = count_publish_to_user_calls calls[:count].should == 0 - mail.html_part.body.include?("is scheduled for tomorrow").should be_false - mail.text_part.body.include?("is scheduled for tomorrow").should be_false + mail.html_part.body.include?("is scheduled for tomorrow").should be false + mail.text_part.body.include?("is scheduled for tomorrow").should be false - mail.html_part.body.include?("starts in 1 hour").should be_true - mail.text_part.body.include?("starts in 1 hour").should be_true + mail.html_part.body.include?("starts in 1 hour").should be true + mail.text_part.body.include?("starts in 1 hour").should be true end @@ -824,7 +824,7 @@ describe Notification do calls = count_publish_to_user_calls notification = Notification.send_text_message(message, @sender, @receiver) - notification.errors.any?.should be_false + notification.errors.any?.should be false UserMailer.deliveries.length.should == 1 calls[:count].should == 0 end @@ -837,7 +837,7 @@ describe Notification do calls = count_publish_to_user_calls notification = Notification.send_text_message(message, @sender, @receiver) - notification.errors.any?.should be_false + notification.errors.any?.should be false UserMailer.deliveries.length.should == 0 calls[:count].should == 1 calls[:msg].text_message.msg.should == message @@ -845,7 +845,7 @@ describe Notification do calls[:msg].text_message.sender_name.should == @sender.name calls[:msg].text_message.notification_id.should == notification.id calls[:msg].text_message.created_at = notification.created_date - calls[:msg].text_message.clipped_msg.should be_false + calls[:msg].text_message.clipped_msg.should be false end it "success when online with long message" do @@ -855,7 +855,7 @@ describe Notification do calls = count_publish_to_user_calls notification = Notification.send_text_message(message, @sender, @receiver) - notification.errors.any?.should be_false + notification.errors.any?.should be false UserMailer.deliveries.length.should == 0 calls[:count].should == 1 calls[:msg].text_message.msg.should == "0" * 200 @@ -863,7 +863,7 @@ describe Notification do calls[:msg].text_message.sender_name.should == @sender.name calls[:msg].text_message.notification_id.should == notification.id calls[:msg].text_message.created_at = notification.created_date - calls[:msg].text_message.clipped_msg.should be_true + calls[:msg].text_message.clipped_msg.should be true end it "fails with profanity" do @@ -871,7 +871,7 @@ describe Notification do calls = count_publish_to_user_calls notification = Notification.send_text_message(message, @sender, @receiver) - notification.errors.any?.should be_true + notification.errors.any?.should be true notification.errors[:message].should == ['cannot contain profanity'] UserMailer.deliveries.length.should == 0 calls[:count].should == 0 @@ -882,7 +882,7 @@ describe Notification do calls = count_publish_to_user_calls notification = Notification.send_text_message(message, @sender, @sender) - notification.errors.any?.should be_true + notification.errors.any?.should be true notification.errors[:target_user].should == [ValidationMessages::DIFFERENT_SOURCE_TARGET] UserMailer.deliveries.length.should == 0 calls[:count].should == 0 @@ -893,7 +893,7 @@ describe Notification do calls = count_publish_to_user_calls notification = Notification.send_text_message(message, @sender, @receiver) - notification.errors.any?.should be_true + notification.errors.any?.should be true notification.errors[:message].should == ['is too short (minimum is 1 character)'] UserMailer.deliveries.length.should == 0 calls[:count].should == 0 diff --git a/ruby/spec/jam_ruby/models/posa_card_spec.rb b/ruby/spec/jam_ruby/models/posa_card_spec.rb index f08b650fc..f064561d1 100644 --- a/ruby/spec/jam_ruby/models/posa_card_spec.rb +++ b/ruby/spec/jam_ruby/models/posa_card_spec.rb @@ -97,7 +97,7 @@ describe PosaCard do card_lessons.claim(user) user.reload - user.is_guitar_center_student?.should be_true + user.is_guitar_center_student?.should be true card_lessons.errors.any?.should be false card_lessons.claimed_at.should_not be_nil card_lessons.user.should eql user diff --git a/ruby/spec/jam_ruby/models/quick_mix_spec.rb b/ruby/spec/jam_ruby/models/quick_mix_spec.rb index f4a1ad44b..52ebcb043 100644 --- a/ruby/spec/jam_ruby/models/quick_mix_spec.rb +++ b/ruby/spec/jam_ruby/models/quick_mix_spec.rb @@ -24,7 +24,7 @@ describe QuickMix do it "should update the next part to upload properly" do @quick_mix = QuickMix.create(@recording, @user) @quick_mix.upload_part_complete(1, 1000) - @quick_mix.errors.any?.should be_true + @quick_mix.errors.any?.should be true @quick_mix.errors[:ogg_length][0].should == "is too short (minimum is 1 character)" @quick_mix.errors[:ogg_md5][0].should == "can't be blank" end @@ -32,7 +32,7 @@ describe QuickMix do it "gets a url for the track" do @quick_mix = QuickMix.create(@recording, @user) - @quick_mix.errors.any?.should be_false + @quick_mix.errors.any?.should be false @quick_mix[:ogg_url].should == "recordings/#{@recording.created_at.strftime('%m-%d-%Y')}/#{@recording.id}/stream-mix-#{@quick_mix.id}.ogg" @quick_mix[:mp3_url].should == "recordings/#{@recording.created_at.strftime('%m-%d-%Y')}/#{@recording.id}/stream-mix-#{@quick_mix.id}.mp3" end @@ -85,7 +85,7 @@ describe QuickMix do @quick_mix = QuickMix.create(@recording, @user) @quick_mix.upload_start(1000, "abc") @quick_mix.upload_part_complete(1, 1000) - @quick_mix.errors.any?.should be_true + @quick_mix.errors.any?.should be true @quick_mix.errors[:next_part_to_upload][0].should == ValidationMessages::PART_NOT_STARTED end @@ -93,9 +93,9 @@ describe QuickMix do @quick_mix = QuickMix.create(@recording, @user) @quick_mix.upload_start(1000, "abc") @quick_mix.upload_next_part(1000, "abc") - @quick_mix.errors.any?.should be_false + @quick_mix.errors.any?.should be false @quick_mix.upload_part_complete(1, 1000) - @quick_mix.errors.any?.should be_true + @quick_mix.errors.any?.should be true @quick_mix.errors[:next_part_to_upload][0].should == ValidationMessages::PART_NOT_FOUND_IN_AWS end @@ -103,7 +103,7 @@ describe QuickMix do @quick_mix = QuickMix.create(@recording, @user) @quick_mix.upload_start(File.size(upload_file), md5) @quick_mix.upload_next_part(File.size(upload_file), md5) - @quick_mix.errors.any?.should be_false + @quick_mix.errors.any?.should be false APP_CONFIG.max_track_part_upload_failures.times do |i| @quick_mix.upload_part_complete(@quick_mix.next_part_to_upload, File.size(upload_file)) @quick_mix.errors[:next_part_to_upload] == [ValidationMessages::PART_NOT_FOUND_IN_AWS] @@ -131,7 +131,7 @@ describe QuickMix do APP_CONFIG.max_track_upload_failures.times do |j| @quick_mix.upload_start(File.size(upload_file), md5) @quick_mix.upload_next_part(File.size(upload_file), md5) - @quick_mix.errors.any?.should be_false + @quick_mix.errors.any?.should be false APP_CONFIG.max_track_part_upload_failures.times do |i| @quick_mix.upload_part_complete(@quick_mix.next_part_to_upload, File.size(upload_file)) @quick_mix.errors[:next_part_to_upload] == [ValidationMessages::PART_NOT_FOUND_IN_AWS] @@ -167,16 +167,16 @@ describe QuickMix do signed_data = @quick_mix.upload_sign(md5) @response = put_file_to_aws(signed_data, upload_file_contents) @quick_mix.upload_part_complete(@quick_mix.next_part_to_upload, File.size(upload_file)) - @quick_mix.errors.any?.should be_false + @quick_mix.errors.any?.should be false @quick_mix.upload_complete @quick_mix.marking_complete = false # this is a side effect of using the same model throughout this process; controllers wouldn't see this @quick_mix.finish(File.size(upload_file), md5) - @quick_mix.errors.any?.should be_false + @quick_mix.errors.any?.should be false # let's verify that .finish sets everything it should @quick_mix.mp3_length.should == File.size(upload_file) @quick_mix.mp3_md5.should == md5 - @quick_mix.completed.should be_true + @quick_mix.completed.should be true @quick_mix.recording.reload @quick_mix.recording.first_quick_mix_id.should == @quick_mix.id end @@ -188,21 +188,21 @@ describe QuickMix do it "can't mark completely uploaded twice" do @quick_mix.upload_complete - @quick_mix.errors.any?.should be_true + @quick_mix.errors.any?.should be true @quick_mix.errors[:fully_uploaded][0].should == "already set" @quick_mix.part_failures.should == 0 end it "can't ask for a next part if fully uploaded" do @quick_mix.upload_next_part(File.size(upload_file), md5) - @quick_mix.errors.any?.should be_true + @quick_mix.errors.any?.should be true @quick_mix.errors[:fully_uploaded][0].should == "already set" @quick_mix.part_failures.should == 0 end it "can't ask for mark part complete if fully uploaded" do @quick_mix.upload_part_complete(1, 1000) - @quick_mix.errors.any?.should be_true + @quick_mix.errors.any?.should be true @quick_mix.errors[:fully_uploaded][0].should == "already set" @quick_mix.part_failures.should == 0 end 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 f1eedf678..243ffdbd8 100644 --- a/ruby/spec/jam_ruby/models/recorded_backing_track_spec.rb +++ b/ruby/spec/jam_ruby/models/recorded_backing_track_spec.rb @@ -29,20 +29,20 @@ describe RecordedBackingTrack do it "should update the next part to upload properly" do @recorded_backing_track = RecordedBackingTrack.create_from_backing_track(@backing_track, @recording) @recorded_backing_track.upload_part_complete(1, 1000) - @recorded_backing_track.errors.any?.should be_true + @recorded_backing_track.errors.any?.should be true @recorded_backing_track.errors[:length][0].should == "is too short (minimum is 1 character)" @recorded_backing_track.errors[:md5][0].should == "can't be blank" end it "properly finds a recorded track given its upload filename" do @recorded_backing_track = RecordedBackingTrack.create_from_backing_track(@backing_track, @recording) - @recorded_backing_track.save.should be_true + @recorded_backing_track.save.should be true RecordedBackingTrack.find_by_recording_id_and_backing_track_id(@recorded_backing_track.recording_id, @recorded_backing_track.backing_track_id).should == @recorded_backing_track end it "gets a url for the track" do @recorded_backing_track = RecordedBackingTrack.create_from_backing_track(@backing_track, @recording) - @recorded_backing_track.errors.any?.should be_false + @recorded_backing_track.errors.any?.should be false @recorded_backing_track[:url].should == "recordings/#{@recorded_backing_track.created_at.strftime('%m-%d-%Y')}/#{@recording.id}/backing-track-#{@backing_track.client_track_id}.ogg" end @@ -55,15 +55,15 @@ describe RecordedBackingTrack do it "can not be downloaded if no claimed recording" do 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 + @recorded_backing_track.can_download?(user2).should be false + @recorded_backing_track.can_download?(@user).should be false end it "can be downloaded if there is a claimed recording" do @recorded_track = RecordedTrack.create_from_track(@track, @recording) @recorded_backing_track = RecordedBackingTrack.create_from_backing_track(@backing_track, @recording) - @recording.claim(@user, "my recording", "my description", Genre.first, true).errors.any?.should be_false - @recorded_backing_track.can_download?(@user).should be_true + @recording.claim(@user, "my recording", "my description", Genre.first, true).errors.any?.should be false + @recorded_backing_track.can_download?(@user).should be true end @@ -109,7 +109,7 @@ describe RecordedBackingTrack do @recorded_backing_track = RecordedBackingTrack.create_from_backing_track(@backing_track, @recording) @recorded_backing_track.upload_start(1000, "abc") @recorded_backing_track.upload_part_complete(1, 1000) - @recorded_backing_track.errors.any?.should be_true + @recorded_backing_track.errors.any?.should be true @recorded_backing_track.errors[:next_part_to_upload][0].should == ValidationMessages::PART_NOT_STARTED end @@ -117,9 +117,9 @@ describe RecordedBackingTrack do @recorded_backing_track = RecordedBackingTrack.create_from_backing_track(@backing_track, @recording) @recorded_backing_track.upload_start(1000, "abc") @recorded_backing_track.upload_next_part(1000, "abc") - @recorded_backing_track.errors.any?.should be_false + @recorded_backing_track.errors.any?.should be false @recorded_backing_track.upload_part_complete(1, 1000) - @recorded_backing_track.errors.any?.should be_true + @recorded_backing_track.errors.any?.should be true @recorded_backing_track.errors[:next_part_to_upload][0].should == ValidationMessages::PART_NOT_FOUND_IN_AWS end @@ -127,7 +127,7 @@ describe RecordedBackingTrack do @recorded_backing_track = RecordedBackingTrack.create_from_backing_track(@backing_track, @recording) @recorded_backing_track.upload_start(File.size(upload_file), md5) @recorded_backing_track.upload_next_part(File.size(upload_file), md5) - @recorded_backing_track.errors.any?.should be_false + @recorded_backing_track.errors.any?.should be false APP_CONFIG.max_track_part_upload_failures.times do |i| @recorded_backing_track.upload_part_complete(@recorded_backing_track.next_part_to_upload, File.size(upload_file)) @recorded_backing_track.errors[:next_part_to_upload] == [ValidationMessages::PART_NOT_FOUND_IN_AWS] @@ -155,7 +155,7 @@ describe RecordedBackingTrack do APP_CONFIG.max_track_upload_failures.times do |j| @recorded_backing_track.upload_start(File.size(upload_file), md5) @recorded_backing_track.upload_next_part(File.size(upload_file), md5) - @recorded_backing_track.errors.any?.should be_false + @recorded_backing_track.errors.any?.should be false APP_CONFIG.max_track_part_upload_failures.times do |i| @recorded_backing_track.upload_part_complete(@recorded_backing_track.next_part_to_upload, File.size(upload_file)) @recorded_backing_track.errors[:next_part_to_upload] == [ValidationMessages::PART_NOT_FOUND_IN_AWS] @@ -191,9 +191,9 @@ describe RecordedBackingTrack do signed_data = @recorded_backing_track.upload_sign(md5) @response = put_file_to_aws(signed_data, upload_file_contents) @recorded_backing_track.upload_part_complete(@recorded_backing_track.next_part_to_upload, File.size(upload_file)) - @recorded_backing_track.errors.any?.should be_false + @recorded_backing_track.errors.any?.should be false @recorded_backing_track.upload_complete - @recorded_backing_track.errors.any?.should be_false + @recorded_backing_track.errors.any?.should be false @recorded_backing_track.marking_complete = false end @@ -204,21 +204,21 @@ describe RecordedBackingTrack do it "can't mark completely uploaded twice" do @recorded_backing_track.upload_complete - @recorded_backing_track.errors.any?.should be_true + @recorded_backing_track.errors.any?.should be true @recorded_backing_track.errors[:fully_uploaded][0].should == "already set" @recorded_backing_track.part_failures.should == 0 end it "can't ask for a next part if fully uploaded" do @recorded_backing_track.upload_next_part(File.size(upload_file), md5) - @recorded_backing_track.errors.any?.should be_true + @recorded_backing_track.errors.any?.should be true @recorded_backing_track.errors[:fully_uploaded][0].should == "already set" @recorded_backing_track.part_failures.should == 0 end it "can't ask for mark part complete if fully uploaded" do @recorded_backing_track.upload_part_complete(1, 1000) - @recorded_backing_track.errors.any?.should be_true + @recorded_backing_track.errors.any?.should be true @recorded_backing_track.errors[:fully_uploaded][0].should == "already set" @recorded_backing_track.part_failures.should == 0 end diff --git a/ruby/spec/jam_ruby/models/recorded_track_spec.rb b/ruby/spec/jam_ruby/models/recorded_track_spec.rb index 2170efa48..51106aa13 100644 --- a/ruby/spec/jam_ruby/models/recorded_track_spec.rb +++ b/ruby/spec/jam_ruby/models/recorded_track_spec.rb @@ -28,20 +28,20 @@ describe RecordedTrack do it "should update the next part to upload properly" do @recorded_track = RecordedTrack.create_from_track(@track, @recording) @recorded_track.upload_part_complete(1, 1000) - @recorded_track.errors.any?.should be_true + @recorded_track.errors.any?.should be true @recorded_track.errors[:length][0].should == "is too short (minimum is 1 character)" @recorded_track.errors[:md5][0].should == "can't be blank" end it "properly finds a recorded track given its upload filename" do @recorded_track = RecordedTrack.create_from_track(@track, @recording) - @recorded_track.save.should be_true + @recorded_track.save.should be true RecordedTrack.find_by_recording_id_and_track_id(@recorded_track.recording_id, @recorded_track.track_id).should == @recorded_track end it "gets a url for the track" do @recorded_track = RecordedTrack.create_from_track(@track, @recording) - @recorded_track.errors.any?.should be_false + @recorded_track.errors.any?.should be false @recorded_track[:url].should == "recordings/#{@recorded_track.created_at.strftime('%m-%d-%Y')}/#{@recording.id}/track-#{@track.client_track_id}.ogg" end @@ -54,14 +54,14 @@ describe RecordedTrack do it "can not be downloaded if no claimed recording" do 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 + @recorded_track.can_download?(user2).should be false + @recorded_track.can_download?(@user).should be false end it "can be downloaded if there is a claimed recording" do @recorded_track = RecordedTrack.create_from_track(@track, @recording) - @recording.claim(@user, "my recording", "my description", Genre.first, true).errors.any?.should be_false - @recorded_track.can_download?(@user).should be_true + @recording.claim(@user, "my recording", "my description", Genre.first, true).errors.any?.should be false + @recorded_track.can_download?(@user).should be true end @@ -107,7 +107,7 @@ describe RecordedTrack do @recorded_track = RecordedTrack.create_from_track(@track, @recording) @recorded_track.upload_start(1000, "abc") @recorded_track.upload_part_complete(1, 1000) - @recorded_track.errors.any?.should be_true + @recorded_track.errors.any?.should be true @recorded_track.errors[:next_part_to_upload][0].should == ValidationMessages::PART_NOT_STARTED end @@ -115,9 +115,9 @@ describe RecordedTrack do @recorded_track = RecordedTrack.create_from_track(@track, @recording) @recorded_track.upload_start(1000, "abc") @recorded_track.upload_next_part(1000, "abc") - @recorded_track.errors.any?.should be_false + @recorded_track.errors.any?.should be false @recorded_track.upload_part_complete(1, 1000) - @recorded_track.errors.any?.should be_true + @recorded_track.errors.any?.should be true @recorded_track.errors[:next_part_to_upload][0].should == ValidationMessages::PART_NOT_FOUND_IN_AWS end @@ -125,7 +125,7 @@ describe RecordedTrack do @recorded_track = RecordedTrack.create_from_track(@track, @recording) @recorded_track.upload_start(File.size(upload_file), md5) @recorded_track.upload_next_part(File.size(upload_file), md5) - @recorded_track.errors.any?.should be_false + @recorded_track.errors.any?.should be false APP_CONFIG.max_track_part_upload_failures.times do |i| @recorded_track.upload_part_complete(@recorded_track.next_part_to_upload, File.size(upload_file)) @recorded_track.errors[:next_part_to_upload] == [ValidationMessages::PART_NOT_FOUND_IN_AWS] @@ -153,7 +153,7 @@ describe RecordedTrack do APP_CONFIG.max_track_upload_failures.times do |j| @recorded_track.upload_start(File.size(upload_file), md5) @recorded_track.upload_next_part(File.size(upload_file), md5) - @recorded_track.errors.any?.should be_false + @recorded_track.errors.any?.should be false APP_CONFIG.max_track_part_upload_failures.times do |i| @recorded_track.upload_part_complete(@recorded_track.next_part_to_upload, File.size(upload_file)) @recorded_track.errors[:next_part_to_upload] == [ValidationMessages::PART_NOT_FOUND_IN_AWS] @@ -189,9 +189,9 @@ describe RecordedTrack do signed_data = @recorded_track.upload_sign(md5) @response = put_file_to_aws(signed_data, upload_file_contents) @recorded_track.upload_part_complete(@recorded_track.next_part_to_upload, File.size(upload_file)) - @recorded_track.errors.any?.should be_false + @recorded_track.errors.any?.should be false @recorded_track.upload_complete - @recorded_track.errors.any?.should be_false + @recorded_track.errors.any?.should be false @recorded_track.marking_complete = false end @@ -202,21 +202,21 @@ describe RecordedTrack do it "can't mark completely uploaded twice" do @recorded_track.upload_complete - @recorded_track.errors.any?.should be_true + @recorded_track.errors.any?.should be true @recorded_track.errors[:fully_uploaded][0].should == "already set" @recorded_track.part_failures.should == 0 end it "can't ask for a next part if fully uploaded" do @recorded_track.upload_next_part(File.size(upload_file), md5) - @recorded_track.errors.any?.should be_true + @recorded_track.errors.any?.should be true @recorded_track.errors[:fully_uploaded][0].should == "already set" @recorded_track.part_failures.should == 0 end it "can't ask for mark part complete if fully uploaded" do @recorded_track.upload_part_complete(1, 1000) - @recorded_track.errors.any?.should be_true + @recorded_track.errors.any?.should be true @recorded_track.errors[:fully_uploaded][0].should == "already set" @recorded_track.part_failures.should == 0 end diff --git a/ruby/spec/jam_ruby/models/recording_spec.rb b/ruby/spec/jam_ruby/models/recording_spec.rb index d049ab156..d3bed2930 100644 --- a/ruby/spec/jam_ruby/models/recording_spec.rb +++ b/ruby/spec/jam_ruby/models/recording_spec.rb @@ -19,13 +19,13 @@ describe Recording do it "success with no video" do recording = Recording.create_immediately(@user, {name: 'My recording', description: nil, genre: Genre.first, record_video: false, is_public: true, upload_to_youtube: false}) puts "recording errros #{recording.errors.inspect}" - recording.errors.any?.should be_false + recording.errors.any?.should be false recording.reload recording.claimed_recordings.count.should eql 1 claim = recording.claimed_recordings.first claim.name.should eql 'My recording' claim.description.should be_nil - claim.discarded.should be_false + claim.discarded.should be false claim.user.should eql @user recording.owner.should eql @user end @@ -78,17 +78,17 @@ describe Recording do it "leaves untouched no completed mixes" do - recording.has_final_mix.should be_false - recording.has_stream_mix.should be_false - quick_mix.cleaned.should be_false + recording.has_final_mix.should be false + recording.has_stream_mix.should be false + quick_mix.cleaned.should be false QuickMix.cleanup_excessive_storage recording.reload quick_mix.reload - recording.has_final_mix.should be_false - recording.has_stream_mix.should be_false - quick_mix.cleaned.should be_false + recording.has_final_mix.should be false + recording.has_stream_mix.should be false + quick_mix.cleaned.should be false end @@ -109,9 +109,9 @@ describe Recording do recording.reload quick_mix.reload - recording.has_final_mix.should be_false - recording.has_stream_mix.should be_true - quick_mix.cleaned.should be_false + recording.has_final_mix.should be false + recording.has_stream_mix.should be true + quick_mix.cleaned.should be false quick_mix[:ogg_url].should_not be_nil quick_mix[:mp3_url].should_not be_nil end @@ -134,14 +134,14 @@ describe Recording do recording.reload quick_mix.reload - recording.has_final_mix.should be_true - recording.has_stream_mix.should be_false + recording.has_final_mix.should be true + recording.has_stream_mix.should be false recording.first_quick_mix_id.should be_nil - quick_mix.cleaned.should be_true + quick_mix.cleaned.should be true quick_mix[:ogg_url].should_not be_nil quick_mix[:mp3_url].should_not be_nil - s3_manager.exists?(quick_mix.filename('ogg')).should be_false - s3_manager.exists?(quick_mix.filename('mp3')).should be_false + s3_manager.exists?(quick_mix.filename('ogg')).should be false + s3_manager.exists?(quick_mix.filename('mp3')).should be false end @@ -172,19 +172,19 @@ describe Recording do quick_mix.reload quick_mix2.reload - recording.has_final_mix.should be_false - recording.has_stream_mix.should be_true + recording.has_final_mix.should be false + recording.has_stream_mix.should be true recording.first_quick_mix_id.should_not be_nil - quick_mix.cleaned.should be_false + quick_mix.cleaned.should be false quick_mix[:ogg_url].should_not be_nil quick_mix[:mp3_url].should_not be_nil - s3_manager.exists?(quick_mix.filename('ogg')).should be_true - s3_manager.exists?(quick_mix.filename('mp3')).should be_true - quick_mix2.cleaned.should be_true + s3_manager.exists?(quick_mix.filename('ogg')).should be true + s3_manager.exists?(quick_mix.filename('mp3')).should be true + quick_mix2.cleaned.should be true quick_mix2[:ogg_url].should_not be_nil quick_mix2[:mp3_url].should_not be_nil - s3_manager.exists?(quick_mix2.filename('ogg')).should be_false - s3_manager.exists?(quick_mix2.filename('mp3')).should be_false + s3_manager.exists?(quick_mix2.filename('ogg')).should be false + s3_manager.exists?(quick_mix2.filename('mp3')).should be false end @@ -216,19 +216,19 @@ describe Recording do quick_mix.reload quick_mix2.reload - recording.has_final_mix.should be_true - recording.has_stream_mix.should be_false + recording.has_final_mix.should be true + recording.has_stream_mix.should be false recording.first_quick_mix_id.should be_nil - quick_mix.cleaned.should be_true + quick_mix.cleaned.should be true quick_mix[:ogg_url].should_not be_nil quick_mix[:mp3_url].should_not be_nil - s3_manager.exists?(quick_mix.filename('ogg')).should be_false - s3_manager.exists?(quick_mix.filename('mp3')).should be_false - quick_mix2.cleaned.should be_true + s3_manager.exists?(quick_mix.filename('ogg')).should be false + s3_manager.exists?(quick_mix.filename('mp3')).should be false + quick_mix2.cleaned.should be true quick_mix2[:ogg_url].should_not be_nil quick_mix2[:mp3_url].should_not be_nil - s3_manager.exists?(quick_mix2.filename('ogg')).should be_false - s3_manager.exists?(quick_mix2.filename('mp3')).should be_false + s3_manager.exists?(quick_mix2.filename('ogg')).should be false + s3_manager.exists?(quick_mix2.filename('mp3')).should be false end end @@ -265,7 +265,7 @@ describe Recording do end it "should set up the recording properly when recording is started with 1 user in the session" do - @music_session.is_recording?.should be_false + @music_session.is_recording?.should be false @recording = Recording.start(@music_session, @user) @music_session.reload @music_session.recordings[0].should == @recording @@ -278,7 +278,7 @@ describe Recording do end it "should not start a recording if the session is already being recorded" do - Recording.start(@music_session, @user).errors.any?.should be_false + Recording.start(@music_session, @user).errors.any?.should be false recording = Recording.start(@music_session, @user) recording.valid?.should_not be_true @@ -289,16 +289,16 @@ describe Recording do @recording = Recording.start(@music_session, @user) @recording.stop @music_session.reload - @music_session.is_recording?.should be_false + @music_session.is_recording?.should be false end it "should error when you stop a recording twice" do @recording = Recording.start(@music_session, @user) @recording.stop - @recording.errors.any?.should be_false + @recording.errors.any?.should be false @recording.stop - @recording.errors.any?.should be_true + @recording.errors.any?.should be true end it "should be able to start, stop then start a recording again for the same music session" do @@ -306,7 +306,7 @@ describe Recording do @recording.stop @recording.keep(@user) @recording2 = Recording.start(@music_session, @user) - @music_session.recordings.exists?(@recording2.id).should be_true + @music_session.recordings.exists?(@recording2.id).should be true end it "should NOT attach the recording to all users in a the music session when recording started" do @@ -545,34 +545,34 @@ describe Recording do end it "no one votes" do - @recording.all_discarded.should be_false + @recording.all_discarded.should be false @recording2 = Recording.start(@music_session, @user) - @recording2.errors.any?.should be_true + @recording2.errors.any?.should be true @recording2.errors[:music_session].should == [ValidationMessages::PREVIOUS_RECORDING_STILL_BEING_FINALIZED] end it "only one discards" do @recording.discard(@user) - @recording.all_discarded.should be_false + @recording.all_discarded.should be false @recording2 = Recording.start(@music_session, @user) - @recording2.errors.any?.should be_true + @recording2.errors.any?.should be true @recording2.errors[:music_session].should == [ValidationMessages::PREVIOUS_RECORDING_STILL_BEING_FINALIZED] end it "everyone discards" do @recording.discard(@user) @recording.discard(@user2) - @recording.all_discarded.should be_true + @recording.all_discarded.should be true @recording2 = Recording.start(@music_session, @user) - @recording2.errors.any?.should be_false + @recording2.errors.any?.should be false end it "one discards, the other leaves the session" do @recording.discard(@user) - @recording.all_discarded.should be_false + @recording.all_discarded.should be false @connection2.delete @recording2 = Recording.start(@music_session, @user2) - @recording2.errors.any?.should be_false + @recording2.errors.any?.should be false end end @@ -580,14 +580,14 @@ describe Recording do it "set video from source" do @video_source = FactoryBot.create(:video_source, :connection => @connection) - @music_session.is_recording?.should be_false + @music_session.is_recording?.should be false @recording = Recording.start(@music_session, @user) @music_session.reload @music_session.recordings[0].should == @recording @recording.owner_id.should == @user.id @recorded_videos = RecordedVideo.where(:recording_id => @recording.id) - @recorded_videos.should have(1).items + @recorded_videos.size.should == 1 @recorded_videos[0].client_video_source_id.should eq(@video_source.client_video_source_id) end @@ -603,7 +603,7 @@ describe Recording do # We should have 2 items; a track and a video: uploads = Recording.list_uploads(@user) - uploads["uploads"].should have(3).items + uploads["uploads"].size.should == 3 uploads["uploads"][0][:type].should eq("stream_mix") uploads["uploads"][1][:type].should eq("recorded_track") uploads["uploads"][2][:type].should eq("recorded_video") @@ -612,7 +612,7 @@ describe Recording do # Next page should have nothing: uploads = Recording.list_uploads(@user, 10, uploads["next"]) - uploads["uploads"].should have(0).items + uploads["uploads"].size.should == 0 end it "should paginate with video" do @@ -625,21 +625,21 @@ describe Recording do # Limit to 1, so we can test pagination: uploads = Recording.list_uploads(@user, 1) - uploads["uploads"].should have(1).items # First page + uploads["uploads"].size.should == 1 # First page uploads["uploads"][0][:type].should == 'stream_mix' # Second page: uploads = Recording.list_uploads(@user, 1, uploads["next"]) - uploads["uploads"].should have(1).items + uploads["uploads"].size.should == 1 uploads["uploads"][0][:type].should == 'recorded_track' # Last page (should be empty): uploads = Recording.list_uploads(@user, 1, uploads["next"]) - uploads["uploads"].should have(1).items + uploads["uploads"].size.should == 1 uploads["uploads"][0][:type].should == 'recorded_video' uploads = Recording.list_uploads(@user, 1, uploads["next"]) - uploads["uploads"].should have(0).items + uploads["uploads"].size.should == 0 end it "should only retrieve tracks and videos from user" do @@ -660,7 +660,7 @@ describe Recording do # We should have 3 items; a track and a video: uploads = Recording.list_uploads(@user) - uploads["uploads"].should have(3).items + uploads["uploads"].size.should == 3 uploads["uploads"][0][:type].should eq("stream_mix") uploads["uploads"][1][:type].should eq("recorded_track") uploads["uploads"][2][:type].should eq("recorded_video") @@ -672,12 +672,12 @@ describe Recording do # Next page should have nothing: uploads = Recording.list_uploads(@user, 10, uploads["next"]) - uploads["uploads"].should have(0).items + uploads["uploads"].size.should == 0 # List uploads for user2. We should have 2 items; a track and a video: # The track and video source IDs should be different than above: uploads = Recording.list_uploads(user2) - uploads["uploads"].should have(3).items + uploads["uploads"].size.should == 3 uploads["uploads"][0][:type].should eq("stream_mix") uploads["uploads"][1][:type].should eq("recorded_track") uploads["uploads"][2][:type].should eq("recorded_video") @@ -688,7 +688,7 @@ describe Recording do # Next page should have nothing: uploads = Recording.list_uploads(user2, 10, uploads["next"]) - uploads["uploads"].should have(0).items + uploads["uploads"].size.should == 0 end @@ -701,7 +701,7 @@ describe Recording do # We should have 2 items; a track and a quick mix: uploads = Recording.list_uploads(@user) - uploads["uploads"].should have(2).items + uploads["uploads"].size.should == 2 uploads["uploads"][0][:type].should eq("stream_mix") uploads["uploads"][1][:type].should eq("recorded_track") @@ -709,7 +709,7 @@ describe Recording do @recording.quick_mixes[0].save! uploads = Recording.list_uploads(@user) - uploads["uploads"].should have(1).items + uploads["uploads"].size.should == 1 uploads["uploads"][0][:type].should eq("recorded_track") @@ -717,7 +717,7 @@ describe Recording do @recording.recorded_tracks[0].save! uploads = Recording.list_uploads(@user) - uploads["uploads"].should have(0).items + uploads["uploads"].size.should == 0 end @@ -757,7 +757,7 @@ describe Recording do # and we should find it now... stale = Recording.discarded_and_stale - stale.first.readonly?.should be_false + stale.first.readonly?.should be false end end 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 2ff8a8fd2..719215ea9 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 @@ -163,27 +163,27 @@ describe RecurlyTransactionWebHook do it "successful payment" do document = Nokogiri::XML('') - RecurlyTransactionWebHook.is_transaction_web_hook?(document).should be_true + RecurlyTransactionWebHook.is_transaction_web_hook?(document).should be true end it "successful refund" do document = Nokogiri::XML('') - RecurlyTransactionWebHook.is_transaction_web_hook?(document).should be_true + RecurlyTransactionWebHook.is_transaction_web_hook?(document).should be true end it "failed payment" do document = Nokogiri::XML('') - RecurlyTransactionWebHook.is_transaction_web_hook?(document).should be_true + RecurlyTransactionWebHook.is_transaction_web_hook?(document).should be true end it "void" do document = Nokogiri::XML('') - RecurlyTransactionWebHook.is_transaction_web_hook?(document).should be_true + RecurlyTransactionWebHook.is_transaction_web_hook?(document).should be true end it "not a transaction web hook" do document = Nokogiri::XML('') - RecurlyTransactionWebHook.is_transaction_web_hook?(document).should be_false + RecurlyTransactionWebHook.is_transaction_web_hook?(document).should be false end end describe "create_from_xml" do @@ -197,7 +197,7 @@ describe RecurlyTransactionWebHook do document = Nokogiri::XML(success_xml) transaction = RecurlyTransactionWebHook.create_from_xml(document) - transaction.valid?.should be_true + transaction.valid?.should be true transaction.user.should eq(@user) transaction.transaction_type.should eq('payment') transaction.subscription_id.should eq('2de44484b460d95863799a431383b165') @@ -217,7 +217,7 @@ describe RecurlyTransactionWebHook do document = Nokogiri::XML(refund_xml) transaction = RecurlyTransactionWebHook.create_from_xml(document) - transaction.valid?.should be_true + transaction.valid?.should be true transaction.user.should eq(@user) transaction.transaction_type.should eq('refund') transaction.subscription_id.should eq('2da71ad97c826a7b784c264ac59c04de') @@ -238,7 +238,7 @@ describe RecurlyTransactionWebHook do document = Nokogiri::XML(void_xml) transaction = RecurlyTransactionWebHook.create_from_xml(document) - transaction.valid?.should be_true + transaction.valid?.should be true transaction.user.should eq(@user) transaction.transaction_type.should eq('void') transaction.subscription_id.should eq('2da71ad97c826a7b784c264ac59c04de') diff --git a/ruby/spec/jam_ruby/models/region_spec.rb b/ruby/spec/jam_ruby/models/region_spec.rb index 9bb6a7682..e6db2b7ef 100644 --- a/ruby/spec/jam_ruby/models/region_spec.rb +++ b/ruby/spec/jam_ruby/models/region_spec.rb @@ -36,7 +36,7 @@ describe Region do # verify we can swap out tables Region.after_maxmind_import - table_exists?('regions_copied').should be_false + table_exists?('regions_copied').should be false result = Region.connection.execute("SELECT * FROM regions") result.ntuples.should == 1 list_indexes('regions').should =~ [Region::COUNTRY_CODE_INDEX_NAME, Region::UNIQUE_INDEX_NAME] diff --git a/ruby/spec/jam_ruby/models/review_spec.rb b/ruby/spec/jam_ruby/models/review_spec.rb index e9603748f..d862aa763 100644 --- a/ruby/spec/jam_ruby/models/review_spec.rb +++ b/ruby/spec/jam_ruby/models/review_spec.rb @@ -17,47 +17,47 @@ describe Review do context "validates review" do it "blank target" do review = Review.create({}) - review.valid?.should be_false + review.valid?.should be false review.errors[:target].should == ["can't be blank"] end it "no rating" do review = Review.create(target:target) - review.valid?.should be_false + review.valid?.should be false review.errors[:rating].should include("can't be blank") review.errors[:rating].should include("is not a number") end it "no user" do review = Review.create(target:target, rating:3) - review.valid?.should be_false + review.valid?.should be false review.errors[:user_id].should include("can't be blank") end it "complete" do review = Review.create(target:target, rating:3, user:@user) - review.valid?.should be_true + review.valid?.should be true end it "unique" do review = Review.create(target:target, rating:3, user:@user) - review.valid?.should be_true + review.valid?.should be true review2 = Review.create(target:target, rating:3, user:@user) - review2.valid?.should be_false + review2.valid?.should be false end it "reduces" do review = Review.create(target:target, rating:3, user:@user) - review.valid?.should be_true + review.valid?.should be true 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 + review2.valid?.should be true + Review.count.should == 2 + Review.index.size.should == 2 # Reduce and check: - ReviewSummary.should have(1).items + ReviewSummary.count.should == 1 ReviewSummary.first.avg_rating.should eq(4.0) ws_orig = ReviewSummary.first.wilson_score @@ -65,8 +65,8 @@ describe Review do # Create some more and verify: 5.times {Review.create(target:target, rating:5, user:FactoryBot.create(:user))} - Review.index.should have(7).items - ReviewSummary.should have(1).items + Review.index.size.should == 7 + ReviewSummary.count.should == 1 ReviewSummary.first.wilson_score.should > ws_orig ReviewSummary.first.avg_rating.should > avg_orig @@ -77,13 +77,13 @@ describe Review do context "validates review summary" do it "blank target" do review_summary = ReviewSummary.create() - review_summary.valid?.should be_false + review_summary.valid?.should be false review_summary.errors[:target_id].should == ["can't be blank"] end it "no rating" do review_summary = ReviewSummary.create(target:target) - review_summary.valid?.should be_false + review_summary.valid?.should be false review_summary.errors[:target].should be_empty review_summary.errors[:avg_rating].should include("can't be blank") review_summary.errors[:avg_rating].should include("is not a number") @@ -91,7 +91,7 @@ describe Review do it "no score" do review_summary = ReviewSummary.create(target:target, avg_rating:3.2) - review_summary.valid?.should be_false + review_summary.valid?.should be false review_summary.errors[:target].should be_empty review_summary.errors[:avg_rating].should be_empty review_summary.errors[:wilson_score].should include("can't be blank") @@ -100,31 +100,31 @@ describe Review do it "no count" do review_summary = ReviewSummary.create(target:target, avg_rating:3.2, wilson_score:0.95) - review_summary.valid?.should be_false + review_summary.valid?.should be false review_summary.errors[:review_count].should include("can't be blank") end it "complete" do review_summary = ReviewSummary.create(target:target, avg_rating:3.2, wilson_score:0.95, review_count: 15) - review_summary.valid?.should be_true + review_summary.valid?.should be true end it "unique" do review = ReviewSummary.create(target:target, avg_rating:3, wilson_score:0.82, review_count:14) - review.valid?.should be_true + review.valid?.should be true review2 = ReviewSummary.create(target:target, avg_rating:3.22, wilson_score:0.91, review_count:12) - review2.valid?.should be_false + review2.valid?.should be false end it "reduces and queries" do review = Review.create(target:target, rating:3, user:@user) - review.valid?.should be_true + review.valid?.should be true review2 = Review.create(target:target, rating:5, user:FactoryBot.create(:user)) - review2.valid?.should be_true - Review.should have(2).items + review2.valid?.should be true + Review.count.should == 2 - ReviewSummary.should have(1).items + ReviewSummary.count.should == 1 ReviewSummary.first.avg_rating.should eq(4.0) ws_orig = ReviewSummary.first.wilson_score @@ -133,7 +133,7 @@ describe Review do # Create some more and verify: 5.times {Review.create(target:target, rating:5, user:FactoryBot.create(:user))} - ReviewSummary.should have(1).items + ReviewSummary.count.should == 1 ReviewSummary.first.wilson_score.should > ws_orig ReviewSummary.first.avg_rating.should > avg_orig @@ -141,21 +141,21 @@ describe Review do # Create some more with a different target and verify: 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 + Review.index.size.should == 12 + Review.index(target_id: target2).size.should == 5 summaries = ReviewSummary.index() - summaries.should have(2).items + summaries.size.should == 2 summaries[0].wilson_score.should > summaries[1].wilson_score summaries = ReviewSummary.index(target_id: target2) - summaries.should have(1).items + summaries.size.should == 1 summaries[0].target_id.should eq(target2.id) summaries = ReviewSummary.index(target_type: "JamRuby::JamTrack") - summaries.should have(2).items + summaries.size.should == 2 summaries = ReviewSummary.index(minimum_reviews: 6) - summaries.should have(1).items + summaries.size.should == 1 end end end diff --git a/ruby/spec/jam_ruby/models/rsvp_request_spec.rb b/ruby/spec/jam_ruby/models/rsvp_request_spec.rb index 6aa109beb..1a8b907f8 100644 --- a/ruby/spec/jam_ruby/models/rsvp_request_spec.rb +++ b/ruby/spec/jam_ruby/models/rsvp_request_spec.rb @@ -137,7 +137,7 @@ describe RsvpRequest do rsvp_request = RsvpRequest.create({:session_id => @music_session.id, :rsvp_slots => ['unstructured']}, @non_session_invitee) rsvp_request.rsvp_slots.length.should == 1 - rsvp_request.rsvp_slots[0].is_unstructured_rsvp.should be_true + rsvp_request.rsvp_slots[0].is_unstructured_rsvp.should be true rsvp_request.rsvp_slots[0].proficiency_level.should be_nil rsvp_request.rsvp_slots[0].instrument.should be_nil end diff --git a/ruby/spec/jam_ruby/models/rsvp_slot_spec.rb b/ruby/spec/jam_ruby/models/rsvp_slot_spec.rb index 526bd4b52..43d30729e 100644 --- a/ruby/spec/jam_ruby/models/rsvp_slot_spec.rb +++ b/ruby/spec/jam_ruby/models/rsvp_slot_spec.rb @@ -73,13 +73,13 @@ describe RsvpSlot do describe "validators" do it "require instrument if not unstructured" do rsvp_slot = FactoryBot.build(:rsvp_slot, instrument: nil) - rsvp_slot.valid?.should be_false + 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 = FactoryBot.build(:rsvp_slot, is_unstructured_rsvp: true, instrument: nil) - rsvp_slot.valid?.should be_true + rsvp_slot.valid?.should be true end end end \ No newline at end of file diff --git a/ruby/spec/jam_ruby/models/sale_spec.rb b/ruby/spec/jam_ruby/models/sale_spec.rb index 7fd52ca8a..1103eeed8 100644 --- a/ruby/spec/jam_ruby/models/sale_spec.rb +++ b/ruby/spec/jam_ruby/models/sale_spec.rb @@ -181,7 +181,7 @@ describe Sale do recurly_account = client.get_account(user) adjustments = recurly_account.adjustments adjustments.should_not be_nil - adjustments.should have(1).items + adjustments.size.should == 1 purchase= adjustments[0] purchase.unit_amount_in_cents.should eq((gift_card.price * 100).to_i) purchase.accounting_code.should eq(ShoppingCart::PURCHASE_NORMAL) @@ -191,10 +191,10 @@ describe Sale do sleep 2 invoices = recurly_account.invoices - invoices.should have(1).items + invoices.size.should == 1 invoice = invoices[0] invoice.uuid.should eq(sale.recurly_invoice_id) - invoice.line_items.should have(1).items # should have single adjustment associated + invoice.line_items.size.should == 1 # should have single adjustment associated invoice.line_items[0].should eq(purchase) invoice.subtotal_in_cents.should eq((gift_card.price * 100).to_i) invoice.total_in_cents.should eq((gift_card.price * 100).to_i) @@ -202,9 +202,9 @@ describe Sale do # verify jam_track_rights data user.gift_card_purchases.should_not be_nil - user.gift_card_purchases.should have(1).items + user.gift_card_purchases.size.should == 1 user.gift_card_purchases.last.gift_card_type.should eq(GiftCardType.jam_track_5) - user.has_redeemable_jamtrack.should be_true + user.has_redeemable_jamtrack.should be true sale_line_item.affiliate_referral.should be_nil sale_line_item.affiliate_referral_fee_in_cents.should be_nil @@ -254,18 +254,18 @@ describe Sale do recurly_account = client.get_account(user) adjustments = recurly_account.adjustments adjustments.should_not be_nil - adjustments.should have(0).items + adjustments.size.should == 0 invoices = recurly_account.invoices - invoices.should have(0).items + invoices.size.should == 0 # verify jam_track_rights data user.jam_track_rights.should_not be_nil - user.jam_track_rights.should have(1).items + user.jam_track_rights.size.should == 1 user.jam_track_rights.last.jam_track.id.should eq(jamtrack.id) - user.jam_track_rights.last.redeemed.should be_true - user.has_redeemable_jamtrack.should be_false + user.jam_track_rights.last.redeemed.should be true + user.has_redeemable_jamtrack.should be false end it "for two jamtracks 1 freebie, 1 purchased" do @@ -303,11 +303,11 @@ describe Sale do # verify jam_track_rights data right1 = JamTrackRight.where(user_id: user.id).where(jam_track_id: jamtrack.id).first right2 = JamTrackRight.where(user_id: user.id).where(jam_track_id: jamtrack2.id).first - user.jam_track_rights.should have(2).items + user.jam_track_rights.size.should == 2 - right1.redeemed.should be_false - right2.redeemed.should be_true - user.has_redeemable_jamtrack.should be_false + right1.redeemed.should be false + right2.redeemed.should be true + user.has_redeemable_jamtrack.should be false user.gifted_jamtracks.should eq(2) end @@ -343,11 +343,11 @@ describe Sale do # verify jam_track_rights data right1 = JamTrackRight.where(user_id: user.id).where(jam_track_id: jamtrack.id).first right2 = JamTrackRight.where(user_id: user.id).where(jam_track_id: jamtrack2.id).first - user.jam_track_rights.should have(2).items + user.jam_track_rights.size.should == 2 - right1.redeemed.should be_true - right2.redeemed.should be_true - user.has_redeemable_jamtrack.should be_false + right1.redeemed.should be true + right2.redeemed.should be true + user.has_redeemable_jamtrack.should be false user.gifted_jamtracks.should eq(1) @@ -422,18 +422,18 @@ describe Sale do recurly_account = client.get_account(user) adjustments = recurly_account.adjustments adjustments.should_not be_nil - adjustments.should have(0).items + adjustments.size.should == 0 invoices = recurly_account.invoices - invoices.should have(0).items + invoices.size.should == 0 # verify jam_track_rights data user.jam_track_rights.should_not be_nil - user.jam_track_rights.should have(1).items + user.jam_track_rights.size.should == 1 user.jam_track_rights.last.jam_track.id.should eq(jamtrack.id) - user.jam_track_rights.last.redeemed.should be_true - user.has_redeemable_jamtrack.should be_false + user.jam_track_rights.last.redeemed.should be true + user.has_redeemable_jamtrack.should be false end @@ -485,7 +485,7 @@ describe Sale do recurly_account = client.get_account(user) adjustments = recurly_account.adjustments adjustments.should_not be_nil - adjustments.should have(1).items + adjustments.size.should == 1 purchase= adjustments[0] purchase.unit_amount_in_cents.should eq((jamtrack.price * 100).to_i) purchase.accounting_code.should eq(ShoppingCart::PURCHASE_NORMAL) @@ -495,10 +495,10 @@ describe Sale do sleep 2 invoices = recurly_account.invoices - invoices.should have(1).items + invoices.size.should == 1 invoice = invoices[0] invoice.uuid.should eq(sale.recurly_invoice_id) - invoice.line_items.should have(1).items # should have single adjustment associated + invoice.line_items.size.should == 1 # should have single adjustment associated invoice.line_items[0].should eq(purchase) invoice.subtotal_in_cents.should eq((jamtrack.price * 100).to_i) invoice.total_in_cents.should eq((jamtrack.price * 100).to_i) @@ -506,10 +506,10 @@ describe Sale do # verify jam_track_rights data user.jam_track_rights.should_not be_nil - user.jam_track_rights.should have(1).items + user.jam_track_rights.size.should == 1 user.jam_track_rights.last.jam_track.id.should eq(jamtrack.id) - user.jam_track_rights.last.redeemed.should be_false - user.has_redeemable_jamtrack.should be_false + user.jam_track_rights.last.redeemed.should be false + user.has_redeemable_jamtrack.should be false sale_line_item.affiliate_referral.should be_nil sale_line_item.affiliate_referral_fee_in_cents.should be_nil @@ -565,7 +565,7 @@ describe Sale do recurly_account = client.get_account(user) adjustments = recurly_account.adjustments adjustments.should_not be_nil - adjustments.should have(1).items + adjustments.size.should == 1 purchase= adjustments[0] purchase.unit_amount_in_cents.should eq((jamtrack.price * 100).to_i) purchase.accounting_code.should eq(ShoppingCart::PURCHASE_NORMAL) @@ -575,10 +575,10 @@ describe Sale do sleep 2 invoices = recurly_account.invoices - invoices.should have(1).items + invoices.size.should == 1 invoice = invoices[0] invoice.uuid.should eq(sale.recurly_invoice_id) - invoice.line_items.should have(1).items # should have single adjustment associated + invoice.line_items.size.should == 1 # should have single adjustment associated invoice.line_items[0].should eq(purchase) invoice.subtotal_in_cents.should eq((jamtrack.price * 100).to_i) invoice.total_in_cents.should eq((jamtrack.price * 100).to_i) @@ -586,10 +586,10 @@ describe Sale do # verify jam_track_rights data user.jam_track_rights.should_not be_nil - user.jam_track_rights.should have(1).items + user.jam_track_rights.size.should == 1 user.jam_track_rights.last.jam_track.id.should eq(jamtrack.id) - user.jam_track_rights.last.redeemed.should be_false - user.has_redeemable_jamtrack.should be_false + user.jam_track_rights.last.redeemed.should be false + user.has_redeemable_jamtrack.should be false end it "for a jamtrack already owned" do @@ -603,11 +603,11 @@ describe Sale do shopping_cart = ShoppingCart.create user, jamtrack, 1, false sales = Sale.place_order(user, [shopping_cart]) - sales.should have(0).items + sales.size.should == 0 # also, verify that no earlier adjustments were affected recurly_account = client.get_account(user) adjustments = recurly_account.adjustments - adjustments.should have(0).items # because the only successful purchase was a freebie, there should be no recurly adjustments + adjustments.size.should == 0 # because the only successful purchase was a freebie, there should be no recurly adjustments end # this test counts on the fact that two adjustments are made when buying a free JamTrack @@ -627,10 +627,10 @@ describe Sale do expect { Sale.place_order(user, [shopping_cart]) }.to raise_error(JamRuby::RecurlyClientError) user.reload - user.sales.should have(0).items + user.sales.size.should == 0 recurly_account = client.get_account(user) - recurly_account.adjustments.should have(0).items + recurly_account.adjustments.size.should == 0 end it "rolls back adjustments created before the order" do @@ -642,7 +642,7 @@ describe Sale do recurly_account = client.get_account(user) adjustment = recurly_account.adjustments.new (adjustment_attrs[0]) adjustment.save - adjustment.errors.any?.should be_false + adjustment.errors.any?.should be false sales = Sale.place_order(user, [shopping_cart]) @@ -650,7 +650,7 @@ describe Sale do recurly_account = client.get_account(user) adjustments = recurly_account.adjustments - adjustments.should have(1).items # two adjustments are created for a free jamtrack; that should be all there is + adjustments.size.should == 1 # two adjustments are created for a free jamtrack; that should be all there is end end @@ -804,16 +804,16 @@ describe Sale do booking = LessonBooking.book_test_drive(user, teacher_user, valid_single_slots, "Hey I've heard of you before.") - booking.errors.any?.should be_false + booking.errors.any?.should be false booking.user.should eql user - booking.card_presumed_ok.should be_false + booking.card_presumed_ok.should be false booking.should eql user.unprocessed_test_drive token = create_stripe_token result = user.payment_update({token: token, zip: '72205', test_drive: true, booking_id: booking.id}) booking.reload - booking.card_presumed_ok.should be_true + booking.card_presumed_ok.should be true user.sales.count.should eql 1 sale = result[:test_drive] @@ -849,9 +849,9 @@ describe Sale do #user.remaining_test_drives = 0 #user.save! booking = LessonBooking.book_test_drive(user, teacher_user, valid_single_slots, "Hey I've heard of you before.") - booking.errors.any?.should be_false + booking.errors.any?.should be false booking.user.should eql user - booking.card_presumed_ok.should be_false + booking.card_presumed_ok.should be false booking.should eql user.unprocessed_test_drive user.reload user.remaining_test_drives.should eql 0 @@ -860,7 +860,7 @@ describe Sale do result = user.payment_update({token: token, zip: '78759', test_drive: true, booking_id: booking.id}) booking.reload - booking.card_presumed_ok.should be_true + booking.card_presumed_ok.should be true user.sales.count.should eql 1 sale = result[:test_drive] @@ -900,9 +900,9 @@ describe Sale do token = create_stripe_token result = user.payment_update({token: token, zip: '78759', test_drive: true}) - user.errors.any?.should be_false + user.errors.any?.should be false user.reload - user.has_stored_credit_card?.should be_true + user.has_stored_credit_card?.should be true user.sales.count.should eql 1 sale = result[:test_drive] @@ -923,22 +923,22 @@ describe Sale do intent = TeacherIntent.create(user, teacher, 'book-test-drive') token = create_stripe_token result = user.payment_update({token: token, zip: '78759', test_drive: true}) - user.errors.any?.should be_false + user.errors.any?.should be false user.reload - user.has_stored_credit_card?.should be_true + user.has_stored_credit_card?.should be true user.sales.count.should eql 1 SaleLineItem.count.should eql 1 Sale.count.should eql 1 purchase = result[:purchase] - purchase.errors.any?.should be_false + purchase.errors.any?.should be false result = user.payment_update({token: token, zip: '78759', test_drive: true}) - user.errors.any?.should be_false + user.errors.any?.should be false user.reload - user.has_stored_credit_card?.should be_true + user.has_stored_credit_card?.should be true user.sales.count.should eql 1 purchase = result[:purchase] - purchase.errors.any?.should be_true + purchase.errors.any?.should be true purchase.errors[:user].should eq ["can not buy test drive right now because you have already purchased it within the last year"] SaleLineItem.count.should eql 1 Sale.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 986e9fad4..f5b4b898c 100644 --- a/ruby/spec/jam_ruby/models/school_spec.rb +++ b/ruby/spec/jam_ruby/models/school_spec.rb @@ -25,6 +25,6 @@ describe School do it "updates" do school = FactoryBot.create(:school) school.update_from_params({name: 'hahah', scheduling_communication: 'school', correspondence_email: 'bobby@jamkazam.com'}) - school.errors.any?.should be_false + school.errors.any?.should be false end end \ No newline at end of file diff --git a/ruby/spec/jam_ruby/models/score_spec.rb b/ruby/spec/jam_ruby/models/score_spec.rb index 9907f45d8..efdbe02e2 100644 --- a/ruby/spec/jam_ruby/models/score_spec.rb +++ b/ruby/spec/jam_ruby/models/score_spec.rb @@ -495,14 +495,14 @@ describe Score do end end - user_1_2.should be_true - user_1_4.should be_true - user_2_1.should be_true - user_2_3.should be_true - user_3_2.should be_true - user_3_4.should be_true - user_4_1.should be_true - user_4_3.should be_true + user_1_2.should be true + user_1_4.should be true + user_2_1.should be true + user_2_3.should be true + user_3_2.should be true + user_3_4.should be true + user_4_1.should be true + user_4_3.should be true end end diff --git a/ruby/spec/jam_ruby/models/shopping_cart_spec.rb b/ruby/spec/jam_ruby/models/shopping_cart_spec.rb index a3abcbf75..2652fb6ea 100644 --- a/ruby/spec/jam_ruby/models/shopping_cart_spec.rb +++ b/ruby/spec/jam_ruby/models/shopping_cart_spec.rb @@ -20,8 +20,8 @@ describe ShoppingCart do it "can reference a shopping cart" do shopping_cart = ShoppingCart.create user, jam_track, 1 - shopping_cart.errors.any?.should be_false - shopping_cart.valid?.should be_true + shopping_cart.errors.any?.should be false + shopping_cart.valid?.should be true user.reload ShoppingCart.count.should == 1 user.shopping_carts.count.should == 1 @@ -34,18 +34,18 @@ describe ShoppingCart do it "allows mix of free and not free stuff" do cart1 = ShoppingCart.add_jam_track_to_cart(user, jam_track) cart1.should_not be_nil - cart1.errors.any?.should be_false + cart1.errors.any?.should be false user.reload cart2 = ShoppingCart.add_jam_track_to_cart(user, jam_track) - cart2.errors.any?.should be_false + cart2.errors.any?.should be false user.reload user.shopping_carts.length.should eq(1) cart3 = ShoppingCart.add_item_to_cart(user, gift_card) - cart3.errors.any?.should be_false + cart3.errors.any?.should be false user.reload user.shopping_carts.length.should eq(2) cart4 = ShoppingCart.add_jam_track_to_cart(user, jam_track2) - cart4.errors.any?.should be_false + cart4.errors.any?.should be false user.reload user.shopping_carts.length.should eq(3) end @@ -55,10 +55,10 @@ describe ShoppingCart do user.save! cart1 = ShoppingCart.add_jam_track_to_cart(user, jam_track) cart1.should_not be_nil - cart1.errors.any?.should be_false + cart1.errors.any?.should be false user.reload cart2 = ShoppingCart.add_jam_track_to_cart(user, jam_track) - cart2.errors.any?.should be_true + cart2.errors.any?.should be true end it "a second giftcard just adds quantity" do @@ -69,15 +69,15 @@ describe ShoppingCart do it "removes redeemable item to shopping cart (maintains only one in cart)" do - user.has_redeemable_jamtrack.should be_true + user.has_redeemable_jamtrack.should be true cart1 = ShoppingCart.add_jam_track_to_cart(user, jam_track) cart1.should_not be_nil - cart1.errors.any?.should be_false + cart1.errors.any?.should be false cart1.marked_for_redeem.should eq(1) user.reload cart2 = ShoppingCart.add_jam_track_to_cart(user, jam_track2) cart2.should_not be_nil - cart2.errors.any?.should be_false + cart2.errors.any?.should be false cart2.marked_for_redeem.should eq(1) ShoppingCart.find_by_id(cart1.id).should be nil @@ -101,18 +101,18 @@ describe ShoppingCart do it "user can add and remove jamtracks without issue, until 'mixed' free/non-free is hit" do cart1 = ShoppingCart.add_jam_track_to_cart(user, jam_track) cart1.should_not be_nil - cart1.errors.any?.should be_false + cart1.errors.any?.should be false user.reload cart2 = ShoppingCart.add_jam_track_to_cart(user, jam_track2) - cart2.errors.any?.should be_false + cart2.errors.any?.should be false user.reload user.shopping_carts.length.should eq(2) cart1.marked_for_redeem.should eq(1) cart2.marked_for_redeem.should eq(1) cart3 = ShoppingCart.add_jam_track_to_cart(user, jam_track3) - cart3.errors.any?.should be_false + cart3.errors.any?.should be false user.reload user.shopping_carts.length.should eq(3) cart1.marked_for_redeem.should eq(1) @@ -120,7 +120,7 @@ describe ShoppingCart do cart3.marked_for_redeem.should eq(1) cart4 = ShoppingCart.add_jam_track_to_cart(user, jam_track4) - cart4.errors.any?.should be_false + cart4.errors.any?.should be false user.reload user.shopping_carts.length.should eq(4) cart1.marked_for_redeem.should eq(1) @@ -129,7 +129,7 @@ describe ShoppingCart do cart4.marked_for_redeem.should eq(1) cart5 = ShoppingCart.add_jam_track_to_cart(user, jam_track5) - cart5.errors.any?.should be_false + cart5.errors.any?.should be false user.reload user.shopping_carts.length.should eq(5) cart1.marked_for_redeem.should eq(1) @@ -139,7 +139,7 @@ describe ShoppingCart do cart5.marked_for_redeem.should eq(1) cart6 = ShoppingCart.add_jam_track_to_cart(user, jam_track6) - cart6.errors.any?.should be_false + cart6.errors.any?.should be false user.reload user.shopping_carts.length.should eq(6) cart1.marked_for_redeem.should eq(1) @@ -150,7 +150,7 @@ describe ShoppingCart do cart6.marked_for_redeem.should eq(1) cart7 = ShoppingCart.add_jam_track_to_cart(user, jam_track7) - cart7.errors.any?.should be_false + cart7.errors.any?.should be false user.reload user.shopping_carts.length.should eq(7) cart1.marked_for_redeem.should eq(1) @@ -166,7 +166,7 @@ describe ShoppingCart do it "can not add multiple of same type" do cart1 = ShoppingCart.add_item_to_cart(user, gift_card) cart1.should_not be_nil - cart1.errors.any?.should be_false + cart1.errors.any?.should be false user.reload user.has_redeemable_jamtrack = true @@ -176,7 +176,7 @@ describe ShoppingCart do cart2 = ShoppingCart.add_item_to_cart(user, gift_card) cart2.should_not be_nil # it's the same type, so it's blocked - cart2.errors.any?.should be_true + cart2.errors.any?.should be true cart2.errors[:cart_id].should eq(["has already been taken"]) end end @@ -192,11 +192,11 @@ describe ShoppingCart do cart1 = ShoppingCart.add_jam_track_to_cart(user, jam_track) cart1.should_not be_nil - cart1.errors.any?.should be_false + cart1.errors.any?.should be false user.reload cart2 = ShoppingCart.add_jam_track_to_cart(user, jam_track2) - cart2.errors.any?.should be_false + cart2.errors.any?.should be false #cart2.errors[:base].should eq(["You can not add a free JamTrack to a cart with non-free items. Please clear out your cart."]) user.reload @@ -209,12 +209,12 @@ describe ShoppingCart do jam_track2.save! cart1 = ShoppingCart.add_jam_track_to_cart(user, jam_track) cart1.should_not be_nil - cart1.errors.any?.should be_false + cart1.errors.any?.should be false user.reload cart2 = ShoppingCart.add_jam_track_to_cart(user, jam_track2) - cart2.errors.any?.should be_false + cart2.errors.any?.should be false #cart2.errors[:base].should eq(["You can not add a non-free JamTrack to a cart containing free items. Please clear out your cart."]) user.reload diff --git a/ruby/spec/jam_ruby/models/signup_hint_spec.rb b/ruby/spec/jam_ruby/models/signup_hint_spec.rb index fc17d2e03..6e47b5fd6 100644 --- a/ruby/spec/jam_ruby/models/signup_hint_spec.rb +++ b/ruby/spec/jam_ruby/models/signup_hint_spec.rb @@ -7,18 +7,18 @@ describe SignupHint do describe "refresh_by_anoymous_user" do it "creates" do hint = SignupHint.refresh_by_anoymous_user(user, {redirect_location: 'abc'}) - hint.errors.any?.should be_false + hint.errors.any?.should be false hint.redirect_location.should eq('abc') - hint.want_jamblaster.should be_false + hint.want_jamblaster.should be false end it "updated" do SignupHint.refresh_by_anoymous_user(user, {redirect_location: 'abc'}) hint = SignupHint.refresh_by_anoymous_user(user, {redirect_location: nil, want_jamblaster: true}) - hint.errors.any?.should be_false + hint.errors.any?.should be false hint.redirect_location.should be_nil - hint.want_jamblaster.should be_true + hint.want_jamblaster.should be true end end end diff --git a/ruby/spec/jam_ruby/models/teacher_payment_spec.rb b/ruby/spec/jam_ruby/models/teacher_payment_spec.rb index fce128c45..66445c377 100644 --- a/ruby/spec/jam_ruby/models/teacher_payment_spec.rb +++ b/ruby/spec/jam_ruby/models/teacher_payment_spec.rb @@ -48,7 +48,7 @@ describe TeacherPayment do test_drive_distribution.ready = true test_drive_distribution.save! - test_drive_distribution.distributed.should be_false + test_drive_distribution.distributed.should be false payments = TeacherPayment.pending_teacher_payments payments.count.should eql 1 @@ -372,7 +372,7 @@ describe TeacherPayment do TeacherPayment.count.should eql 1 payment = TeacherPayment.first - payment.teacher_payment_charge.billed.should be_false + payment.teacher_payment_charge.billed.should be false # advance one day so that a charge is attempted again Timecop.freeze(Date.today + 2) diff --git a/ruby/spec/jam_ruby/models/teacher_spec.rb b/ruby/spec/jam_ruby/models/teacher_spec.rb index e1665b112..99011dd7f 100644 --- a/ruby/spec/jam_ruby/models/teacher_spec.rb +++ b/ruby/spec/jam_ruby/models/teacher_spec.rb @@ -73,7 +73,7 @@ describe Teacher do teacher3.user.email = 'phantom+dogpound@jamkazam.com' teacher3.user.save! teacher3.user.reload - teacher3.user.phantom.should be_true + teacher3.user.phantom.should be true query = Teacher.index(nil, {})[:query] query.count.should eql 0 @@ -277,7 +277,7 @@ describe Teacher do teacher.user = user teacher.biography = BIO teacher.introductory_video = GOOD_YOUTUBE_URL - teacher.save.should be_true + teacher.save.should be true t = Teacher.find(teacher.id) t.biography.should == BIO t.introductory_video.should == GOOD_YOUTUBE_URL @@ -289,9 +289,9 @@ describe Teacher do teacher.save teacher.instruments << instrument1 teacher.instruments << instrument2 - teacher.save.should be_true + teacher.save.should be true t = Teacher.find(teacher.id) - t.instruments.should have(2).items + t.instruments.size.should == 2 end end @@ -337,22 +337,22 @@ describe Teacher do t = Teacher.find(teacher.id) # Instruments - t.instruments.should have(2).items + t.instruments.size.should == 2 # Genres - t.genres.should have(2).items + t.genres.size.should == 2 # Subjects - t.subjects.should have(2).items + t.subjects.size.should == 2 # Languages - t.languages.should have(2).items + t.languages.size.should == 2 t.teaches_age_lower.should == 10 t.teaches_age_upper.should == 20 - t.teaches_beginner.should be_true - t.teaches_intermediate.should be_false - t.teaches_advanced.should be_true + t.teaches_beginner.should be true + t.teaches_intermediate.should be false + t.teaches_advanced.should be true end @@ -374,10 +374,10 @@ describe Teacher do t.should_not be_nil - t.teacher_experiences.should have(1).items - t.experiences_teaching.should have(1).items - t.experiences_education.should have(0).items - t.experiences_award.should have(0).items + t.teacher_experiences.size.should == 1 + t.experiences_teaching.size.should == 1 + t.experiences_education.size.should == 0 + t.experiences_award.size.should == 0 # Save some awards and re-check teacher object: teacher = Teacher.save_teacher(user, experiences_award: experience) @@ -386,10 +386,10 @@ describe Teacher do t.reload - t.teacher_experiences.should have(2).items - t.experiences_teaching.should have(1).items - t.experiences_education.should have(0).items - t.experiences_award.should have(1).items + t.teacher_experiences.size.should == 2 + t.experiences_teaching.size.should == 1 + t.experiences_education.size.should == 0 + t.experiences_award.size.should == 1 end @@ -421,13 +421,13 @@ describe Teacher do teacher.errors.should be_empty t = Teacher.find(teacher.id) - t.prices_per_lesson.should be_true - t.prices_per_month.should be_true - t.lesson_duration_30.should be_true - t.lesson_duration_45.should be_true - t.lesson_duration_60.should be_true - t.lesson_duration_90.should be_true - t.lesson_duration_120.should be_true + t.prices_per_lesson.should be true + t.prices_per_month.should be true + t.lesson_duration_30.should be true + t.lesson_duration_45.should be true + t.lesson_duration_60.should be true + t.lesson_duration_90.should be true + t.lesson_duration_120.should be true t.price_per_lesson_30_cents.should == 3000 t.price_per_lesson_45_cents.should == 3000 t.price_per_lesson_60_cents.should == 3000 diff --git a/ruby/spec/jam_ruby/models/track_spec.rb b/ruby/spec/jam_ruby/models/track_spec.rb index 0cc4d2237..5a094b933 100644 --- a/ruby/spec/jam_ruby/models/track_spec.rb +++ b/ruby/spec/jam_ruby/models/track_spec.rb @@ -177,7 +177,7 @@ describe Track do it "sets metronome_open to true" do result = Track.sync(connection.client_id, [track_hash], [], true) connection.reload - connection.metronome_open.should be_true + connection.metronome_open.should be true end it "sets metronome_open to false" do @@ -185,7 +185,7 @@ describe Track do connection.save! result = Track.sync(connection.client_id, [track_hash], [], false) connection.reload - connection.metronome_open.should be_false + connection.metronome_open.should be false end end end diff --git a/ruby/spec/jam_ruby/models/user_asset_spec.rb b/ruby/spec/jam_ruby/models/user_asset_spec.rb index da8607ac0..22e59f1b8 100644 --- a/ruby/spec/jam_ruby/models/user_asset_spec.rb +++ b/ruby/spec/jam_ruby/models/user_asset_spec.rb @@ -22,7 +22,7 @@ describe UserAsset do expect(user_asset.valid?).to be(false) end - it "sets uri in this format", focus: true do + it "sets uri in this format" do expect(user_asset.uri).to match(/\/user_assets\/image\/\d{4}-\d{2}-\d{2}\/my_image-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}.jpg/) end end \ No newline at end of file diff --git a/ruby/spec/jam_ruby/models/user_location_spec.rb b/ruby/spec/jam_ruby/models/user_location_spec.rb index cd4de39f3..20712a4be 100644 --- a/ruby/spec/jam_ruby/models/user_location_spec.rb +++ b/ruby/spec/jam_ruby/models/user_location_spec.rb @@ -29,7 +29,7 @@ X If no profile location is provided, and the user creates/joins a music session it "should have updated lat/lng values" do pending 'distance search changes' - @user.update_attributes({ :city => @geocode2.city, + @user.update({ :city => @geocode2.city, :state => @geocode2.region, :country => @geocode2.country, }) @@ -42,7 +42,7 @@ X If no profile location is provided, and the user creates/joins a music session describe "without profile location data" do it "should have lat/lng values from ip_address" do pending 'distance search changes' - @user.update_attributes({ :city => nil, + @user.update({ :city => nil, :state => nil, :country => nil, }) diff --git a/ruby/spec/jam_ruby/models/user_spec.rb b/ruby/spec/jam_ruby/models/user_spec.rb index d3f1a9d0d..32f19ac9d 100644 --- a/ruby/spec/jam_ruby/models/user_spec.rb +++ b/ruby/spec/jam_ruby/models/user_spec.rb @@ -78,7 +78,7 @@ describe User do @user.last_jam_audio_latency = 5 @user.save! stats = User.stats - @user.musician.should be_true + @user.musician.should be true stats['musicians'].should == 1 stats['fans'].should == 0 stats['downloaded_client'].should == 0 @@ -281,7 +281,7 @@ describe User do describe "set_password" do before do @user.confirm_email! - @user.save.should be_true + @user.save.should be true UserMailer.deliveries.clear end @@ -293,21 +293,21 @@ describe User do it "setting a new password should fail if old one doesnt match" do @user.set_password("wrongold", "newpassword", "newpassword") - @user.errors.any?.should be_true + @user.errors.any?.should be true @user.errors[:current_password].length.should == 1 UserMailer.deliveries.length.should == 0 end it "setting a new password should fail if new ones dont match" do @user.set_password("foobar", "newpassword", "newpassword2") - @user.errors.any?.should be_true + @user.errors.any?.should be true @user.errors[:password_confirmation].length.should == 1 UserMailer.deliveries.length.should == 0 end it "setting a new password should fail if new one doesnt validate" do @user.set_password("foobar", "a", "a") - @user.errors.any?.should be_true + @user.errors.any?.should be true # too short @user.errors[:password].length.should == 1 UserMailer.deliveries.length.should == 0 @@ -315,7 +315,7 @@ describe User do it "setting a new password should fail if the new one is null" do @user.set_password("foobar", nil, nil) - @user.errors.any?.should be_true + @user.errors.any?.should be true @user.errors[:password_confirmation].length.should == 1 UserMailer.deliveries.length.should == 0 end @@ -361,14 +361,14 @@ describe User do let(:found_user) { User.find_by_email(@user.email) } describe "with valid password" do - it { found_user.valid_password?(@user.password).should be_true } + it { found_user.valid_password?(@user.password).should be true } end describe "with invalid password" do let(:user_for_invalid_password) { found_user.valid_password?("invalid") } it { should_not == user_for_invalid_password } - specify { user_for_invalid_password.should be_false } + specify { user_for_invalid_password.should be false } end end @@ -380,7 +380,7 @@ describe User do describe "user progression only touches once" do it "allows first touch" do @user.update_progression_field (:first_downloaded_client_at) - @user.errors.any?.should be_false + @user.errors.any?.should be false @user.first_downloaded_client_at.should_not be_nil end @@ -389,7 +389,7 @@ describe User do @user.update_progression_field(:first_downloaded_client_at, time) first_value = @user.first_downloaded_client_at @user.update_progression_field(:first_downloaded_client_at) - @user.errors.any?.should be_false + @user.errors.any?.should be false @user.first_downloaded_client_at.should == first_value end end @@ -454,7 +454,7 @@ describe User do end # useful to see contents of email without actually running the app and sending it - it { @user.errors.any?.should be_false } + it { @user.errors.any?.should be false } it { @user.update_email.should == "somenewemail@blah.com" } it { @user.update_email_confirmation_url.should == "http://www.jamkazam.com/confirm_email_update?token=#{@user.update_email_token}" } it { UserMailer.deliveries.length.should == 1 } @@ -588,7 +588,7 @@ describe User do token: '1', token_expiration: Time.now, user: @user2 - @user2.save.should be_false + @user2.save.should be false @user2.errors[:user_authorizations].should == ['is invalid'] end @@ -610,25 +610,25 @@ describe User do it "prevent negative" do @user.last_jam_audio_latency = -1 - @user.save.should be_false + @user.save.should be false @user.errors[:last_jam_audio_latency].should == ['must be greater than 2'] end it "prevent non numerical" do @user.last_jam_audio_latency = 'a' - @user.save.should be_false + @user.save.should be false @user.errors[:last_jam_audio_latency].should == ['is not a number'] end it "prevent 2 (minimum)" do @user.last_jam_audio_latency = User::MINIMUM_AUDIO_LATENCY - @user.save.should be_false + @user.save.should be false @user.errors[:last_jam_audio_latency].should == ['must be greater than 2'] end it "prevent 10000 (maximum)" do @user.last_jam_audio_latency = User::MAXIMUM_AUDIO_LATENCY - @user.save.should be_false + @user.save.should be false @user.errors[:last_jam_audio_latency].should == ['must be less than 10000'] end end @@ -726,13 +726,13 @@ describe User do it "allow empty merge" do user.mod_merge({}) - user.valid?.should be_true + user.valid?.should be true user.mods.should == {} end it "allow no_show set" do user.mod_merge({"no_show" => {"some_screen" => true}}) - user.valid?.should be_true + user.valid?.should be true user.mods.should == {"no_show" => {"some_screen" => true}} end @@ -742,7 +742,7 @@ describe User do user.save! user.reload user.mod_merge({"no_show" => {"some_screen2" => true}}) - user.valid?.should be_true + user.valid?.should be true user.mods.should == {"no_show" => {"some_screen1" => true, "some_screen2" => true}} end @@ -751,19 +751,19 @@ describe User do user.save! user.reload user.mod_merge({"no_show" => {"some_screen1" => false}}) - user.valid?.should be_true + user.valid?.should be true user.mods.should == {"no_show" => {"some_screen1" => false}} end it "does not allow random root keys" do user.mod_merge({random_root_key: true}) - user.valid?.should be_false + user.valid?.should be false user.errors[:mods].should == [ValidationMessages::MODS_UNKNOWN_KEY] end it "does not allow non-hash no_show" do user.mod_merge({no_show: true}) - user.valid?.should be_false + user.valid?.should be false user.errors[:mods].should == [ValidationMessages::MODS_MUST_BE_HASH] end end @@ -858,7 +858,7 @@ describe User do it "typical 2 bits" do user.update_name("Seth Call") - user.errors.any?.should be_false + user.errors.any?.should be false user.reload user.first_name.should eql 'Seth' user.last_name.should eql 'Call' @@ -887,7 +887,7 @@ describe User do uncollectable = uncollectables[0] uncollectable.description.should_not be_nil uncollectable.expected_price_in_cents.should eql 3000 - uncollectable.is_card_declined?.should be_false + uncollectable.is_card_declined?.should be false end it "for monthly" do @@ -906,7 +906,7 @@ describe User do uncollectable = uncollectables[0] uncollectable.description.should_not be_nil uncollectable.expected_price_in_cents.should eql 3000 - uncollectable.is_card_declined?.should be_false + uncollectable.is_card_declined?.should be false end it "for monthly near end of month" do @@ -925,7 +925,7 @@ describe User do uncollectable = uncollectables[0] uncollectable.description.should_not be_nil uncollectable.expected_price_in_cents.should eql 750 - uncollectable.is_card_declined?.should be_false + uncollectable.is_card_declined?.should be false end end describe "handle_test_drive_package" do @@ -942,13 +942,13 @@ describe User do end user.handle_test_drive_package(package, detail) - user.errors.any?.should be_false + user.errors.any?.should be false LessonSession.where(user_id: user.id).count.should eql package_size user.student_lesson_bookings.count.should eql package_size user.student_lesson_bookings.each do |booking| booking.status.should eql LessonBooking::STATUS_REQUESTED - booking.card_presumed_ok.should be_false + booking.card_presumed_ok.should be false end end end @@ -958,61 +958,61 @@ describe User do before(:each) {UserMailer.deliveries.clear} it "onboarded" do - user.send_onboarding_survey.should be_false + user.send_onboarding_survey.should be false user.onboarding_onboarded_at = Time.now user.save! user.reload - user.send_onboarding_survey.should be_true + user.send_onboarding_survey.should be true UserMailer.deliveries.count.should eql 1 user.onboarding_status = User::ONBOARDING_STATUS_ONBOARDED end it "lost" do - user.send_onboarding_survey.should be_false + user.send_onboarding_survey.should be false user.onboarding_lost_reason = User::LOST_REASON_NO_VIDEO_STREAM user.save! user.reload - user.send_onboarding_survey.should be_true + user.send_onboarding_survey.should be true UserMailer.deliveries.count.should eql 0 user.onboarding_status = User::ONBOARDING_STATUS_LOST end it "escalated" do - user.send_onboarding_survey.should be_false + user.send_onboarding_survey.should be false user.onboarding_escalation_reason = User::ESCALATION_REASON_NO_VIDEO_STREAM user.save! user.reload - user.send_onboarding_survey.should be_true + user.send_onboarding_survey.should be true UserMailer.deliveries.count.should eql 0 user.onboarding_status = User::ONBOARDING_STATUS_ESCALATED end it "taken free lesson" do - user.send_onboarding_survey.should be_false + user.send_onboarding_survey.should be false user.first_onboarding_free_lesson_at = Time.now user.save! user.reload - user.send_onboarding_survey.should be_false + user.send_onboarding_survey.should be false UserMailer.deliveries.count.should eql 0 user.onboarding_status = User::ONBOARDING_STATUS_FREE_LESSON end it "paid lesson" do - user.send_onboarding_survey.should be_false + user.send_onboarding_survey.should be false user.first_onboarding_paid_lesson_at = Time.now user.save! user.reload - user.send_onboarding_survey.should be_false + user.send_onboarding_survey.should be false UserMailer.deliveries.count.should eql 0 user.onboarding_status = User::ONBOARDING_STATUS_PAID_LESSON end it "assigned" do - user.send_onboarding_survey.should be_false + user.send_onboarding_survey.should be false user.onboarder = FactoryBot.create(:user, is_onboarder:true) user.save! user.reload - user.send_onboarding_survey.should be_false + user.send_onboarding_survey.should be false UserMailer.deliveries.count.should eql 1 user.onboarding_status = User::ONBOARDING_STATUS_ASSIGNED end @@ -1030,7 +1030,7 @@ describe User do UserMailer.deliveries.count.should eql 1 user.reload - user.send_onboarding_survey.should be_true + user.send_onboarding_survey.should be true user.sent_onboarding_survey_at.should_not be_nil UserMailer.deliveries.clear @@ -1161,7 +1161,7 @@ describe User do @user.update_avatar(original, clipped, "jamkazam") end - it { @user.errors.any?.should be_false } + it { @user.errors.any?.should be false } it { @user.original_fpfile.class == String } it { @user.cropped_fpfile.class == String } it { @user.photo_url = S3Util.url("jamkazam", s3_path, :secure => false ) } @@ -1176,7 +1176,7 @@ describe User do @user.update_avatar(original, clipped, "jamkazam") end - it { @user.errors.any?.should be_true } + it { @user.errors.any?.should be true } it { @user.errors[:original_fpfile][0].should == ValidationMessages::INVALID_FPFILE } it { @user.errors[:cropped_fpfile][0].should == ValidationMessages::INVALID_FPFILE } end diff --git a/ruby/spec/jam_ruby/recurly_client_spec.rb b/ruby/spec/jam_ruby/recurly_client_spec.rb index c43e4b46d..4c3c19a41 100644 --- a/ruby/spec/jam_ruby/recurly_client_spec.rb +++ b/ruby/spec/jam_ruby/recurly_client_spec.rb @@ -98,15 +98,15 @@ describe RecurlyClient do expect{@client.place_order(@user, @jamtrack, shopping_cart, sale)}.not_to raise_error() active_subs=@client.get_account(@user).subscriptions.find_all{|t|t.state=='active'} @jamtrack.reload - @jamtrack.jam_track_rights.should have(1).items + @jamtrack.jam_track_rights.size.should == 1 # Refund: expect{@client.refund_user_subscription(@user, @jamtrack)}.not_to raise_error() active_subs=@client.get_account(@user).subscriptions.find_all{|t|t.state=='active'} - active_subs.should have(0).items + active_subs.size.should == 0 @jamtrack.reload - @jamtrack.jam_track_rights.should have(0).items + @jamtrack.jam_track_rights.size.should == 0 end =end diff --git a/ruby/spec/jam_ruby/resque/audiomixer_spec.rb b/ruby/spec/jam_ruby/resque/audiomixer_spec.rb index 8bb57de9a..6094aeaea 100644 --- a/ruby/spec/jam_ruby/resque/audiomixer_spec.rb +++ b/ruby/spec/jam_ruby/resque/audiomixer_spec.rb @@ -45,9 +45,9 @@ describe AudioMixer do MQRouter.client_exchange = double("client_exchange") MQRouter.user_exchange = double("user_exchange") MQRouter.subscription_exchange = double("subscription_exchange") - MQRouter.client_exchange.should_receive(:publish).any_number_of_times - MQRouter.user_exchange.should_receive(:publish).any_number_of_times - MQRouter.subscription_exchange.should_receive(:publish).any_number_of_times + MQRouter.client_exchange.stub(:publish) + MQRouter.user_exchange.stub(:publish) + MQRouter.subscription_exchange.stub(:publish) end @@ -163,7 +163,7 @@ describe AudioMixer do @recording = Recording.start(@music_session, @user) @recording.stop @recording.claim(@user, "name", "description", Genre.first, true) - @recording.errors.any?.should be_false + @recording.errors.any?.should be false end describe "simulated" do @@ -200,7 +200,7 @@ describe AudioMixer do @mix.started_at.should_not be_nil AudioMixer.perform(@mix.id, @mix.sign_url(60 * 60 * 24, 'ogg'), @mix.sign_url(60 * 60 * 24, 'mp3')) @mix.reload - @mix.completed.should be_true + @mix.completed.should be true @mix.ogg_length.should == 0 @mix.ogg_md5.should == 'd41d8cd98f00b204e9800998ecf8427e' # that's the md5 of a touched file @mix.mp3_length.should == 0 @@ -213,7 +213,7 @@ describe AudioMixer do @mix = Mix.schedule(@recording) expect{ AudioMixer.perform(@mix.id, @mix.sign_url(60 * 60 * 24, 'ogg'), @mix.sign_url(60 * 60 * 24, 'mp3')) }.to raise_error @mix.reload - @mix.completed.should be_false + @mix.completed.should be false @mix.error_count.should == 1 @mix.error_reason.should == "unhandled-job-exception" @mix.error_detail.should == "no file located at: /some/path/to/nowhere" @@ -239,7 +239,7 @@ describe AudioMixer do end @mix.reload - @mix.completed.should be_true + @mix.completed.should be true @mix.ogg_length.should == 0 @mix.ogg_md5.should == 'd41d8cd98f00b204e9800998ecf8427e' # that's the md5 of a touched file, which is what the stubbed :execute does end @@ -251,14 +251,14 @@ describe AudioMixer do end @mix.reload - @mix.completed.should be_true + @mix.completed.should be true with_resque do @mix.enqueue end @mix.reload - @mix.completed.should be_true + @mix.completed.should be true end end end @@ -303,7 +303,7 @@ describe AudioMixer do end @mix.reload - @mix.completed.should be_true + @mix.completed.should be true @mix.ogg_length.should == 0 @mix.ogg_md5.should == 'd41d8cd98f00b204e9800998ecf8427e' # that's the md5 of a touched file, which is what the stubbed :execute does @mix.mp3_length.should == 0 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 a644b8758..4993437f6 100644 --- a/ruby/spec/jam_ruby/resque/jam_tracks_builder_spec.rb +++ b/ruby/spec/jam_ruby/resque/jam_tracks_builder_spec.rb @@ -35,7 +35,7 @@ describe JamTracksBuilder do jam_track_track[:url_48].should == jam_track_track.manually_uploaded_filename(:url_48) # verify it's on S3 - @s3.exists?(jam_track_track[:url_48]).should be_true + @s3.exists?(jam_track_track[:url_48]).should be true @s3.length(jam_track_track[:url_48]).should == File.size?(ogg_path) jam_track_track[:url_44].should be_nil @@ -48,9 +48,9 @@ describe JamTracksBuilder do jam_track_right[:url_48].should == jam_track_right.store_dir + '/' + jam_track_right.filename(:url_48) jam_track_track[:url_44].should be_nil - jam_track_right.signed_48.should be_true + jam_track_right.signed_48.should be true jam_track_right.signing_started_at_48.should_not be_nil - jam_track_right.signed_44.should be_false + jam_track_right.signed_44.should be false jam_track_right.signing_started_at_44.should be_nil end @@ -72,7 +72,7 @@ describe JamTracksBuilder do jam_track_track[:url_44].should == jam_track_track.manually_uploaded_filename(:url_44) # verify it's on S3 - @s3.exists?(jam_track_track[:url_44]).should be_true + @s3.exists?(jam_track_track[:url_44]).should be true @s3.length(jam_track_track[:url_44]).should == File.size?(ogg_path) jam_track_track[:url_48].should be_nil @@ -86,9 +86,9 @@ describe JamTracksBuilder do jam_track_right.url_44.should_not be_nil jam_track_track[:url_48].should be_nil - jam_track_right.signed_44.should be_true + jam_track_right.signed_44.should be true jam_track_right.signing_started_at_44.should_not be_nil - jam_track_right.signed_48.should be_false + jam_track_right.signed_48.should be false jam_track_right.signing_started_at_48.should be_nil end end 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 186253068..de3f2a289 100644 --- a/ruby/spec/jam_ruby/resque/jam_tracks_cleaner_spec.rb +++ b/ruby/spec/jam_ruby/resque/jam_tracks_cleaner_spec.rb @@ -40,15 +40,15 @@ describe JamTracksCleaner do url.should_not be_nil s3 = S3Manager.new(APP_CONFIG.aws_bucket, APP_CONFIG.aws_access_key_id, APP_CONFIG.aws_secret_access_key) - s3.exists?(jam_track_right[:url_48]).should be_true + s3.exists?(jam_track_right[:url_48]).should be true JamRuby::JamTracksCleaner.perform - s3.exists?(url).should be_true + s3.exists?(url).should be true s3 = S3Manager.new(APP_CONFIG.aws_bucket, APP_CONFIG.aws_access_key_id, APP_CONFIG.aws_secret_access_key) jam_track_right.update_attribute("updated_at", 6.minutes.ago) # But not after running cleaner job: JamRuby::JamTracksCleaner.perform - s3.exists?(url).should be_false + s3.exists?(url).should be false end end \ No newline at end of file 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 603e898de..b944b7e68 100644 --- a/ruby/spec/jam_ruby/resque/music_session_reminder_spec.rb +++ b/ruby/spec/jam_ruby/resque/music_session_reminder_spec.rb @@ -29,11 +29,11 @@ describe 'MusicSessionReminder' do calls = count_publish_to_user_calls calls[:count].should == 0 - mail.html_part.body.include?("is scheduled for tomorrow").should be_true - mail.text_part.body.include?("is scheduled for tomorrow").should be_true + mail.html_part.body.include?("is scheduled for tomorrow").should be true + mail.text_part.body.include?("is scheduled for tomorrow").should be true - mail.html_part.body.include?("starts in 1 hour").should be_false - mail.text_part.body.include?("starts in 1 hour").should be_false + mail.html_part.body.include?("starts in 1 hour").should be false + mail.text_part.body.include?("starts in 1 hour").should be false end it "sends email 1 hour before" do @@ -47,11 +47,11 @@ describe 'MusicSessionReminder' do UserMailer.deliveries.length.should == 1 calls = count_publish_to_user_calls calls[:count].should == 0 - mail.html_part.body.include?("is scheduled for tomorrow").should be_false - mail.text_part.body.include?("is scheduled for tomorrow").should be_false + mail.html_part.body.include?("is scheduled for tomorrow").should be false + mail.text_part.body.include?("is scheduled for tomorrow").should be false - mail.html_part.body.include?("starts in 1 hour").should be_true - mail.text_part.body.include?("starts in 1 hour").should be_true + mail.html_part.body.include?("starts in 1 hour").should be true + mail.text_part.body.include?("starts in 1 hour").should be true end diff --git a/ruby/spec/jam_ruby/resque/quick_mixer_spec.rb b/ruby/spec/jam_ruby/resque/quick_mixer_spec.rb index 601345eea..75588ebe2 100644 --- a/ruby/spec/jam_ruby/resque/quick_mixer_spec.rb +++ b/ruby/spec/jam_ruby/resque/quick_mixer_spec.rb @@ -18,9 +18,9 @@ describe AudioMixer do MQRouter.client_exchange = double("client_exchange") MQRouter.user_exchange = double("user_exchange") MQRouter.subscription_exchange = double("subscription_exchange") - MQRouter.client_exchange.should_receive(:publish).any_number_of_times - MQRouter.user_exchange.should_receive(:publish).any_number_of_times - MQRouter.subscription_exchange.should_receive(:publish).any_number_of_times + MQRouter.client_exchange.stub(:publish) + MQRouter.user_exchange.stub(:publish) + MQRouter.subscription_exchange.stub(:publish) end def assert_found_job_count(expected) @@ -82,7 +82,7 @@ describe AudioMixer do @recording = Recording.start(@music_session, @user) @recording.stop @recording.claim(@user, "name", "description", Genre.first, true) - @recording.errors.any?.should be_false + @recording.errors.any?.should be false @recording.quick_mixes.length.should == 1 @quick_mix = @recording.quick_mixes[0] @@ -109,7 +109,7 @@ describe AudioMixer do end @mix.reload - @mix.completed.should be_true + @mix.completed.should be true @mix.mp3_length.should == "ogg goodness".length @mix.mp3_md5.should == ::Digest::MD5.file(sample_ogg).hexdigest 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 87e1a4a39..eff4d999f 100644 --- a/ruby/spec/jam_ruby/resque/scheduled_daily_job_spec.rb +++ b/ruby/spec/jam_ruby/resque/scheduled_daily_job_spec.rb @@ -18,16 +18,16 @@ describe 'DailyJob' do it "properly purges old 'delete' calendars" do @creator.reload - @creator.calendars.should have(1).items + @creator.calendars.size.should == 1 JamRuby::DailyJob.perform @creator.reload - @creator.calendars.should have(1).items + @creator.calendars.size.should == 1 Timecop.travel(Time.now + 5.weeks) JamRuby::DailyJob.perform @creator.reload - @creator.calendars.should have(end_count).items + @creator.calendars.size.should == end_count Timecop.return end end diff --git a/ruby/spec/jam_ruby/subscription_definitions_spec.rb b/ruby/spec/jam_ruby/subscription_definitions_spec.rb index 23c26b05c..09a7bb2be 100644 --- a/ruby/spec/jam_ruby/subscription_definitions_spec.rb +++ b/ruby/spec/jam_ruby/subscription_definitions_spec.rb @@ -4,13 +4,13 @@ describe SubscriptionDefinitions do it "is downgrade " do - SubscriptionDefinitions.is_downgrade('jamsubgold', 'jamsubplatinum').should be_true - SubscriptionDefinitions.is_downgrade('jamsubplatinum', 'jamsubgold').should be_false - SubscriptionDefinitions.is_downgrade('jamsubgold', 'jamsubgold').should be_false - SubscriptionDefinitions.is_downgrade('jamsubgold', 'jamsubgoldyearly').should be_false - SubscriptionDefinitions.is_downgrade('jamsubgoldyearly', 'jamsubgold').should be_false - SubscriptionDefinitions.is_downgrade(nil, 'jamsubgold').should be_true - SubscriptionDefinitions.is_downgrade('jamsubsilver', nil).should be_false - SubscriptionDefinitions.is_downgrade('jamsubsilveryearly', nil).should be_false + SubscriptionDefinitions.is_downgrade('jamsubgold', 'jamsubplatinum').should be true + SubscriptionDefinitions.is_downgrade('jamsubplatinum', 'jamsubgold').should be false + SubscriptionDefinitions.is_downgrade('jamsubgold', 'jamsubgold').should be false + SubscriptionDefinitions.is_downgrade('jamsubgold', 'jamsubgoldyearly').should be false + SubscriptionDefinitions.is_downgrade('jamsubgoldyearly', 'jamsubgold').should be false + SubscriptionDefinitions.is_downgrade(nil, 'jamsubgold').should be true + SubscriptionDefinitions.is_downgrade('jamsubsilver', nil).should be false + SubscriptionDefinitions.is_downgrade('jamsubsilveryearly', nil).should be false end end diff --git a/ruby/spec/mailers/render_emails_spec.rb b/ruby/spec/mailers/render_emails_spec.rb index 751655c07..6b29cb767 100644 --- a/ruby/spec/mailers/render_emails_spec.rb +++ b/ruby/spec/mailers/render_emails_spec.rb @@ -53,7 +53,7 @@ describe "RenderMailers" do it { @filename="friend_request"; UserMailer.friend_request(user, 'So and so has sent you a friend request.', friend_request.id).deliver_now } end - # describe "sending about new musicians with good latency to the user", focus: true do + # describe "sending about new musicians with good latency to the user" do # let(:user) { User.find_by(email: "nuwan@jamkazam.com") } # let(:params) { # {latency_good: true, @@ -524,10 +524,10 @@ describe "RenderMailers" do end end - describe "New Musician Match email", focus: true do + describe "New Musician Match email" do 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(:user1) { FactoryBot.create(:user, first_name: 'David', last_name: 'Macmillan', updated_at: 2.day.ago) } + let(:user2) { FactoryBot.create(:user, first_name: 'Tom', last_name: 'Cluff', last_jam_updated_at: 1.days.ago) } let(:matched_musician_data){ [ { @@ -552,7 +552,7 @@ describe "RenderMailers" do save_emails_to_disk(mail, @filename) end - fit { @filename="new_musicians_match"; UserMailer.new_musicians_match(user, matched_musician_data).deliver_now } + it { @filename="new_musicians_match"; UserMailer.new_musicians_match(user, matched_musician_data).deliver_now } end end diff --git a/ruby/spec/mailers/user_mailer_spec.rb b/ruby/spec/mailers/user_mailer_spec.rb index d539fb65a..aebe0d408 100644 --- a/ruby/spec/mailers/user_mailer_spec.rb +++ b/ruby/spec/mailers/user_mailer_spec.rb @@ -32,10 +32,10 @@ describe UserMailer do it { mail.multipart?.should == true } # because we send plain + html # verify that the messages are correctly configured - it { mail.html_part.body.include?("delighted").should be_true } - it { mail.html_part.body.include?(signup_confirmation_url_with_token).should be_true } - it { mail.text_part.body.include?("delighted").should be_true } - it { mail.text_part.body.include?(signup_confirmation_url_with_token).should be_true } + it { mail.html_part.body.include?("delighted").should be true } + it { mail.html_part.body.include?(signup_confirmation_url_with_token).should be true } + it { mail.text_part.body.include?("delighted").should be true } + it { mail.text_part.body.include?(signup_confirmation_url_with_token).should be true } end describe "should send welcome email" do @@ -53,8 +53,8 @@ describe UserMailer do it { mail.multipart?.should == true } # because we send plain + html # verify that the messages are correctly configured - it { mail.html_part.body.include?("delighted").should be_true } - it { mail.text_part.body.include?("delighted").should be_true } + it { mail.html_part.body.include?("delighted").should be true } + it { mail.text_part.body.include?("delighted").should be true } end describe "should send reset password" do @@ -72,8 +72,8 @@ describe UserMailer do it { mail.multipart?.should == true } # because we send plain + html # verify that the messages are correctly configured - it { mail.html_part.body.include?("Reset").should be_true } - it { mail.text_part.body.include?("change your JamKazam password").should be_true } + it { mail.html_part.body.include?("Reset").should be true } + it { mail.text_part.body.include?("change your JamKazam password").should be true } end describe "should send change password confirmation" do @@ -91,8 +91,8 @@ describe UserMailer do it { mail.multipart?.should == true } # because we send plain + html # verify that the messages are correctly configured - it { mail.html_part.body.include?("changed your password").should be_true } - it { mail.text_part.body.include?("changed your password").should be_true } + it { mail.html_part.body.include?("changed your password").should be true } + it { mail.text_part.body.include?("changed your password").should be true } end describe "should send update email confirmation" do @@ -110,8 +110,8 @@ describe UserMailer do it { mail.multipart?.should == true } # because we send plain + html # verify that the messages are correctly configured - it { mail.html_part.body.include?("#{user.email} has been confirmed as your new email address.").should be_true } - it { mail.text_part.body.include?("#{user.email} has been confirmed as your new email address.").should be_true } + it { mail.html_part.body.include?("#{user.email} has been confirmed as your new email address.").should be true } + it { mail.text_part.body.include?("#{user.email} has been confirmed as your new email address.").should be true } end describe "should send updating email" do @@ -130,12 +130,12 @@ describe UserMailer do it { mail.multipart?.should == true } # because we send plain + html # verify that the messages are correctly configured - it { mail.html_part.body.include?("to confirm your change in email").should be_true } - it { mail.text_part.body.include?("to confirm your change in email").should be_true } + it { mail.html_part.body.include?("to confirm your change in email").should be true } + it { mail.text_part.body.include?("to confirm your change in email").should be true } # verify can unsubscribe from bulk emails - it {mail.html_part.body.include?('here to unsubscribe').should be_true} + it {mail.html_part.body.include?('here to unsubscribe').should be true} it {mail.html_part.body.include?("https://www.jamkazam.com/unsubscribe/#{user.unsubscribe_token}")} end @@ -154,10 +154,10 @@ describe UserMailer do mail.multipart?.should == true # because we send plain + htm # verify that the messages are correctly configured - mail.html_part.body.include?("This is a reminder that your JamKazam session").should be_true - mail.text_part.body.include?("This is a reminder that your JamKazam session").should be_true - mail.html_part.body.include?("starts in 1 hour").should be_true - mail.text_part.body.include?("starts in 1 hour").should be_true + mail.html_part.body.include?("This is a reminder that your JamKazam session").should be true + mail.text_part.body.include?("This is a reminder that your JamKazam session").should be true + mail.html_part.body.include?("starts in 1 hour").should be true + mail.text_part.body.include?("starts in 1 hour").should be true end @@ -172,10 +172,10 @@ describe UserMailer do mail.multipart?.should == true # because we send plain + htm # verify that the messages are correctly configured - mail.html_part.body.include?("This is a reminder that your JamKazam session").should be_true - mail.text_part.body.include?("This is a reminder that your JamKazam session").should be_true - mail.html_part.body.include?("is scheduled for tomorrow").should be_true - mail.text_part.body.include?("is scheduled for tomorrow").should be_true + mail.html_part.body.include?("This is a reminder that your JamKazam session").should be true + mail.text_part.body.include?("This is a reminder that your JamKazam session").should be true + mail.html_part.body.include?("is scheduled for tomorrow").should be true + mail.text_part.body.include?("is scheduled for tomorrow").should be true end end @@ -206,12 +206,11 @@ describe UserMailer do # it { mail.multipart?.should == true } # because we send plain + html # # verify that the messages are correctly configured - # it { mail.html_part.body.include?("New JamKazam Musicians in your Area").should be_true } - # it { mail.text_part.body.include?("New JamKazam Musicians in your Area").should be_true } + # it { mail.html_part.body.include?("New JamKazam Musicians in your Area").should be true } + # it { mail.text_part.body.include?("New JamKazam Musicians in your Area").should be true } # end - describe "sends group session reminder 1", focus: true do - let(:mail) { ActionMailer::Base.deliveries.last } + describe "sends group session reminder 1" do let(:mail) { ActionMailer::Base.deliveries.last } before(:each) do ActionMailer::Base.deliveries.clear @@ -248,8 +247,7 @@ describe UserMailer do end end - describe "sends group session reminder 2", focus: true do - let(:mail) { ActionMailer::Base.deliveries.last } + describe "sends group session reminder 2" do let(:mail) { ActionMailer::Base.deliveries.last } before(:each) do ActionMailer::Base.deliveries.clear @@ -285,8 +283,7 @@ describe UserMailer do end end - describe "sends group session reminder 3", focus: true do - let(:mail) { ActionMailer::Base.deliveries.last } + describe "sends group session reminder 3" do let(:mail) { ActionMailer::Base.deliveries.last } before(:each) do ActionMailer::Base.deliveries.clear @@ -322,8 +319,7 @@ describe UserMailer do end end - describe "sends trial expires reminder 1", focus: true do - let(:mail) { ActionMailer::Base.deliveries.last } + describe "sends trial expires reminder 1" do let(:mail) { ActionMailer::Base.deliveries.last } before(:each) do ActionMailer::Base.deliveries.clear @@ -359,8 +355,7 @@ describe UserMailer do end end - describe "sends trial expires reminder 2", focus: true do - let(:mail) { ActionMailer::Base.deliveries.last } + describe "sends trial expires reminder 2" do let(:mail) { ActionMailer::Base.deliveries.last } before(:each) do ActionMailer::Base.deliveries.clear @@ -396,8 +391,7 @@ describe UserMailer do end end - describe "sends trial expires reminder 3", focus: true do - let(:mail) { ActionMailer::Base.deliveries.last } + describe "sends trial expires reminder 3" do let(:mail) { ActionMailer::Base.deliveries.last } before(:each) do ActionMailer::Base.deliveries.clear diff --git a/ruby/spec/spec_helper.rb b/ruby/spec/spec_helper.rb index fe92ac438..7cc32da29 100644 --- a/ruby/spec/spec_helper.rb +++ b/ruby/spec/spec_helper.rb @@ -1,6 +1,12 @@ ENV["RAILS_ENV"] = "test" +require 'rubygems' +require 'bundler/setup' +require 'active_model' +require 'action_mailer' +Bundler.require(:default, :test) + require 'simplecov' require 'support/utilities' require 'support/profile' @@ -48,6 +54,9 @@ require 'resque_spec/scheduler' include JamRuby +I18n.load_path += Dir[File.join(File.dirname(__FILE__), '../config/locales', '*.yml')] +I18n.default_locale = :en + # manually register observers # ActiveRecord::Base.add_observer InvitedUserObserver.instance # ActiveRecord::Base.add_observer UserObserver.instance @@ -67,6 +76,8 @@ CarrierWave.configure do |config| config.enable_processing = false end +Recurly.api_key = 'test' + # Stripe.api_key = "sk_test_OkjoIF7FmdjunyNsdVqJD02D" diff --git a/ruby/spec/support/utilities.rb b/ruby/spec/support/utilities.rb index a3521bdc3..45792bc78 100644 --- a/ruby/spec/support/utilities.rb +++ b/ruby/spec/support/utilities.rb @@ -51,6 +51,10 @@ def app_config 'nobody@jamkazam.com' end + def spa_origin_url + 'http://localhost:3000' + end + def action_mailer OpenStruct.new(asset_host: 'http://localhost:3000') end @@ -388,7 +392,7 @@ end def set_updated_at(resource, time) begin ActiveRecord::Base.record_timestamps = false - resource.updated_at = time + resource.update(updated_at: time) resource.save!(validate: false) ensure # very important to turn it back; it'll break all tests otherwise @@ -490,3 +494,64 @@ module ApplicationHelper 'http://localhost:3000' end end + +def mock_latency_response(collection) + resp = [] + if collection && collection.any? + resp = collection.map do |latency_item| + user = latency_item[:user] + latency = latency_item[:latency] + audio_latency = latency_item[:audio_latency] + audio_latency_unknown = latency_item[:audio_latency_unknown] + ars_internet_latency = latency_item[:ars_internet_latency] + ars_total_latency = latency_item[:ars_total_latency] + p2p_internet_latency = latency_item[:p2p_internet_latency] + p2p_total_latency = latency_item[:p2p_total_latency] + wifi = latency_item[:wifi] + + { + "user_id": user.id, + "first_name": user.first_name, + "last_name": user.last_name, + "audio_latency": audio_latency, + "audio_latency_unknown": audio_latency_unknown, + "ars": { + "internet_latency": ars_internet_latency, + "total_latency": ars_total_latency + }, + "p2p": { + "internet_latency": p2p_internet_latency, + "total_latency": p2p_total_latency + }, + "wifi": wifi + } + end + end + + output = if resp.any? + { + "users": resp, + "my_audio_latency": 4.0, + "my_audio_latency_unknown": false + } + else + { + "users": [] + } + end + output.to_json +end + +module Rails + def self.application + OpenStruct.new(config: OpenStruct.new( + targeted_feed_disabled: false, + trial_expires_reminders_effective_from_date: 10.years.ago, + test_gear_reminders_effective_from_date: 10.years.ago, + profile_complete_reminders_effective_from_date: 10.years.ago, + gear_setup_reminders_effective_from_date: 10.years.ago, + group_session_reminders_effective_from_date: 10.years.ago, + send_user_match_mail_only_to_jamkazam_team: false + )) + end +end \ No newline at end of file