Merge branch 'dependencies-update'

Update most dependencies, ensure version requirements are locked, and
fix deprecated code.
This commit is contained in:
Thibault Jouan 2015-04-30 05:27:49 +00:00
commit 597cd72b96
26 changed files with 348 additions and 74 deletions

3
.gitignore vendored
View File

@ -1,6 +1,5 @@
/Gemfile-custom.rb
/Gemfile.lock
/config/database.yml
/config/secrets.yml
/data/
/log/*.log
/tmp/

36
Gemfile
View File

@ -1,17 +1,29 @@
source 'http://rubygems.org'
source 'https://rubygems.org'
gem 'rails', '~> 4.2.1'
gem 'pg'
gem 'bcrypt'
gem 'unicorn-rails'
gem 'haml'
gem 'rabl'
gem 'rails', '~> 4.0'
gem 'pg', '~> 0.17'
gem 'haml', '~> 4.0'
gem 'bcrypt', '~> 3.0'
gem 'rabl', '~> 0.6'
group :development, :test do
gem 'rspec-rails', '~> 2.6'
gem 'spork', '~> 1.0rc'
gem 'capybara', '~> 2.2'
gem 'factory_girl_rails', '~> 4.4'
gem 'shoulda-matchers', '~> 2.5'
gem 'pry-rails'
end
eval File.read('Gemfile-custom.rb') if File.exist?('Gemfile-custom.rb')
group :test do
gem 'rspec-rails'
gem 'rspec-activemodel-mocks'
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
gem 'guard-rspec', require: false
gem 'guard-spork', require: false
end

230
Gemfile.lock Normal file
View File

@ -0,0 +1,230 @@
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 (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-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)
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
capybara
factory_girl_rails
guard
guard-rspec
guard-spork
haml
pg
pry-rails
rabl
rails (~> 4.2.1)
rb-kqueue
rspec-activemodel-mocks
rspec-rails
shoulda-matchers
spork!
unicorn-rails

View File

@ -1,7 +1,5 @@
module API
class PlaylistsController < ApplicationController
respond_to :json
def index
@playlists = Playlist.all
end

View File

@ -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'

View File

@ -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

View File

@ -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.

View File

@ -2,4 +2,4 @@
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Scube::Application.initialize!
Rails.application.initialize!

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 )

View File

@ -0,0 +1,3 @@
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json

View File

@ -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

View File

@ -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'

View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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')

View File

@ -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

View File

@ -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"

View File

@ -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
}