Skip to content

Commit

Permalink
Updating to Rails 4.1.8 for #114
Browse files Browse the repository at this point in the history
Can't make use of the secrets.yml yet until the deployment and
environments change to have the ENV variable.
State machine needed the around validation extension to be compatible
with active record 4.1.
All the JS ajax tests had to explicitly change to be xhr requests
instead of regular get or posts.
Remove the none scope from session as AR now includes by default for all
models.
  • Loading branch information
Hugo Corbucci committed Dec 22, 2014
1 parent 600f2cc commit 47d86fc
Show file tree
Hide file tree
Showing 36 changed files with 80 additions and 61 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def darwin_only(require_as)
RbConfig::CONFIG['host_os'] =~ /darwin/ ? require_as : false
end

gem 'rails', '4.0.12' # Issue #114 - 4.1.8 is target
gem 'rails', '4.1.8' # Issue #114 - 4.2.0 is target
gem 'haml', '4.0.6'
gem 'will_paginate', '3.0.7'
gem 'formtastic', '3.1.2'
Expand All @@ -32,7 +32,7 @@ gem 'mysql2', '0.3.17'
gem 'doorkeeper', '2.0.1'
gem 'newrelic_rpm', '3.9.8.273'

gem 'jquery-rails', '3.1.2'
gem 'jquery-rails', '3.1.2' # 4.0.2 needs rails 4.2.0
gem 'sass-rails', '5.0.0'
gem 'coffee-rails', '4.1.0'
gem 'jquery-ui-rails', '5.0.3'
Expand Down
71 changes: 38 additions & 33 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,40 @@ GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.9)
actionmailer (4.0.12)
actionpack (= 4.0.12)
actionmailer (4.1.8)
actionpack (= 4.1.8)
actionview (= 4.1.8)
mail (~> 2.5, >= 2.5.4)
actionpack (4.0.12)
activesupport (= 4.0.12)
builder (~> 3.1.0)
erubis (~> 2.7.0)
actionpack (4.1.8)
actionview (= 4.1.8)
activesupport (= 4.1.8)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.12)
activesupport (= 4.0.12)
builder (~> 3.1.0)
activerecord (4.0.12)
activemodel (= 4.0.12)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.12)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.12)
actionview (4.1.8)
activesupport (= 4.1.8)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.8)
activesupport (= 4.1.8)
builder (~> 3.1)
activerecord (4.1.8)
activemodel (= 4.1.8)
activesupport (= 4.1.8)
arel (~> 5.0.0)
activesupport (4.1.8)
i18n (~> 0.6, >= 0.6.9)
minitest (~> 4.2)
multi_json (~> 1.3)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
tzinfo (~> 1.1)
acts-as-taggable-on (3.4.2)
activerecord (>= 3.2, < 5)
acts_as_commentable (4.0.2)
addressable (2.3.6)
airbrake (4.1.0)
builder
multi_json
arel (4.0.2)
arel (5.0.1.20140414130214)
aws-ses (0.6.0)
builder
mail (> 2.2.5)
Expand All @@ -61,7 +63,7 @@ GEM
brhelper (3.3.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
builder (3.1.4)
builder (3.2.2)
bullet (4.14.0)
activesupport (>= 3.0.0)
uniform_notifier (>= 1.6.0)
Expand Down Expand Up @@ -198,7 +200,7 @@ GEM
method_source (0.8.2)
mime-types (2.4.3)
mini_portile (0.6.1)
minitest (4.7.5)
minitest (5.5.0)
mocha (1.1.0)
metaclass (~> 0.0.1)
multi_json (1.10.1)
Expand All @@ -225,17 +227,19 @@ GEM
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.0.12)
actionmailer (= 4.0.12)
actionpack (= 4.0.12)
activerecord (= 4.0.12)
activesupport (= 4.0.12)
rails (4.1.8)
actionmailer (= 4.1.8)
actionpack (= 4.1.8)
actionview (= 4.1.8)
activemodel (= 4.1.8)
activerecord (= 4.1.8)
activesupport (= 4.1.8)
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.12)
railties (= 4.1.8)
sprockets-rails (~> 2.0)
railties (4.0.12)
actionpack (= 4.0.12)
activesupport (= 4.0.12)
railties (4.1.8)
actionpack (= 4.1.8)
activesupport (= 4.1.8)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
Expand Down Expand Up @@ -323,7 +327,8 @@ GEM
hitimes
travis-lint (2.0.0)
json
tzinfo (0.3.42)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.6.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
Expand Down Expand Up @@ -389,7 +394,7 @@ DEPENDENCIES
newrelic_rpm (= 3.9.8.273)
poltergeist
pry-rails
rails (= 4.0.12)
rails (= 4.1.8)
rb-fsevent
rb-inotify
rspec-collection_matchers
Expand Down
2 changes: 0 additions & 2 deletions app/models/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ class Session < ActiveRecord::Base
where(clause, *args)
}

scope :none, -> { where('1 = 0') }

scope :with_incomplete_final_reviews, -> { where('final_reviews_count < ?', 3) }
scope :with_incomplete_early_reviews, -> { where('early_reviews_count < ?', 1) }
scope :submitted_before, ->(date) { where('sessions.created_at <= ?', date) }
Expand Down
14 changes: 14 additions & 0 deletions config/initializers/state_machine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# encoding: UTF-8
# Rails 4.1.0.rc1 and StateMachine don't play nice
# https://github.com/pluginaweek/state_machine/issues/295
require 'state_machine/version'

unless StateMachine::VERSION == '1.2.0'
# If you see this message, please test removing this file
# If it's still required, please bump up the version above
Rails.logger.warn "Please remove me, StateMachine version has changed"
end

module StateMachine::Integrations::ActiveModel
public :around_validation
end
9 changes: 6 additions & 3 deletions spec/controllers/api/sessions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
end

it 'should respond to js as JS object as well' do
get :show, id: session.id.to_s, format: :js, locale: 'pt'
xhr :get, :show, format: :js, id: session.id.to_s,
locale: 'pt'

gravatar_id = Digest::MD5::hexdigest(session.author.email).downcase
expect(JSON.parse(response.body)).to eq({
Expand All @@ -109,7 +110,8 @@
end

it 'should respond to js with callback as JSONP if callback is provided' do
get :show, id: session.id.to_s, format: :js, locale: 'pt', callback: 'test'
xhr :get, :show, format: :js, id: session.id.to_s,
locale: 'pt', callback: 'test'

gravatar_id = Digest::MD5::hexdigest(session.author.email).downcase
expect(response.body).to match(/test\((.*)\)$/)
Expand All @@ -132,7 +134,8 @@
session.audience_limit = 100
session.save

get :show, id: session.id.to_s, format: :js, locale: 'pt', callback: 'test'
xhr :get, :show, format: :js, id: session.id.to_s,
locale: 'pt', callback: 'test'

gravatar_id = Digest::MD5::hexdigest(session.author.email).downcase
expect(response.body).to match(/test\((.*)\)$/)
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/review_decisions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
FactoryGirl.create(:session, track: @session.track, conference: @session.conference)
FactoryGirl.create(:rejected_decision, session: @session, organizer: @organizer.user)

get :index, format: 'js'
xhr :get, :index, format: :js
expect(response.body).to eq({
'required_decisions' => 2,
'total_decisions' => 1,
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/reviews_listing_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

FactoryGirl.create(:early_review, session: sessions[0])

get :index, format: 'js'
xhr :get, :index, format: :js

expect(response.body).to eq({
'required_reviews' => 2,
Expand All @@ -36,7 +36,7 @@
@conference.stubs(:in_early_review_phase?).returns(false)
FactoryGirl.create_list(:final_review, 2)

get :index, format: 'js'
xhr :get, :index, format: :js

expect(response.body).to eq({
'required_reviews' => 6,
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/tags_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
describe TagsController, type: :controller do
describe "#index", "with javascript format" do
before do
get :index, format: :js, term: 'sof'
xhr :get, :index, format: :js, term: 'sof'
end

subject { response }
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
describe "#index" do
describe "with javascript format" do
before do
get :index, format: :js, term: 'dt'
xhr :get, :index, format: :js, term: 'dt'
end

subject { response }
Expand Down
22 changes: 11 additions & 11 deletions spec/models/reviewer_filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,54 @@
require 'spec_helper'

describe ReviewerFilter, type: :model do
it_should_behave_like "ActiveModel"
it_should_behave_like 'ActiveModel'

describe "filtering by state" do
context "with param state" do
describe 'filtering by state' do
context 'with param state' do
subject { ReviewerFilter.new(reviewer_filter: {state: 'active'}) }

its(:state) { should == 'active' }
end

context "without param state" do
context 'without param state' do
subject { ReviewerFilter.new(reviewer_filter: {}) }

its(:state) { should be_nil }
end
end

describe "filtering by track" do
context "with param track_id" do
describe 'filtering by track' do
context 'with param track_id' do
subject { ReviewerFilter.new(reviewer_filter: {track_id: 8}) }

its(:track_id) { should == 8 }
end

context "without param track_id" do
context 'without param track_id' do
subject { ReviewerFilter.new(reviewer_filter: {}) }

its(:track_id) { should be_nil }
end
end

describe "apply scopes" do
it "should apply state scope when state is present" do
describe 'apply scopes' do
it 'should apply state scope when state is present' do
scope = mock('scope')
scope.expects(:with_state).with(:accepted)

filter = ReviewerFilter.new(reviewer_filter: {state: 'accepted'})
filter.apply(scope)
end

it "should apply track scope when track_id is present" do
it 'should apply track scope when track_id is present' do
scope = mock('scope')
scope.expects(:for_track).with('1')

filter = ReviewerFilter.new(reviewer_filter: {track_id: '1'})
filter.apply(scope)
end

it "should combine scopes" do
it 'should combine scopes' do
scope = mock('scope')
scope.expects(:for_track).with('1').returns(scope)
scope.expects(:with_state).with(:inactive).returns(scope)
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def self.notify(thing)
config.include(TrimmerMacros)
config.include(ValidatesExistenceMacros)

config.expect_with :rspec, :minitest
# == Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
Expand Down
8 changes: 3 additions & 5 deletions spec/support/active_model.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# encoding: utf-8
shared_examples_for "ActiveModel" do
require 'test/unit/assertions'
require 'active_model/lint'
include Test::Unit::Assertions
include ActiveModel::Lint::Tests

# to_s is to support ruby-1.9
ActiveModel::Lint::Tests.public_instance_methods.map{|m| m.to_s}.grep(/^test/).each do |m|
ActiveModel::Lint::Tests.public_instance_methods.
map(&:to_s).grep(/\Atest/).each do |m|
example m.gsub('_',' ') do
send m
end
Expand Down
Binary file removed vendor/cache/actionmailer-4.0.12.gem
Binary file not shown.
Binary file added vendor/cache/actionmailer-4.1.8.gem
Binary file not shown.
Binary file removed vendor/cache/actionpack-4.0.12.gem
Binary file not shown.
Binary file added vendor/cache/actionpack-4.1.8.gem
Binary file not shown.
Binary file added vendor/cache/actionview-4.1.8.gem
Binary file not shown.
Binary file removed vendor/cache/activemodel-4.0.12.gem
Binary file not shown.
Binary file added vendor/cache/activemodel-4.1.8.gem
Binary file not shown.
Binary file removed vendor/cache/activerecord-4.0.12.gem
Binary file not shown.
Binary file added vendor/cache/activerecord-4.1.8.gem
Binary file not shown.
Binary file not shown.
Binary file removed vendor/cache/activesupport-4.0.12.gem
Binary file not shown.
Binary file added vendor/cache/activesupport-4.1.8.gem
Binary file not shown.
Binary file removed vendor/cache/arel-4.0.2.gem
Binary file not shown.
Binary file added vendor/cache/arel-5.0.1.20140414130214.gem
Binary file not shown.
Binary file removed vendor/cache/builder-3.1.4.gem
Binary file not shown.
Binary file added vendor/cache/builder-3.2.2.gem
Binary file not shown.
Binary file removed vendor/cache/minitest-4.7.5.gem
Binary file not shown.
Binary file added vendor/cache/minitest-5.5.0.gem
Binary file not shown.
Binary file removed vendor/cache/rails-4.0.12.gem
Binary file not shown.
Binary file added vendor/cache/rails-4.1.8.gem
Binary file not shown.
Binary file removed vendor/cache/railties-4.0.12.gem
Binary file not shown.
Binary file added vendor/cache/railties-4.1.8.gem
Binary file not shown.
Binary file removed vendor/cache/tzinfo-0.3.42.gem
Binary file not shown.
Binary file added vendor/cache/tzinfo-1.2.2.gem
Binary file not shown.

0 comments on commit 47d86fc

Please sign in to comment.