From 3abda1db8e5d67cacc64a6ccf762a98dbb03a2df Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 1 Apr 2014 03:40:51 +0000 Subject: [PATCH 01/11] Ignore Gemfile.lock --- .gitignore | 1 + Gemfile.lock | 151 --------------------------------------------------- 2 files changed, 1 insertion(+), 151 deletions(-) delete mode 100644 Gemfile.lock diff --git a/.gitignore b/.gitignore index 9a889e3..75308ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /Gemfile-custom.rb +/Gemfile.lock /config/database.yml /data/ /log/*.log diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 5b680eb..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,151 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - actionmailer (3.2.2) - actionpack (= 3.2.2) - mail (~> 2.4.0) - actionpack (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.1) - rack (~> 1.4.0) - rack-cache (~> 1.1) - rack-test (~> 0.6.1) - sprockets (~> 2.1.2) - activemodel (3.2.2) - activesupport (= 3.2.2) - builder (~> 3.0.0) - activerecord (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.2) - activemodel (= 3.2.2) - activesupport (= 3.2.2) - activesupport (3.2.2) - i18n (~> 0.6) - multi_json (~> 1.0) - arel (3.0.2) - bcrypt-ruby (3.0.1) - builder (3.0.0) - capybara (1.1.2) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 0.1.4) - childprocess (0.3.1) - ffi (~> 1.0.6) - diff-lcs (1.1.3) - erubis (2.7.0) - factory_girl (2.6.4) - activesupport (>= 2.3.9) - factory_girl_rails (1.7.0) - factory_girl (~> 2.6.0) - railties (>= 3.0.0) - ffi (1.0.11) - guard (0.10.0) - ffi (>= 0.5.0) - thor (~> 0.14.6) - guard-rspec (0.6.0) - guard (>= 0.10.0) - guard-spork (0.5.2) - guard (>= 0.10.0) - spork (>= 0.8.4) - haml (3.1.4) - hike (1.2.1) - i18n (0.6.0) - journey (1.0.3) - json (1.6.5) - mail (2.4.4) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.17.2) - multi_json (1.1.0) - nokogiri (1.5.2) - pg (0.13.2) - polyglot (0.3.3) - rabl (0.6.1) - activesupport (>= 2.3.14) - multi_json (~> 1.1.0) - rack (1.4.1) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.2) - rack - rack-test (0.6.1) - rack (>= 1.0) - rails (3.2.2) - actionmailer (= 3.2.2) - actionpack (= 3.2.2) - activerecord (= 3.2.2) - activeresource (= 3.2.2) - activesupport (= 3.2.2) - bundler (~> 1.0) - railties (= 3.2.2) - railties (3.2.2) - actionpack (= 3.2.2) - activesupport (= 3.2.2) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.6) - rake (0.9.2.2) - rdoc (3.12) - json (~> 1.4) - rspec (2.9.0) - rspec-core (~> 2.9.0) - rspec-expectations (~> 2.9.0) - rspec-mocks (~> 2.9.0) - rspec-core (2.9.0) - rspec-expectations (2.9.0) - diff-lcs (~> 1.1.3) - rspec-mocks (2.9.0) - rspec-rails (2.9.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec (~> 2.9.0) - rubyzip (0.9.6.1) - selenium-webdriver (2.20.0) - childprocess (>= 0.2.5) - ffi (~> 1.0) - multi_json (~> 1.0) - rubyzip - shoulda-matchers (1.0.0) - spork (0.9.0) - sprockets (2.1.2) - hike (~> 1.2) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - thor (0.14.6) - tilt (1.3.3) - treetop (1.4.10) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.32) - xpath (0.1.4) - nokogiri (~> 1.3) - -PLATFORMS - ruby - -DEPENDENCIES - bcrypt-ruby (~> 3.0) - capybara (~> 1.1) - factory_girl_rails (~> 1.2) - guard (~> 0.8) - guard-rspec (~> 0.4) - guard-spork (~> 0.2) - haml (~> 3.1) - pg (~> 0.11) - rabl (~> 0.6) - rails (~> 3.1) - rspec-rails (~> 2.6) - shoulda-matchers (~> 1.0) - spork (~> 0.9.0.rc) From 8a37fde85cb1f326828c636f3e565f2161d02f5f Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 1 Apr 2014 03:41:03 +0000 Subject: [PATCH 02/11] Fix name for bcrypt dependency --- Gemfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index b342d33..0dff75f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,10 @@ source 'http://rubygems.org' -gem 'rails', '~> 3.1' -gem 'pg', '~> 0.11' -gem 'haml', '~> 3.1' -gem 'bcrypt-ruby', '~> 3.0' -gem 'rabl', '~> 0.6' +gem 'rails', '~> 3.1' +gem 'pg', '~> 0.11' +gem 'haml', '~> 3.1' +gem 'bcrypt', '~> 3.0' +gem 'rabl', '~> 0.6' group :development, :test do gem 'rspec-rails', '~> 2.6' From 51ff46e00b82093ffcf6b43bf964dacb14a55726 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 1 Apr 2014 03:42:54 +0000 Subject: [PATCH 03/11] Update pg gem --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 0dff75f..f7aef9d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'http://rubygems.org' gem 'rails', '~> 3.1' -gem 'pg', '~> 0.11' +gem 'pg', '~> 0.17' gem 'haml', '~> 3.1' gem 'bcrypt', '~> 3.0' gem 'rabl', '~> 0.6' From edef2df77b0f1f91d67394c668b23a82a4292a31 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 1 Apr 2014 03:44:24 +0000 Subject: [PATCH 04/11] Update haml gem --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index f7aef9d..4d94239 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'http://rubygems.org' gem 'rails', '~> 3.1' gem 'pg', '~> 0.17' -gem 'haml', '~> 3.1' +gem 'haml', '~> 4.0' gem 'bcrypt', '~> 3.0' gem 'rabl', '~> 0.6' From c1eaf98c02b092d8eeefee42814fc9d1334b1632 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 1 Apr 2014 04:52:09 +0000 Subject: [PATCH 05/11] Update for latest RABL version: * Fix controller specs to also render RABL views where needed. --- spec/controllers/api/playlists_controller_spec.rb | 2 ++ spec/controllers/api/tracks_controller_spec.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/spec/controllers/api/playlists_controller_spec.rb b/spec/controllers/api/playlists_controller_spec.rb index a413a8e..3e34a5f 100644 --- a/spec/controllers/api/playlists_controller_spec.rb +++ b/spec/controllers/api/playlists_controller_spec.rb @@ -8,6 +8,8 @@ describe API::PlaylistsController do end describe 'GET index' do + render_views + before do playlist_1 = Factory.create(:playlist, :name => 'Playlist 1') playlist_2 = Factory.create(:playlist, :name => 'Playlist 2') diff --git a/spec/controllers/api/tracks_controller_spec.rb b/spec/controllers/api/tracks_controller_spec.rb index 512bd78..2783f71 100644 --- a/spec/controllers/api/tracks_controller_spec.rb +++ b/spec/controllers/api/tracks_controller_spec.rb @@ -8,6 +8,8 @@ describe API::TracksController do end describe 'GET index' do + render_views + before do Factory.create(:track_with_sound) Factory.create(:track_with_sound) From d2b332215ed67170d1fa618ffc59f58068bf0a85 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 1 Apr 2014 04:58:39 +0000 Subject: [PATCH 06/11] Remove incorrect mock() usage in specs --- spec/models/track_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/track_spec.rb b/spec/models/track_spec.rb index 0a90b98..62e4ecf 100644 --- a/spec/models/track_spec.rb +++ b/spec/models/track_spec.rb @@ -24,7 +24,7 @@ describe Track do describe '#file=' do it 'builds a new related sound with the file' do - sounds = mock('sounds association proxy') + sounds = double 'sounds association proxy' track.stub(:sounds => sounds) sounds.should_receive(:build).with({:file => file}) track.file = file From eda2f3fbee232e1119e320df52f107161c38c976 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 1 Apr 2014 05:04:27 +0000 Subject: [PATCH 07/11] Update factory girl to last version --- Gemfile | 2 +- spec/controllers/api/playlists_controller_spec.rb | 6 +++--- spec/controllers/api/sessions_controller_spec.rb | 2 +- spec/controllers/api/tracks_controller_spec.rb | 4 ++-- spec/controllers/application_controller_spec.rb | 2 +- spec/controllers/home_controller_spec.rb | 6 +++--- spec/controllers/playlists_controller_spec.rb | 8 ++++---- spec/controllers/sessions_controller_spec.rb | 2 +- spec/controllers/sounds_controller_spec.rb | 2 +- spec/controllers/tracks_controller_spec.rb | 4 ++-- spec/controllers/users_controller_spec.rb | 6 +++--- spec/integration/api/api_sign_in_spec.rb | 2 +- spec/integration/api/cross_origin_request_spec.rb | 2 +- spec/integration/api/playlists_spec.rb | 2 +- spec/integration/api/tracks_spec.rb | 4 ++-- spec/integration/home_spec.rb | 6 +++--- spec/integration/playlists_spec.rb | 6 +++--- spec/integration/tracks_spec.rb | 4 ++-- spec/integration/user_sign_in_spec.rb | 2 +- spec/integration/user_sign_up_spec.rb | 2 +- spec/models/playlist_spec.rb | 2 +- spec/models/sound_spec.rb | 4 ++-- spec/models/track_spec.rb | 12 ++++++------ spec/models/user_spec.rb | 6 +++--- spec/support/user_controllers_helpers.rb | 2 +- spec/support/user_integration_helpers.rb | 4 ++-- spec/views/tracks/show.html.haml_spec.rb | 4 ++-- spec/views/users/new.html.haml_spec.rb | 4 ++-- 28 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Gemfile b/Gemfile index 4d94239..7813f84 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,7 @@ gem 'rabl', '~> 0.6' group :development, :test do gem 'rspec-rails', '~> 2.6' gem 'capybara', '~> 1.1' - gem 'factory_girl_rails', '~> 1.2' + gem 'factory_girl_rails', '~> 4.4' gem 'shoulda-matchers', '~> 1.0' end diff --git a/spec/controllers/api/playlists_controller_spec.rb b/spec/controllers/api/playlists_controller_spec.rb index 3e34a5f..4e4d5e8 100644 --- a/spec/controllers/api/playlists_controller_spec.rb +++ b/spec/controllers/api/playlists_controller_spec.rb @@ -11,8 +11,8 @@ describe API::PlaylistsController do render_views before do - playlist_1 = Factory.create(:playlist, :name => 'Playlist 1') - playlist_2 = Factory.create(:playlist, :name => 'Playlist 2') + playlist_1 = FactoryGirl.create(:playlist, :name => 'Playlist 1') + playlist_2 = FactoryGirl.create(:playlist, :name => 'Playlist 2') end def do_get @@ -37,7 +37,7 @@ describe API::PlaylistsController do def do_create post :create, :format => :json, - :playlist => Factory.attributes_for(:playlist) + :playlist => FactoryGirl.attributes_for(:playlist) end it 'creates a new playlist for the current user' do diff --git a/spec/controllers/api/sessions_controller_spec.rb b/spec/controllers/api/sessions_controller_spec.rb index c23aea3..37c2bd8 100644 --- a/spec/controllers/api/sessions_controller_spec.rb +++ b/spec/controllers/api/sessions_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe API::SessionsController do describe 'POST create' do - let(:user) { Factory.create(:user) } + let(:user) { FactoryGirl.create(:user) } def do_create post :create, :format => :json, :session => { diff --git a/spec/controllers/api/tracks_controller_spec.rb b/spec/controllers/api/tracks_controller_spec.rb index 2783f71..e9539eb 100644 --- a/spec/controllers/api/tracks_controller_spec.rb +++ b/spec/controllers/api/tracks_controller_spec.rb @@ -11,8 +11,8 @@ describe API::TracksController do render_views before do - Factory.create(:track_with_sound) - Factory.create(:track_with_sound) + FactoryGirl.create(:track_with_sound) + FactoryGirl.create(:track_with_sound) end def do_get diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 18946ba..66485db 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe ApplicationController do - let(:user) { Factory.create(:user) } + let(:user) { FactoryGirl.create(:user) } describe '#current_user=' do it 'stores the user id in the session as :user_id' do diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index 4cef034..f96a542 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -9,14 +9,14 @@ describe HomeController do describe 'GET index' do it 'assigns all playlists as @playlists' do - playlist = Factory.create(:playlist) + playlist = FactoryGirl.create(:playlist) get :index assigns[:playlists].should == [playlist] end it 'assigns latest tracks as @tracks' do - track1 = Factory.create(:track, :created_at => '2011-07-27 19:13:42') - track2 = Factory.create(:track, :created_at => '2011-07-27 19:58:57') + track1 = FactoryGirl.create(:track, :created_at => '2011-07-27 19:13:42') + track2 = FactoryGirl.create(:track, :created_at => '2011-07-27 19:58:57') get :index assigns[:tracks].should == Track.latest end diff --git a/spec/controllers/playlists_controller_spec.rb b/spec/controllers/playlists_controller_spec.rb index 27ba1a9..ca0fa0f 100644 --- a/spec/controllers/playlists_controller_spec.rb +++ b/spec/controllers/playlists_controller_spec.rb @@ -9,7 +9,7 @@ describe PlaylistsController do describe 'GET index' do it 'assigns all playlists as @playlists' do - playlist = Factory.create(:playlist) + playlist = FactoryGirl.create(:playlist) get :index assigns[:playlists].should == [playlist] end @@ -24,7 +24,7 @@ describe PlaylistsController do describe 'GET edit' do it 'assigns the requested playlist as @playlist' do - playlist = Factory.create(:playlist) + playlist = FactoryGirl.create(:playlist) get :edit, :id => playlist.id.to_s assigns[:playlist].should == playlist end @@ -32,7 +32,7 @@ describe PlaylistsController do describe 'POST create' do def do_create - post :create, :playlist => Factory.attributes_for(:playlist) + post :create, :playlist => FactoryGirl.attributes_for(:playlist) end context 'whith valid params' do @@ -64,7 +64,7 @@ describe PlaylistsController do end describe 'PUT update' do - let (:playlist) { Factory.create(:playlist) } + let (:playlist) { FactoryGirl.create(:playlist) } def do_update put :update, :id => playlist.id.to_s, :playlist => { :name => 'Rock' } diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index e5d7337..ea66bbf 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -8,7 +8,7 @@ describe SessionsController do end describe 'POST create' do - let(:user) { Factory.create(:user) } + let(:user) { FactoryGirl.create(:user) } def do_create post :create, :session => { diff --git a/spec/controllers/sounds_controller_spec.rb b/spec/controllers/sounds_controller_spec.rb index 69b2129..d64419b 100644 --- a/spec/controllers/sounds_controller_spec.rb +++ b/spec/controllers/sounds_controller_spec.rb @@ -8,7 +8,7 @@ describe SoundsController do end describe 'GET show' do - let(:sound) { Factory.create(:sound) } + let(:sound) { FactoryGirl.create(:sound) } def do_show get :show, :id => sound.id diff --git a/spec/controllers/tracks_controller_spec.rb b/spec/controllers/tracks_controller_spec.rb index 4e3a87a..e203fd8 100644 --- a/spec/controllers/tracks_controller_spec.rb +++ b/spec/controllers/tracks_controller_spec.rb @@ -9,7 +9,7 @@ describe TracksController do describe 'GET show' do it 'assigns the requested track as @track' do - track = Factory.create(:track) + track = FactoryGirl.create(:track) get :show, :id => track.id.to_s assigns[:track].should == track end @@ -24,7 +24,7 @@ describe TracksController do describe 'POST create new' do def do_create - post :create, :track => Factory.attributes_for(:track).merge({ + post :create, :track => FactoryGirl.attributes_for(:track).merge({ :file => fixture_file_upload( "#{Rails.root}/spec/fixtures/test.mp3", 'audio/mpeg' diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index fbf39a7..e64b606 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -12,17 +12,17 @@ describe UsersController do context 'whith valid params' do it 'creates a new user' do expect { - post :create, :user => Factory.attributes_for(:user) + post :create, :user => FactoryGirl.attributes_for(:user) }.to change(User, :count).by(1) end it 'signs the user in' do - post :create, :user => Factory.attributes_for(:user) + post :create, :user => FactoryGirl.attributes_for(:user) controller.current_user.should_not be_nil end it 'redirects to the home page' do - post :create, :user => Factory.attributes_for(:user) + post :create, :user => FactoryGirl.attributes_for(:user) response.should redirect_to(:root) end end diff --git a/spec/integration/api/api_sign_in_spec.rb b/spec/integration/api/api_sign_in_spec.rb index 5ab63af..bdf3c1b 100644 --- a/spec/integration/api/api_sign_in_spec.rb +++ b/spec/integration/api/api_sign_in_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' feature 'API sign in' do - let(:user) { Factory.create(:user) } + let(:user) { FactoryGirl.create(:user) } def do_create post api_sessions_path, :format => :json, :session => { diff --git a/spec/integration/api/cross_origin_request_spec.rb b/spec/integration/api/cross_origin_request_spec.rb index a17fde2..5fb52ca 100644 --- a/spec/integration/api/cross_origin_request_spec.rb +++ b/spec/integration/api/cross_origin_request_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' feature 'API cross origin request' do include UserIntegrationHelpers - let(:user) { Factory.create(:user) } + let(:user) { FactoryGirl.create(:user) } let(:origin) { 'http://origin.example/' } background do diff --git a/spec/integration/api/playlists_spec.rb b/spec/integration/api/playlists_spec.rb index 024b922..96b4456 100644 --- a/spec/integration/api/playlists_spec.rb +++ b/spec/integration/api/playlists_spec.rb @@ -8,7 +8,7 @@ feature 'API playlists' do end scenario 'creates playlist' do - playlist = Factory.attributes_for :playlist + playlist = FactoryGirl.attributes_for :playlist post api_playlists_path, :format => :json, diff --git a/spec/integration/api/tracks_spec.rb b/spec/integration/api/tracks_spec.rb index 54432c5..1bd5977 100644 --- a/spec/integration/api/tracks_spec.rb +++ b/spec/integration/api/tracks_spec.rb @@ -8,8 +8,8 @@ feature 'API tracks' do end scenario 'lists tracks' do - track_1 = Factory.create(:track_with_sound, :name => 'Track 1') - track_2 = Factory.create(:track, :name => 'Track 2') + track_1 = FactoryGirl.create(:track_with_sound, :name => 'Track 1') + track_2 = FactoryGirl.create(:track, :name => 'Track 2') get api_tracks_path, :format => :json diff --git a/spec/integration/home_spec.rb b/spec/integration/home_spec.rb index 70a741f..5693083 100644 --- a/spec/integration/home_spec.rb +++ b/spec/integration/home_spec.rb @@ -8,7 +8,7 @@ feature 'Home page' do end scenario 'displays playlists' do - playlist = Factory.create(:playlist, :name => 'Electro') + playlist = FactoryGirl.create(:playlist, :name => 'Electro') visit root_path @@ -16,11 +16,11 @@ feature 'Home page' do end scenario 'displays last track added' do - Factory.create(:track, + FactoryGirl.create(:track, :name => 'Mega song 1', :created_at => '2011-07-27 19:13:42' ) - Factory.create(:track, + FactoryGirl.create(:track, :name => 'Mega song 2', :created_at => '2011-07-27 19:58:57' ) diff --git a/spec/integration/playlists_spec.rb b/spec/integration/playlists_spec.rb index b4fee6b..0aa8a49 100644 --- a/spec/integration/playlists_spec.rb +++ b/spec/integration/playlists_spec.rb @@ -8,8 +8,8 @@ feature 'Playlists' do end scenario 'lists playlists' do - Factory.create(:playlist, :name => 'Electro') - Factory.create(:playlist, :name => 'Reggae') + FactoryGirl.create(:playlist, :name => 'Electro') + FactoryGirl.create(:playlist, :name => 'Reggae') visit playlists_path @@ -28,7 +28,7 @@ feature 'Playlists' do end scenario 'edits playlist' do - Factory.create(:playlist, :name => 'Electro') + FactoryGirl.create(:playlist, :name => 'Electro') visit playlists_path click_link 'Electro' diff --git a/spec/integration/tracks_spec.rb b/spec/integration/tracks_spec.rb index 2d960c8..ca8a158 100644 --- a/spec/integration/tracks_spec.rb +++ b/spec/integration/tracks_spec.rb @@ -8,7 +8,7 @@ feature 'Tracks' do end scenario 'shows track' do - track = Factory.create(:track, :name => 'Mega song') + track = FactoryGirl.create(:track, :name => 'Mega song') visit track_path(track) @@ -28,7 +28,7 @@ feature 'Tracks' do end scenario 'plays track' do - track = Factory.create(:track_with_sound) + track = FactoryGirl.create(:track_with_sound) visit track_path(track) diff --git a/spec/integration/user_sign_in_spec.rb b/spec/integration/user_sign_in_spec.rb index badb00c..781999b 100644 --- a/spec/integration/user_sign_in_spec.rb +++ b/spec/integration/user_sign_in_spec.rb @@ -8,7 +8,7 @@ feature 'User sign in' do end scenario 'signs the user in' do - user = Factory.create(:user) + user = FactoryGirl.create(:user) visit new_session_path fill_in 'Email', :with => user.email diff --git a/spec/integration/user_sign_up_spec.rb b/spec/integration/user_sign_up_spec.rb index c32287d..d69a5a2 100644 --- a/spec/integration/user_sign_up_spec.rb +++ b/spec/integration/user_sign_up_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' feature 'User sign up' do - let(:user) { Factory.build(:user) } + let(:user) { FactoryGirl.build(:user) } background do visit new_user_path diff --git a/spec/models/playlist_spec.rb b/spec/models/playlist_spec.rb index 1c1bb07..d3a3e17 100644 --- a/spec/models/playlist_spec.rb +++ b/spec/models/playlist_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Playlist do subject { playlist } - let(:playlist) { Factory.build(:playlist) } + let(:playlist) { FactoryGirl.build(:playlist) } it { should be_valid } it { should belong_to :user } diff --git a/spec/models/sound_spec.rb b/spec/models/sound_spec.rb index 9f110de..758660b 100644 --- a/spec/models/sound_spec.rb +++ b/spec/models/sound_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Sound do subject { sound } - let(:sound) { Factory.build(:sound) } + let(:sound) { FactoryGirl.build(:sound) } it { should be_valid } it { should belong_to :track } @@ -20,7 +20,7 @@ describe Sound do end describe '#file=' do - let (:file) { Factory.attributes_for(:sound)[:file] } + let (:file) { FactoryGirl.attributes_for(:sound)[:file] } it 'saves the file SHA256 digest' do sound.sha256.should == Digest::SHA256.file(file.path).hexdigest diff --git a/spec/models/track_spec.rb b/spec/models/track_spec.rb index 62e4ecf..e9a340d 100644 --- a/spec/models/track_spec.rb +++ b/spec/models/track_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe Track do subject { track } - let(:track) { Factory.build(:track) } - let(:file) { Factory.attributes_for(:track_with_sound)[:file] } + let(:track) { FactoryGirl.build(:track) } + let(:file) { FactoryGirl.attributes_for(:track_with_sound)[:file] } it { should be_valid } it { should have_many :sounds } @@ -34,7 +34,7 @@ describe Track do describe '#sound' do context 'with a sound' do before do - track.sounds << Factory.create(:sound) + track.sounds << FactoryGirl.create(:sound) end it 'returns a sound' do @@ -52,7 +52,7 @@ describe Track do context 'with a sound' do before do - track.sounds << Factory.create(:sound) + track.sounds << FactoryGirl.create(:sound) end it 'returns true' do @@ -63,8 +63,8 @@ describe Track do describe '.latest' do it 'returns latest tracks in descending creation date order' do - track1 = Factory.create(:track, :created_at => '2011-07-27 19:13:42') - track2 = Factory.create(:track, :created_at => '2011-07-27 19:58:57') + track1 = FactoryGirl.create(:track, :created_at => '2011-07-27 19:13:42') + track2 = FactoryGirl.create(:track, :created_at => '2011-07-27 19:58:57') Track.latest.should == [track2, track1] end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index b092228..ae2fae0 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe User do subject { user } - let(:user) { Factory.build(:user) } + let(:user) { FactoryGirl.build(:user) } it { should be_valid } it { should have_many :playlists } @@ -12,8 +12,8 @@ describe User do it { should_not allow_mass_assignment_of :password_hash } context 'when a user with the same email address already exists' do - let(:old_user) { Factory.create(:user, :email => 'unique@example.net') } - subject { Factory.build(:user, :email => old_user.email) } + let(:old_user) { FactoryGirl.create(:user, :email => 'unique@example.net') } + subject { FactoryGirl.build(:user, :email => old_user.email) } it { should_not be_valid } diff --git a/spec/support/user_controllers_helpers.rb b/spec/support/user_controllers_helpers.rb index f8569f2..58a1c7e 100644 --- a/spec/support/user_controllers_helpers.rb +++ b/spec/support/user_controllers_helpers.rb @@ -1,5 +1,5 @@ module UserControllerHelpers def sign_in - controller.current_user = Factory.create(:user) + controller.current_user = FactoryGirl.create(:user) end end diff --git a/spec/support/user_integration_helpers.rb b/spec/support/user_integration_helpers.rb index 5336be8..5d1d8a9 100644 --- a/spec/support/user_integration_helpers.rb +++ b/spec/support/user_integration_helpers.rb @@ -1,6 +1,6 @@ module UserIntegrationHelpers def sign_in - user = Factory.create(:user) + user = FactoryGirl.create(:user) visit new_session_path fill_in 'Email', :with => user.email fill_in 'Password', :with => user.password @@ -8,7 +8,7 @@ module UserIntegrationHelpers end def api_sign_in - user = Factory.create :user + user = FactoryGirl.create :user post api_sessions_path, :format => :json, :session => { :email => user.email, diff --git a/spec/views/tracks/show.html.haml_spec.rb b/spec/views/tracks/show.html.haml_spec.rb index aab3a12..4d956df 100644 --- a/spec/views/tracks/show.html.haml_spec.rb +++ b/spec/views/tracks/show.html.haml_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe 'tracks/show' do - let(:track) { Factory.create(:track) } + let(:track) { FactoryGirl.create(:track) } before do assign :track, track @@ -13,7 +13,7 @@ describe 'tracks/show' do end context 'when track has a sound' do - let(:track) { Factory.create(:track_with_sound) } + let(:track) { FactoryGirl.create(:track_with_sound) } it 'provides an audio stream for the track' do render diff --git a/spec/views/users/new.html.haml_spec.rb b/spec/views/users/new.html.haml_spec.rb index 04c5a66..a13c50a 100644 --- a/spec/views/users/new.html.haml_spec.rb +++ b/spec/views/users/new.html.haml_spec.rb @@ -48,8 +48,8 @@ describe 'users/new' do context 'when the user has some validation errors' do it 'on the email address uniqueness' do - user = Factory.create(:user, :email => 'unique@example.net') - new_user = Factory.build(:user, :email => user.email) + user = FactoryGirl.create(:user, :email => 'unique@example.net') + new_user = FactoryGirl.build(:user, :email => user.email) new_user.save assign :user, new_user render From 97c64d0990be1a68ffce6405a2b38665e7efafee Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 1 Apr 2014 05:18:19 +0000 Subject: [PATCH 08/11] Update capybara to last version --- Gemfile | 2 +- spec/{integration => features}/home_spec.rb | 0 spec/{integration => features}/playlists_spec.rb | 0 spec/{integration => features}/tracks_spec.rb | 0 spec/{integration => features}/user_sign_in_spec.rb | 0 spec/{integration => features}/user_sign_up_spec.rb | 0 6 files changed, 1 insertion(+), 1 deletion(-) rename spec/{integration => features}/home_spec.rb (100%) rename spec/{integration => features}/playlists_spec.rb (100%) rename spec/{integration => features}/tracks_spec.rb (100%) rename spec/{integration => features}/user_sign_in_spec.rb (100%) rename spec/{integration => features}/user_sign_up_spec.rb (100%) diff --git a/Gemfile b/Gemfile index 7813f84..231ae64 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'rabl', '~> 0.6' group :development, :test do gem 'rspec-rails', '~> 2.6' - gem 'capybara', '~> 1.1' + gem 'capybara', '~> 2.2' gem 'factory_girl_rails', '~> 4.4' gem 'shoulda-matchers', '~> 1.0' end diff --git a/spec/integration/home_spec.rb b/spec/features/home_spec.rb similarity index 100% rename from spec/integration/home_spec.rb rename to spec/features/home_spec.rb diff --git a/spec/integration/playlists_spec.rb b/spec/features/playlists_spec.rb similarity index 100% rename from spec/integration/playlists_spec.rb rename to spec/features/playlists_spec.rb diff --git a/spec/integration/tracks_spec.rb b/spec/features/tracks_spec.rb similarity index 100% rename from spec/integration/tracks_spec.rb rename to spec/features/tracks_spec.rb diff --git a/spec/integration/user_sign_in_spec.rb b/spec/features/user_sign_in_spec.rb similarity index 100% rename from spec/integration/user_sign_in_spec.rb rename to spec/features/user_sign_in_spec.rb diff --git a/spec/integration/user_sign_up_spec.rb b/spec/features/user_sign_up_spec.rb similarity index 100% rename from spec/integration/user_sign_up_spec.rb rename to spec/features/user_sign_up_spec.rb From 3253ddea9b6c4171ac092130ba6e853f2aeff173 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 1 Apr 2014 05:19:51 +0000 Subject: [PATCH 09/11] Update shoulda-matchers to last version --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 231ae64..0fa533a 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ group :development, :test do gem 'rspec-rails', '~> 2.6' gem 'capybara', '~> 2.2' gem 'factory_girl_rails', '~> 4.4' - gem 'shoulda-matchers', '~> 1.0' + gem 'shoulda-matchers', '~> 2.5' end eval File.read('Gemfile-custom.rb') if File.exist?('Gemfile-custom.rb') From bd39be32c5514b946b303709f9150d491675f2ea Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 1 Apr 2014 07:48:03 +0000 Subject: [PATCH 10/11] Make Sound#file attr_accessible --- app/models/sound.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/sound.rb b/app/models/sound.rb index 6dfd0d6..95378ef 100644 --- a/app/models/sound.rb +++ b/app/models/sound.rb @@ -3,6 +3,8 @@ require 'fileutils' class Sound < ActiveRecord::Base belongs_to :track + attr_accessible :file + validates_presence_of :sha256 validates_presence_of :mime_type From aa2b43ab425fb54759db4840ad0bdb62a0080d8e Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 1 Apr 2014 03:26:12 +0000 Subject: [PATCH 11/11] Update rails to 4.0: * Add protected_attributes gem dependency; * Remove deprecated usages of AR .find method; --- Gemfile | 4 +- bin/bundle | 4 ++ bin/rails | 5 ++ bin/rake | 5 ++ config/application.rb | 45 +------------ config/boot.rb | 4 +- config/environment.rb | 4 +- config/environments/development.rb | 30 +++------ config/environments/production.rb | 67 +++++++++++-------- config/environments/test.rb | 27 ++++---- .../initializers/filter_parameter_logging.rb | 4 ++ config/initializers/inflections.rb | 11 +-- config/initializers/secret_token.rb | 9 ++- config/initializers/session_store.rb | 7 +- config/initializers/wrap_parameters.rb | 8 +-- config/locales/en.yml | 22 +++++- script/rails | 6 -- .../api/application_controller_spec.rb | 8 +-- spec/features/tracks_spec.rb | 2 +- .../api/cross_origin_request_spec.rb | 5 +- spec/models/track_spec.rb | 2 + vendor/plugins/.gitkeep | 0 22 files changed, 138 insertions(+), 141 deletions(-) create mode 100755 bin/bundle create mode 100755 bin/rails create mode 100755 bin/rake create mode 100644 config/initializers/filter_parameter_logging.rb delete mode 100755 script/rails delete mode 100644 vendor/plugins/.gitkeep diff --git a/Gemfile b/Gemfile index 0fa533a..3e76968 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,13 @@ source 'http://rubygems.org' -gem 'rails', '~> 3.1' +gem 'rails', '~> 4.0' gem 'pg', '~> 0.17' gem 'haml', '~> 4.0' gem 'bcrypt', '~> 3.0' gem 'rabl', '~> 0.6' +gem 'protected_attributes', '~> 1.0' + group :development, :test do gem 'rspec-rails', '~> 2.6' gem 'capybara', '~> 2.2' diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 0000000..a169c9d --- /dev/null +++ b/bin/bundle @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby + +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails new file mode 100755 index 0000000..71755b8 --- /dev/null +++ b/bin/rails @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/bin/rake b/bin/rake new file mode 100755 index 0000000..8dbbadb --- /dev/null +++ b/bin/rake @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby + +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/config/application.rb b/config/application.rb index 23eecac..d6d9e6d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,12 +2,9 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' -if defined?(Bundler) - # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) - # If you want your assets lazily compiled in production, use this line - # Bundler.require(:default, :assets, Rails.env) -end +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) module Scube class Application < Rails::Application @@ -15,16 +12,6 @@ module Scube # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' @@ -32,31 +19,5 @@ 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 - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - - # BestStandardsSupport is setting this fucking X-UA-Compatible header... - config.middleware.delete ActionDispatch::BestStandardsSupport - - # Use SQL instead of Active Record's schema dumper when creating the database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Enforce whitelist mode for mass assignment. - # This will create an empty whitelist of attributes available for mass-assignment for all models - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible - # parameters by using an attr_accessible or attr_protected declaration. - # config.active_record.whitelist_attributes = true - - # Enable the asset pipeline - config.assets.enabled = true - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' end end diff --git a/config/boot.rb b/config/boot.rb index 4489e58..5e5f0c1 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,6 +1,4 @@ -require 'rubygems' - # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) diff --git a/config/environment.rb b/config/environment.rb index 0c0e08c..5eb742d 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ -# Load the rails application +# Load the Rails application. require File.expand_path('../application', __FILE__) -# Initialize the rails application +# Initialize the Rails application. Scube::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index c0c8692..45657fe 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,37 +1,29 @@ Scube::Application.configure do - # Settings specified here will take precedence over those in config/application.rb + # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true + # Do not eager load code on boot. + config.eager_load = false - # Show full error reports and disable caching + # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false - # Don't care if the mailer can't send + # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false - # Print deprecation notices to the Rails logger + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin + # Raise an error on page load if there are pending migrations + config.active_record.migration_error = :page_load - # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict - - # Log the query plan for queries taking more than this (works - # with SQLite, MySQL, and PostgreSQL) - config.active_record.auto_explain_threshold_in_seconds = 0.5 - - # Do not compress assets - config.assets.compress = false - - # Expands the lines which load the assets + # 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 end diff --git a/config/environments/production.rb b/config/environments/production.rb index 4e543cd..ea700d0 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,67 +1,80 @@ Scube::Application.configure do - # Settings specified here will take precedence over those in config/application.rb + # Settings specified here will take precedence over those in config/application.rb. - # Code is not reloaded between requests + # Code is not reloaded between requests. config.cache_classes = true - # Full error reports are disabled and caching is turned on + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both thread web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Disable Rails's static asset server (Apache or nginx will already do this) + # 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. + # config.action_dispatch.rack_cache = true + + # Disable Rails's static asset server (Apache or nginx will already do this). config.serve_static_assets = false - # Compress JavaScripts and CSS - config.assets.compress = true + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass - # Don't fallback to assets pipeline if a precompiled asset is missed + # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Generate digests for assets URLs + # Generate digests for assets URLs. config.assets.digest = true - # Defaults to Rails.root.join("public/assets") - # config.assets.manifest = YOUR_PATH + # Version of your assets, change this if you want to expire all your assets. + config.assets.version = '1.0' - # Specifies the header that your server uses for sending files + # 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 # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true - # See everything in the log (default is :info) - # config.log_level = :debug + # Set to :debug to see everything in the log. + config.log_level = :info - # Prepend all log lines with the following tags + # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] - # Use a different logger for distributed setups + # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) - # Use a different cache store in production + # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset server + # 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 are already added) + # 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 ) - # Disable delivery errors, bad email addresses will be ignored + # 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 threaded mode - # config.threadsafe! - # 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 can not be found). config.i18n.fallbacks = true - # Send deprecation notices to registered listeners + # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify - # Log the query plan for queries taking more than this (works - # with SQLite, MySQL, and PostgreSQL) - # config.active_record.auto_explain_threshold_in_seconds = 0.5 + # 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 end diff --git a/config/environments/test.rb b/config/environments/test.rb index 23f1ce1..70c5a9e 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,5 +1,5 @@ Scube::Application.configure do - # Settings specified here will take precedence over those in config/application.rb + # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that @@ -7,31 +7,30 @@ Scube::Application.configure do # and recreated between test runs. Don't rely on the data there! config.cache_classes = true - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # 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" - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true - - # Show full error reports and disable caching + # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false - # Raise exceptions instead of rendering exception templates + # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict - - # Print deprecation notices to the stderr + # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 54e3418..a541c76 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,16 +1,17 @@ # Be sure to restart your server when you modify this file. -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end -# + # These inflection rules are supported but not enabled by default: -# ActiveSupport::Inflector.inflections do |inflect| +# ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.acronym 'RESTful' # end diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index 6c1a798..0ddb815 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -1,7 +1,12 @@ # Be sure to restart your server when you modify this file. -# Your secret key for verifying the integrity of signed cookies. +# Your secret key is used for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! + # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -Scube::Application.config.secret_token = '1bc686843bfcf76e9ab8c057e11dbc14b9cec8574d4b189720223fc1faa18b4eadf98cb27fa8b4b224f373013ab3828c6874878a679b050c90ca839a5f731bfa' +# You can use `rake secret` to generate a secure secret key. + +# Make sure your secret_key_base is kept private +# if you're sharing your code publicly. +Scube::Application.config.secret_key_base = 'd0fb5028d03e9030435af05646555d948bbb65cef3910016c9dc34f5799a5bc6c8d41a248e02df21a27fef348eecc9dc5f9662dc277e0c17210a7cfc513200aa' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index d58609c..bc77e55 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,8 +1,3 @@ # Be sure to restart your server when you modify this file. -#Scube::Application.config.session_store :cookie_store, :key => '_scube_session' - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -Scube::Application.config.session_store :active_record_store +Scube::Application.config.session_store :cookie_store, key: '_scube_session' diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 999df20..a7b1b91 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -1,14 +1,14 @@ # Be sure to restart your server when you modify this file. -# + # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) end -# Disable root element in JSON by default. +# To enable root element in JSON for ActiveRecord objects. ActiveSupport.on_load(:active_record) do - self.include_root_in_json = false + self.include_root_in_json = true end diff --git a/config/locales/en.yml b/config/locales/en.yml index 179c14c..0653957 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,5 +1,23 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. en: hello: "Hello world" diff --git a/script/rails b/script/rails deleted file mode 100755 index f8da2cf..0000000 --- a/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' diff --git a/spec/controllers/api/application_controller_spec.rb b/spec/controllers/api/application_controller_spec.rb index 1fdac73..3e4c24e 100644 --- a/spec/controllers/api/application_controller_spec.rb +++ b/spec/controllers/api/application_controller_spec.rb @@ -9,7 +9,7 @@ describe API::ApplicationController do context 'CORS: Cross-Origin Ressource Sharing' do before do - request.env['Origin'] = 'http://origin.example/' + request.headers['Origin'] = 'http://origin.example/' end context 'preflight' do @@ -18,7 +18,7 @@ describe API::ApplicationController do end def options(action) - process action, nil, nil, nil, 'OPTIONS' + process action, 'OPTIONS' end it 'sets Access-Control-Allow-Methods header' do @@ -43,8 +43,8 @@ describe API::ApplicationController do it 'sets Access-Control-Allow-Origin header' do get :index - response.headers['Access-Control-Allow-Origin'].should == - request.env['Origin'] + response.headers['Access-Control-Allow-Origin'] + .should == request.headers['Origin'] end end end diff --git a/spec/features/tracks_spec.rb b/spec/features/tracks_spec.rb index ca8a158..ea070e5 100644 --- a/spec/features/tracks_spec.rb +++ b/spec/features/tracks_spec.rb @@ -23,7 +23,7 @@ feature 'Tracks' do attach_file 'File', File.expand_path('spec/fixtures/test.mp3') click_button 'Upload' - current_path.should == track_path(Track.find(:first)) + current_path.should == track_path(Track.first) page.should have_content('Mega song') end diff --git a/spec/integration/api/cross_origin_request_spec.rb b/spec/integration/api/cross_origin_request_spec.rb index 5fb52ca..cb9f59e 100644 --- a/spec/integration/api/cross_origin_request_spec.rb +++ b/spec/integration/api/cross_origin_request_spec.rb @@ -14,9 +14,8 @@ feature 'API cross origin request' do end scenario 'preflight request' do - # FIXME: replace with a more stable/generic action - # FIXME: request without redirect - request_via_redirect( + @integration_session.send( + :process, :options, api_playlists_path(:format => :json), nil, diff --git a/spec/models/track_spec.rb b/spec/models/track_spec.rb index e9a340d..cdf9718 100644 --- a/spec/models/track_spec.rb +++ b/spec/models/track_spec.rb @@ -15,6 +15,8 @@ describe Track do track.file = file end + it { should be_valid } + it 'creates a sound for the track' do expect { track.save diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep deleted file mode 100644 index e69de29..0000000