From 2dc65f529babdad4013ea35e22da71d32d169f45 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 10:38:59 +0000 Subject: [PATCH 01/11] Fix rubygems source configured for bundler --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 215fb9b..d0618fd 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'http://rubygems.org' +source 'https://rubygems.org' gem 'rails', '~> 4.0' gem 'pg', '~> 0.17' From 1efb3103d97d489ed32cf9c12077ad8715ef277d Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 11:17:29 +0000 Subject: [PATCH 02/11] Remove `respond_to` usage in playlists controller This feature was deprecated by rails. --- app/controllers/api/playlists_controller.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/controllers/api/playlists_controller.rb b/app/controllers/api/playlists_controller.rb index 89d0881..8f83019 100644 --- a/app/controllers/api/playlists_controller.rb +++ b/app/controllers/api/playlists_controller.rb @@ -1,7 +1,5 @@ module API class PlaylistsController < ApplicationController - respond_to :json - def index @playlists = Playlist.all end From aa6f6a103ed86c0f595d483451c34dfe3f910f0a Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 11:32:25 +0000 Subject: [PATCH 03/11] Update to rails 4.2.1 --- .gitignore | 1 + Gemfile | 2 +- bin/rails | 2 +- config/application.rb | 3 ++ config/boot.rb | 3 +- config/environment.rb | 2 +- config/environments/development.rb | 16 ++++++++-- config/environments/production.rb | 39 +++++++++++------------ config/environments/test.rb | 14 +++++--- config/initializers/assets.rb | 11 +++++++ config/initializers/cookies_serializer.rb | 3 ++ config/initializers/mime_types.rb | 1 - config/initializers/session_store.rb | 2 +- config/routes.rb | 2 +- 14 files changed, 67 insertions(+), 34 deletions(-) create mode 100644 config/initializers/assets.rb create mode 100644 config/initializers/cookies_serializer.rb diff --git a/.gitignore b/.gitignore index 75308ca..ab6086b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /Gemfile-custom.rb /Gemfile.lock /config/database.yml +/config/secrets.yml /data/ /log/*.log /tmp/ diff --git a/Gemfile b/Gemfile index d0618fd..0640c05 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'rails', '~> 4.0' +gem 'rails', '~> 4.2.1' gem 'pg', '~> 0.17' gem 'haml', '~> 4.0' gem 'bcrypt', '~> 3.0' diff --git a/bin/rails b/bin/rails index 71755b8..fad8d8b 100755 --- a/bin/rails +++ b/bin/rails @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../../config/application', __FILE__) require_relative '../config/boot' require 'rails/commands' diff --git a/config/application.rb b/config/application.rb index d6d9e6d..55cb828 100644 --- a/config/application.rb +++ b/config/application.rb @@ -19,5 +19,8 @@ module Scube # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de + + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true end end diff --git a/config/boot.rb b/config/boot.rb index 5e5f0c1..6b750f0 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,3 @@ -# Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/environment.rb b/config/environment.rb index 5eb742d..ee8d90d 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -2,4 +2,4 @@ require File.expand_path('../application', __FILE__) # Initialize the Rails application. -Scube::Application.initialize! +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 45657fe..b55e214 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,4 +1,4 @@ -Scube::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on @@ -19,11 +19,23 @@ Scube::Application.configure do # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Raise an error on page load if there are pending migrations + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true end diff --git a/config/environments/production.rb b/config/environments/production.rb index ea700d0..2aa88a8 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,11 +1,11 @@ -Scube::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both thread web servers + # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true @@ -16,11 +16,13 @@ Scube::Application.configure do # Enable Rack::Cache to put a simple HTTP cache in front of your application # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. # config.action_dispatch.rack_cache = true - # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_assets = false + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -29,20 +31,21 @@ Scube::Application.configure do # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Generate digests for assets URLs. + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. config.assets.digest = true - # Version of your assets, change this if you want to expire all your assets. - config.assets.version = '1.0' + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true - # Set to :debug to see everything in the log. + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. config.log_level = :info # Prepend all log lines with the following tags. @@ -55,26 +58,22 @@ Scube::Application.configure do # config.cache_store = :mem_cache_store # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = "http://assets.example.com" - - # Precompile additional assets. - # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. - # config.assets.precompile += %w( search.js ) + # config.action_controller.asset_host = 'http://assets.example.com' # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found). + # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify - # Disable automatic flushing of the log to improve performance. - # config.autoflush_log = false - # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false end diff --git a/config/environments/test.rb b/config/environments/test.rb index 70c5a9e..1c19f08 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,4 @@ -Scube::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's @@ -12,9 +12,9 @@ Scube::Application.configure do # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" + # Configure static file server for tests with Cache-Control for performance. + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -31,6 +31,12 @@ Scube::Application.configure do # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test + # Randomize the order test cases are executed. + config.active_support.test_order = :random + # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb new file mode 100644 index 0000000..01ef3e6 --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..7f70458 --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 72aca7e..dc18996 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -2,4 +2,3 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index bc77e55..449749e 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Scube::Application.config.session_store :cookie_store, key: '_scube_session' +Rails.application.config.session_store :cookie_store, key: '_scube_session' diff --git a/config/routes.rb b/config/routes.rb index d253a8f..19e7381 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -Scube::Application.routes.draw do +Rails.application.routes.draw do namespace :api do resources :sounds, only: [:show] resources :tracks, only: [:index] From 403d9c3df20bdda3abe006aca80a465987153456 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 11:38:34 +0000 Subject: [PATCH 04/11] Fix rspec-rails mock_model deprecation --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index 0640c05..1d36091 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,7 @@ gem 'rabl', '~> 0.6' group :development, :test do gem 'rspec-rails', '~> 2.6' + gem 'rspec-activemodel-mocks' gem 'spork', '~> 1.0rc' gem 'capybara', '~> 2.2' gem 'factory_girl_rails', '~> 4.4' From b70071a7c3baa1115ccc6dc0c11ed15b55d25251 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 13:00:14 +0000 Subject: [PATCH 05/11] Update rspec configuration for rspec-rails 3 --- spec/spec_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cd64829..14fc638 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,6 +8,7 @@ Spork.prefork do Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } RSpec.configure do |config| + config.infer_spec_type_from_file_location! config.mock_with :rspec config.use_transactional_fixtures = true Rails.configuration.sounds_path = "#{Rails.root}/tmp/spec/data/sounds" From fae21e87d433e04470e26e77795fe2b8e32646ef Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 13:06:44 +0000 Subject: [PATCH 06/11] Fix rspec 2.99 deprecations --- spec/controllers/api/playlists_controller_spec.rb | 2 +- spec/controllers/api/tracks_controller_spec.rb | 2 +- spec/models/user_spec.rb | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/spec/controllers/api/playlists_controller_spec.rb b/spec/controllers/api/playlists_controller_spec.rb index 05b75e1..84599e7 100644 --- a/spec/controllers/api/playlists_controller_spec.rb +++ b/spec/controllers/api/playlists_controller_spec.rb @@ -19,7 +19,7 @@ describe API::PlaylistsController do end it 'lists all playlists' do - expect(do_get).to have(2).items + expect(do_get.size).to eq 2 end it 'lists playlists with their id' do diff --git a/spec/controllers/api/tracks_controller_spec.rb b/spec/controllers/api/tracks_controller_spec.rb index b31008a..7aa8059 100644 --- a/spec/controllers/api/tracks_controller_spec.rb +++ b/spec/controllers/api/tracks_controller_spec.rb @@ -19,7 +19,7 @@ describe API::TracksController do end it 'lists all tracks' do - expect(do_get).to have(2).items + expect(do_get.size).to eq 2 end it 'lists tracks with their id' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e9381ee..a8d21fd 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,8 +1,7 @@ require 'spec_helper' describe User do - subject { user } - let(:user) { FactoryGirl.build(:user) } + subject(:user) { FactoryGirl.build(:user) } it { should be_valid } it { should have_many :playlists } @@ -12,11 +11,14 @@ describe User do context 'when a user with the same email address already exists' do let(:old_user) { FactoryGirl.create(:user, email: 'unique@example.net') } - subject { FactoryGirl.build(:user, email: old_user.email) } + subject(:user) { FactoryGirl.build(:user, email: old_user.email) } it { should_not be_valid } - it { should have(1).error_on(:email) } + it 'has an error on email attribute' do + user.valid? + expect(user.errors[:email].size).to eq 1 + end end context 'when password_confirmation does not match password' do From 096d808a60045e14cc6b3fcf5c387e3f464e9da9 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 13:09:05 +0000 Subject: [PATCH 07/11] Use custom spork version updated for rspec ~> 2.99 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 1d36091..6e0c269 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,7 @@ gem 'rabl', '~> 0.6' group :development, :test do gem 'rspec-rails', '~> 2.6' gem 'rspec-activemodel-mocks' - gem 'spork', '~> 1.0rc' + gem 'spork', github: 'tjouan/spork', branch: 'rspec-3' gem 'capybara', '~> 2.2' gem 'factory_girl_rails', '~> 4.4' gem 'shoulda-matchers', '~> 2.5' From 6df77a488814353a93d3805b29a1da668ca89cea Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 13:15:13 +0000 Subject: [PATCH 08/11] Change gem sort order in Gemfile --- Gemfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6e0c269..dddbb0a 100644 --- a/Gemfile +++ b/Gemfile @@ -2,10 +2,12 @@ source 'https://rubygems.org' gem 'rails', '~> 4.2.1' gem 'pg', '~> 0.17' -gem 'haml', '~> 4.0' gem 'bcrypt', '~> 3.0' + +gem 'haml', '~> 4.0' gem 'rabl', '~> 0.6' + group :development, :test do gem 'rspec-rails', '~> 2.6' gem 'rspec-activemodel-mocks' From 47be6e09f27e2976ad0ad34f1fee60fbabc41911 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 13:18:12 +0000 Subject: [PATCH 09/11] Declare and lock all dependencies * Remove custom gemfile usage; * Move essential gems from custom gemfile to the standard one; * Include bundler lock file in version control. --- .gitignore | 2 - Gemfile | 12 ++- Gemfile.lock | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 239 insertions(+), 4 deletions(-) create mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index ab6086b..16ddf48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -/Gemfile-custom.rb -/Gemfile.lock /config/database.yml /config/secrets.yml /data/ diff --git a/Gemfile b/Gemfile index dddbb0a..735bb12 100644 --- a/Gemfile +++ b/Gemfile @@ -3,18 +3,26 @@ source 'https://rubygems.org' gem 'rails', '~> 4.2.1' gem 'pg', '~> 0.17' gem 'bcrypt', '~> 3.0' +gem 'unicorn-rails' gem 'haml', '~> 4.0' gem 'rabl', '~> 0.6' group :development, :test do + gem 'pry-rails' +end + +group :test do gem 'rspec-rails', '~> 2.6' gem 'rspec-activemodel-mocks' gem 'spork', github: 'tjouan/spork', branch: 'rspec-3' gem 'capybara', '~> 2.2' gem 'factory_girl_rails', '~> 4.4' gem 'shoulda-matchers', '~> 2.5' -end -eval File.read('Gemfile-custom.rb') if File.exist?('Gemfile-custom.rb') + gem 'rb-kqueue', require: false + gem 'guard', require: false + gem 'guard-rspec', require: false + gem 'guard-spork', require: false +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..a0dc86f --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,229 @@ +GIT + remote: git://github.com/tjouan/spork.git + revision: 49ab62dd1e3f250cc438be928cf47f6dd0763923 + branch: rspec-3 + specs: + spork (1.0.0rc4) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.1) + actionpack (= 4.2.1) + actionview (= 4.2.1) + activejob (= 4.2.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.1) + actionview (= 4.2.1) + activesupport (= 4.2.1) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + actionview (4.2.1) + activesupport (= 4.2.1) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + activejob (4.2.1) + activesupport (= 4.2.1) + globalid (>= 0.3.0) + activemodel (4.2.1) + activesupport (= 4.2.1) + builder (~> 3.1) + activerecord (4.2.1) + activemodel (= 4.2.1) + activesupport (= 4.2.1) + arel (~> 6.0) + activesupport (4.2.1) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + arel (6.0.0) + bcrypt (3.1.10) + builder (3.2.2) + capybara (2.4.4) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (~> 2.0) + celluloid (0.16.0) + timers (~> 4.0.0) + childprocess (0.5.6) + ffi (~> 1.0, >= 1.0.11) + coderay (1.1.0) + diff-lcs (1.2.5) + erubis (2.7.0) + factory_girl (4.5.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.5.0) + factory_girl (~> 4.5.0) + railties (>= 3.0.0) + ffi (1.9.8) + formatador (0.2.5) + globalid (0.3.5) + activesupport (>= 4.1.0) + guard (2.12.5) + formatador (>= 0.2.4) + listen (~> 2.7) + lumberjack (~> 1.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.9.12) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-rspec (4.5.0) + guard (~> 2.1) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) + guard-spork (2.1.0) + childprocess (>= 0.2.3) + guard (~> 2.0) + guard-compat (~> 1.0) + spork (>= 0.8.4) + haml (4.0.6) + tilt + hitimes (1.2.2) + i18n (0.7.0) + json (1.8.2) + kgio (2.9.3) + listen (2.10.0) + celluloid (~> 0.16.0) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + loofah (2.0.1) + nokogiri (>= 1.5.9) + lumberjack (1.0.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + method_source (0.8.2) + mime-types (2.5) + mini_portile (0.6.2) + minitest (5.6.1) + nenv (0.2.0) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) + notiffany (0.0.6) + nenv (~> 0.1) + shellany (~> 0.0) + pg (0.18.1) + pry (0.10.1) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry-rails (0.3.4) + pry (>= 0.9.10) + rabl (0.11.6) + activesupport (>= 2.3.14) + rack (1.6.0) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.1) + actionmailer (= 4.2.1) + actionpack (= 4.2.1) + actionview (= 4.2.1) + activejob (= 4.2.1) + activemodel (= 4.2.1) + activerecord (= 4.2.1) + activesupport (= 4.2.1) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.1) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.6) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.2) + loofah (~> 2.0) + railties (4.2.1) + actionpack (= 4.2.1) + activesupport (= 4.2.1) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + raindrops (0.13.0) + rake (10.4.2) + rb-fsevent (0.9.4) + rb-inotify (0.9.5) + ffi (>= 0.5.0) + rb-kqueue (0.2.3) + ffi (>= 0.5.0) + rspec (2.99.0) + rspec-core (~> 2.99.0) + rspec-expectations (~> 2.99.0) + rspec-mocks (~> 2.99.0) + rspec-activemodel-mocks (1.0.1) + activemodel (>= 3.0) + activesupport (>= 3.0) + rspec-mocks (>= 2.99, < 4.0) + rspec-collection_matchers (1.1.2) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (2.99.2) + rspec-expectations (2.99.2) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.99.3) + rspec-rails (2.99.0) + actionpack (>= 3.0) + activemodel (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-collection_matchers + rspec-core (~> 2.99.0) + rspec-expectations (~> 2.99.0) + rspec-mocks (~> 2.99.0) + rspec-support (3.2.2) + shellany (0.0.1) + shoulda-matchers (2.8.0) + activesupport (>= 3.0.0) + slop (3.6.0) + sprockets (3.0.3) + rack (~> 1.0) + sprockets-rails (2.2.4) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + thor (0.19.1) + thread_safe (0.3.5) + tilt (2.0.1) + timers (4.0.1) + hitimes + tzinfo (1.2.2) + thread_safe (~> 0.1) + unicorn (4.9.0) + kgio (~> 2.6) + rack + raindrops (~> 0.7) + unicorn-rails (2.2.0) + rack + unicorn + xpath (2.0.0) + nokogiri (~> 1.3) + +PLATFORMS + ruby + +DEPENDENCIES + bcrypt (~> 3.0) + capybara (~> 2.2) + factory_girl_rails (~> 4.4) + guard + guard-rspec + guard-spork + haml (~> 4.0) + pg (~> 0.17) + pry-rails + rabl (~> 0.6) + rails (~> 4.2.1) + rb-kqueue + rspec-activemodel-mocks + rspec-rails (~> 2.6) + shoulda-matchers (~> 2.5) + spork! + unicorn-rails From 96246f87bf56be76441ab3b3b5938eea45a52061 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 13:22:48 +0000 Subject: [PATCH 10/11] Soften version requirements for most dependencies --- Gemfile | 19 ++++++++++--------- Gemfile.lock | 17 ++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Gemfile b/Gemfile index 735bb12..e7d5b2a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,12 @@ source 'https://rubygems.org' gem 'rails', '~> 4.2.1' -gem 'pg', '~> 0.17' -gem 'bcrypt', '~> 3.0' +gem 'pg' +gem 'bcrypt' gem 'unicorn-rails' -gem 'haml', '~> 4.0' -gem 'rabl', '~> 0.6' +gem 'haml' +gem 'rabl' group :development, :test do @@ -14,12 +14,13 @@ group :development, :test do end group :test do - gem 'rspec-rails', '~> 2.6' + gem 'rspec-rails' gem 'rspec-activemodel-mocks' - gem 'spork', github: 'tjouan/spork', branch: 'rspec-3' - gem 'capybara', '~> 2.2' - gem 'factory_girl_rails', '~> 4.4' - gem 'shoulda-matchers', '~> 2.5' + + gem 'spork', github: 'tjouan/spork', branch: 'rspec-3' + gem 'capybara' + gem 'factory_girl_rails' + gem 'shoulda-matchers' gem 'rb-kqueue', require: false gem 'guard', require: false diff --git a/Gemfile.lock b/Gemfile.lock index a0dc86f..a3fefef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -178,7 +178,6 @@ GEM rspec-core (~> 2.99.0) rspec-expectations (~> 2.99.0) rspec-mocks (~> 2.99.0) - rspec-support (3.2.2) shellany (0.0.1) shoulda-matchers (2.8.0) activesupport (>= 3.0.0) @@ -210,20 +209,20 @@ PLATFORMS ruby DEPENDENCIES - bcrypt (~> 3.0) - capybara (~> 2.2) - factory_girl_rails (~> 4.4) + bcrypt + capybara + factory_girl_rails guard guard-rspec guard-spork - haml (~> 4.0) - pg (~> 0.17) + haml + pg pry-rails - rabl (~> 0.6) + rabl rails (~> 4.2.1) rb-kqueue rspec-activemodel-mocks - rspec-rails (~> 2.6) - shoulda-matchers (~> 2.5) + rspec-rails + shoulda-matchers spork! unicorn-rails From 282eb2ddee97ef5a5425a470ba771788c5bbe198 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 29 Apr 2015 14:55:03 +0000 Subject: [PATCH 11/11] Update to rspec 3.2 --- Gemfile.lock | 40 ++++++++++--------- spec/factories.rb | 6 +-- spec/integration/api/api_sign_in_spec.rb | 6 +-- .../api/cross_origin_request_spec.rb | 10 ++--- spec/integration/api/playlists_spec.rb | 8 ++-- spec/integration/api/tracks_spec.rb | 6 +-- spec/support/user_integration_helpers.rb | 2 +- 7 files changed, 40 insertions(+), 38 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a3fefef..4b60d46 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -155,29 +155,31 @@ GEM ffi (>= 0.5.0) rb-kqueue (0.2.3) ffi (>= 0.5.0) - rspec (2.99.0) - rspec-core (~> 2.99.0) - rspec-expectations (~> 2.99.0) - rspec-mocks (~> 2.99.0) + rspec (3.2.0) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) rspec-activemodel-mocks (1.0.1) activemodel (>= 3.0) activesupport (>= 3.0) rspec-mocks (>= 2.99, < 4.0) - rspec-collection_matchers (1.1.2) - rspec-expectations (>= 2.99.0.beta1) - rspec-core (2.99.2) - rspec-expectations (2.99.2) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.99.3) - rspec-rails (2.99.0) - actionpack (>= 3.0) - activemodel (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-collection_matchers - rspec-core (~> 2.99.0) - rspec-expectations (~> 2.99.0) - rspec-mocks (~> 2.99.0) + rspec-core (3.2.3) + rspec-support (~> 3.2.0) + rspec-expectations (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-mocks (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-rails (3.2.1) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-support (~> 3.2.0) + rspec-support (3.2.2) shellany (0.0.1) shoulda-matchers (2.8.0) activesupport (>= 3.0.0) diff --git a/spec/factories.rb b/spec/factories.rb index 0d2c2d3..6a5c9ce 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -1,7 +1,7 @@ def build_sound_file - file = File.new("#{Rails.root}/spec/fixtures/test.mp3") - file.stub(content_type: 'audio/mpeg') - file + File.new("#{Rails.root}/spec/fixtures/test.mp3").tap do |o| + o.define_singleton_method(:content_type) { 'audio/mpeg' } + end end FactoryGirl.define do diff --git a/spec/integration/api/api_sign_in_spec.rb b/spec/integration/api/api_sign_in_spec.rb index 34196a9..76398de 100644 --- a/spec/integration/api/api_sign_in_spec.rb +++ b/spec/integration/api/api_sign_in_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'API sign in' do +describe 'API sign in' do let(:user) { FactoryGirl.create(:user) } def do_create @@ -10,7 +10,7 @@ feature 'API sign in' do } end - scenario 'signs the user in with valid credentials' do + it 'signs the user in with valid credentials' do do_create expect(response).to be_success @@ -18,7 +18,7 @@ feature 'API sign in' do end [:email, :password].each do |attr| - scenario "rejects authentication with invalid credentials (#{attr})" do + it "rejects authentication with invalid credentials (#{attr})" do allow(user).to receive(attr).and_return(user.send(attr) + '_INVALID') do_create diff --git a/spec/integration/api/cross_origin_request_spec.rb b/spec/integration/api/cross_origin_request_spec.rb index 6fa0f55..9339c57 100644 --- a/spec/integration/api/cross_origin_request_spec.rb +++ b/spec/integration/api/cross_origin_request_spec.rb @@ -1,19 +1,19 @@ require 'spec_helper' -feature 'API cross origin request' do +describe 'API cross origin request' do include UserIntegrationHelpers let(:user) { FactoryGirl.create(:user) } let(:origin) { 'http://origin.example/' } - background do + before do post sessions_path, session: { email: user.email, password: user.password } end - scenario 'preflight request' do + it 'responds to preflight request' do @integration_session.send( :process, :options, @@ -30,7 +30,7 @@ feature 'API cross origin request' do .to eq 'Content-Type, Content-Length, X-Requested-With' end - scenario 'basic request' do + it 'responds to basic request' do # FIXME: replace with a more stable/generic action get api_playlists_path(format: :json), nil, 'Origin' => origin @@ -40,7 +40,7 @@ feature 'API cross origin request' do .to eq 'Content-Length' end - scenario 'request without origin' do + it 'responds to request without origin' do # FIXME: replace with a more stable/generic action get api_playlists_path(format: :json) diff --git a/spec/integration/api/playlists_spec.rb b/spec/integration/api/playlists_spec.rb index 33cf9b0..d6135dc 100644 --- a/spec/integration/api/playlists_spec.rb +++ b/spec/integration/api/playlists_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' -feature 'API playlists' do +describe 'API playlists' do include UserIntegrationHelpers - background { api_sign_in } + before { api_sign_in } - scenario 'creates playlist' do + it 'creates playlist' do playlist = FactoryGirl.attributes_for :playlist - post api_playlists_path, + post_via_redirect api_playlists_path, format: :json, playlist: playlist diff --git a/spec/integration/api/tracks_spec.rb b/spec/integration/api/tracks_spec.rb index 09e18ea..063812d 100644 --- a/spec/integration/api/tracks_spec.rb +++ b/spec/integration/api/tracks_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -feature 'API tracks' do +describe 'API tracks' do include UserIntegrationHelpers - background { api_sign_in } + before { api_sign_in } - scenario 'lists tracks' do + it 'lists tracks' do track_1 = FactoryGirl.create(:track_with_sound, name: 'Track 1') track_2 = FactoryGirl.create(:track, name: 'Track 2') diff --git a/spec/support/user_integration_helpers.rb b/spec/support/user_integration_helpers.rb index 71aebcd..5fdef02 100644 --- a/spec/support/user_integration_helpers.rb +++ b/spec/support/user_integration_helpers.rb @@ -10,7 +10,7 @@ module UserIntegrationHelpers def api_sign_in user = FactoryGirl.create :user - post api_sessions_path, format: :json, session: { + post_via_redirect api_sessions_path, format: :json, session: { email: user.email, password: user.password }