From 9e9c53694655f28fb8e7fc4eda426f55c09602b3 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer Date: Mon, 25 Jan 2016 19:00:56 +0100 Subject: [PATCH] Update rails to version 4.2 Furthermore it was necessary to add the following gems: - responders - web-console And additional it was necessary to update these gems manually: - devise - turbolinks - delayed_job_active_record - money-rails And the corresponding dependencies. http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-4-1-to-rails-4-2 --- Gemfile | 7 +- Gemfile.lock | 156 +++++++++++++++++++++------------- INSTALL.md | 2 +- spec/features/tickets_spec.rb | 6 +- spec/models/ticket_spec.rb | 8 +- 5 files changed, 110 insertions(+), 69 deletions(-) diff --git a/Gemfile b/Gemfile index 9ce2873c..57d1a4e0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,11 @@ source 'https://rubygems.org' # as web framework -gem 'rails', '~> 4.1' +gem 'rails', '~> 4.2' + +# respond_to methods have been extracted to the responders gem +# http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#responders +gem 'responders', '~> 2.0' # as the database for Active Record gem 'mysql2' @@ -138,6 +142,7 @@ group :development do gem 'letter_opener' # mina is a blazing fast deployment system gem 'mina' + gem 'web-console', '~> 2.0' end # Use rspec and capybara as testing framework diff --git a/Gemfile.lock b/Gemfile.lock index 63921579..d205da32 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,35 +8,44 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.1.14) - actionpack (= 4.1.14) - actionview (= 4.1.14) + actionmailer (4.2.5.1) + actionpack (= 4.2.5.1) + actionview (= 4.2.5.1) + activejob (= 4.2.5.1) mail (~> 2.5, >= 2.5.4) - actionpack (4.1.14) - actionview (= 4.1.14) - activesupport (= 4.1.14) - rack (~> 1.5.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.5.1) + actionview (= 4.2.5.1) + activesupport (= 4.2.5.1) + rack (~> 1.6) rack-test (~> 0.6.2) - actionview (4.1.14) - activesupport (= 4.1.14) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.5.1) + activesupport (= 4.2.5.1) builder (~> 3.1) erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) active_model_serializers (0.8.1) activemodel (>= 3.0) - activemodel (4.1.14) - activesupport (= 4.1.14) + activejob (4.2.5.1) + activesupport (= 4.2.5.1) + globalid (>= 0.3.0) + activemodel (4.2.5.1) + activesupport (= 4.2.5.1) builder (~> 3.1) - activerecord (4.1.14) - activemodel (= 4.1.14) - activesupport (= 4.1.14) - arel (~> 5.0.0) - activesupport (4.1.14) - i18n (~> 0.6, >= 0.6.9) + activerecord (4.2.5.1) + activemodel (= 4.2.5.1) + activesupport (= 4.2.5.1) + arel (~> 6.0) + activesupport (4.2.5.1) + i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - activeuuid (0.5.0) + activeuuid (0.6.1) activerecord (>= 3.1) uuidtools acts_as_commentable_with_threading (1.2.0) @@ -54,7 +63,7 @@ GEM request_store user_agent_parser uuidtools - arel (5.0.1.20140414130214) + arel (6.0.3) ast (2.0.0) autoprefixer-rails (5.1.9) execjs @@ -69,6 +78,8 @@ GEM axlsx (>= 2.0.1) rails (>= 3.1) bcrypt (3.1.10) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) bootstrap-sass (3.3.4.1) autoprefixer-rails (>= 5.0.0.1) sass (>= 3.2.19) @@ -102,13 +113,13 @@ GEM climate_control (>= 0.0.3, < 1.0) cocoon (1.2.6) coderay (1.1.0) - coffee-rails (4.0.1) + coffee-rails (4.1.1) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) - coffee-script (2.2.0) + railties (>= 4.0.0, < 5.1.x) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.7.0) + coffee-script-source (1.10.0) columnize (0.8.9) countries (0.9.3) currencies (~> 0.4.2) @@ -123,13 +134,14 @@ GEM railties (>= 3.1.0) daemons (1.1.9) database_cleaner (1.3.0) + debug_inspector (0.0.2) debugger-linecache (1.2.0) - delayed_job (4.0.2) - activesupport (>= 3.0, < 4.2) - delayed_job_active_record (4.0.1) - activerecord (>= 3.0, < 4.2) - delayed_job (>= 3.0, < 4.1) - devise (3.5.4) + delayed_job (4.1.1) + activesupport (>= 3.0, < 5.0) + delayed_job_active_record (4.1.0) + activerecord (>= 3.0, < 5) + delayed_job (>= 3.0, < 5) + devise (3.5.5) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) @@ -141,7 +153,7 @@ GEM diff-lcs (1.2.5) docile (1.1.3) erubis (2.7.0) - execjs (2.5.2) + execjs (2.6.0) factory_girl (4.4.0) activesupport (>= 3.0.0) factory_girl_rails (4.4.1) @@ -158,6 +170,8 @@ GEM formtastic-bootstrap (3.0.0) formtastic (>= 2.2) geocoder (1.2.2) + globalid (0.3.6) + activesupport (>= 4.1.0) gravtastic (3.2.6) guard (2.6.0) formatador (>= 0.2.4) @@ -181,7 +195,7 @@ GEM activesupport builder htmlentities (4.3.1) - i18n (0.6.11) + i18n (0.7.0) inversion (0.12.3) loggability (~> 0.4) jquery-datatables-rails (2.2.3) @@ -203,6 +217,8 @@ GEM rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) loggability (0.11.0) + loofah (2.0.3) + nokogiri (>= 1.5.9) lumberjack (1.0.5) mail (2.6.3) mime-types (>= 1.16, < 3) @@ -212,18 +228,19 @@ GEM mina (0.3.0) open4 rake - mini_portile (0.6.0) - minitest (5.8.3) + mini_portile2 (2.0.0) + minitest (5.8.4) momentjs-rails (2.8.1) railties (>= 3.1) - monetize (0.3.0) - money (~> 6.1.0.beta1) - money (6.1.1) - i18n (~> 0.6.4) - money-rails (0.12.0) + monetize (1.4.0) + money (~> 6.7) + money (6.7.0) + i18n (>= 0.6.4, <= 0.7.0) + sixarm_ruby_unaccent (>= 1.1.1, < 2) + money-rails (1.6.0) activesupport (>= 3.0) - monetize (~> 0.3.0) - money (~> 6.1.1) + monetize (~> 1.4.0) + money (~> 6.7) railties (>= 3.0) multi_json (1.11.2) multi_xml (0.5.5) @@ -231,8 +248,8 @@ GEM mysql2 (0.3.16) netrc (0.10.3) nio4r (1.1.0) - nokogiri (1.6.2.1) - mini_portile (= 0.6.0) + nokogiri (1.6.7.2) + mini_portile2 (~> 2.0.0.rc2) oauth2 (0.9.4) faraday (>= 0.8, < 0.10) jwt (~> 1.0) @@ -296,27 +313,36 @@ GEM slop (~> 3.4) quiet_assets (1.0.2) railties (>= 3.1, < 5.0) - rack (1.5.5) + rack (1.6.4) rack-openid (1.3.1) rack (>= 1.1.0) ruby-openid (>= 2.1.8) rack-test (0.6.3) rack (>= 1.0) - rails (4.1.14) - actionmailer (= 4.1.14) - actionpack (= 4.1.14) - actionview (= 4.1.14) - activemodel (= 4.1.14) - activerecord (= 4.1.14) - activesupport (= 4.1.14) + rails (4.2.5.1) + actionmailer (= 4.2.5.1) + actionpack (= 4.2.5.1) + actionview (= 4.2.5.1) + activejob (= 4.2.5.1) + activemodel (= 4.2.5.1) + activerecord (= 4.2.5.1) + activesupport (= 4.2.5.1) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.14) - sprockets-rails (~> 2.0) + railties (= 4.2.5.1) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) rails-observers (0.1.2) activemodel (~> 4.0) - railties (4.1.14) - actionpack (= 4.1.14) - activesupport (= 4.1.14) + railties (4.2.5.1) + actionpack (= 4.2.5.1) + activesupport (= 4.2.5.1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.0.0) @@ -334,8 +360,8 @@ GEM redcarpet (3.2.3) referer-parser (0.2.1) request_store (1.0.6) - responders (1.1.2) - railties (>= 3.2, < 4.2) + responders (2.1.1) + railties (>= 4.2.0, < 5.1) rest-client (1.7.3) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) @@ -387,6 +413,7 @@ GEM multi_json simplecov-html (~> 0.8.0) simplecov-html (0.8.0) + sixarm_ruby_unaccent (1.1.1) slop (3.6.0) spring (1.1.2) spring-commands-rspec (1.0.2) @@ -411,7 +438,7 @@ GEM tins (1.1.0) transitions (0.1.12) ttfunk (1.1.1) - turbolinks (2.2.2) + turbolinks (2.5.3) coffee-rails tzinfo (1.2.2) thread_safe (~> 0.1) @@ -419,9 +446,14 @@ GEM execjs (>= 0.3.0) json (>= 1.8.0) user_agent_parser (2.1.5) - uuidtools (2.1.4) + uuidtools (2.1.5) warden (1.2.4) rack (>= 1.0) + web-console (2.2.1) + activemodel (>= 4.0) + binding_of_caller (>= 0.7.2) + railties (>= 4.0) + sprockets-rails (>= 2.0, < 4.0) websocket-driver (0.3.3) whenever (0.9.2) activesupport (>= 2.3.4) @@ -486,10 +518,11 @@ DEPENDENCIES poltergeist prawn_rails quiet_assets - rails (~> 4.1) + rails (~> 4.2) rails-observers rdoc-generator-fivefish redcarpet + responders (~> 2.0) rolify rspec-activemodel-mocks rspec-rails @@ -503,6 +536,7 @@ DEPENDENCIES transitions turbolinks uglifier (>= 1.3.0) + web-console (~> 2.0) whenever BUNDLED WITH diff --git a/INSTALL.md b/INSTALL.md index 7ef120ac..a44ac3a6 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -29,7 +29,7 @@ We are using [Vagrant](https://www.vagrantup.com/) to create our development env 7. Start your OSEM rails app: ``` - vagrant exec rails s + vagrant exec rails server -b 0.0.0.0 ``` 8. Check out your OSEM rails app: diff --git a/spec/features/tickets_spec.rb b/spec/features/tickets_spec.rb index b7bde589..de5b1220 100644 --- a/spec/features/tickets_spec.rb +++ b/spec/features/tickets_spec.rb @@ -52,7 +52,8 @@ feature Ticket do click_button 'Update Ticket' ticket.reload - expect(ticket.price).to eq(50) + # It's necessary to multiply by 100 because the price is in cents + expect(ticket.price).to eq(Money.new(50 * 100, 'USD')) expect(ticket.title).to eq('Free Ticket') expect(flash).to eq('Ticket successfully updated.') expect(Ticket.count).to eq(1) @@ -68,7 +69,8 @@ feature Ticket do click_button 'Update Ticket' ticket.reload - expect(ticket.price).to eq(100) + # It's necessary to multiply by 100 because the price is in cents + expect(ticket.price).to eq(Money.new(100 * 100, 'USD')) expect(ticket.title).to eq('Business Ticket') expect(flash).to eq("Ticket update failed: Title can't be blank. Price cents must be greater than 0.") expect(Ticket.count).to eq(1) diff --git a/spec/models/ticket_spec.rb b/spec/models/ticket_spec.rb index c093b072..2b673fbb 100644 --- a/spec/models/ticket_spec.rb +++ b/spec/models/ticket_spec.rb @@ -68,11 +68,11 @@ describe Ticket do user: user, ticket: ticket, quantity: 20) - expect(ticket.total_price(user)).to eq(20 * 50) + expect(ticket.total_price(user)).to eq(Money.new(20 * ticket.price_cents, 'USD')) end it 'returns zero if the user has not bought this ticket' do - expect(ticket.total_price(user)).to eq(0) + expect(ticket.total_price(user)).to eq(Money.new(0, 'USD')) end end @@ -82,11 +82,11 @@ describe Ticket do user: user, ticket: ticket, quantity: 20) - expect(Ticket.total_price(conference, user)).to eq(20 * 50) + expect(Ticket.total_price(conference, user)).to eq(Money.new(20 * ticket.price_cents, 'USD')) end it 'returns zero if the user has not bought this ticket' do - expect(Ticket.total_price(conference, user)).to eq(0) + expect(Ticket.total_price(conference, user)).to eq(Money.new(0, 'USD')) end end end