From e3b48ee60194b58c98cded485df4d936c5a4779d Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 12 Dec 2013 10:13:50 +0100 Subject: use the latest couchrest_session_store This one does not use our own error class for connection issues anymore. We'll remove that class in the next commit. So let's not rely on it. --- Gemfile.lock | 10 +++++----- core/leap_web_core.gemspec | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d1fd014..1c24bc6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -25,7 +25,7 @@ PATH leap_web_core (0.2.8) couchrest (~> 1.1.3) couchrest_model (~> 2.0.0) - couchrest_session_store (~> 0.2.2) + couchrest_session_store (~> 0.2.3) json rails (~> 3.2.11) @@ -105,12 +105,12 @@ GEM mime-types (~> 1.15) multi_json (~> 1.0) rest-client (~> 1.6.1) - couchrest_model (2.0.0) + couchrest_model (2.0.1) activemodel (>= 3.0) couchrest (~> 1.1.3) mime-types (>= 1.15) tzinfo (>= 0.3.22) - couchrest_session_store (0.2.2) + couchrest_session_store (0.2.3) actionpack couchrest couchrest_model @@ -145,7 +145,7 @@ GEM haml (~> 3.1) railties (>= 3.1, < 4.1) hike (1.2.3) - i18n (0.6.5) + i18n (0.6.9) journey (1.0.4) jquery-rails (3.0.4) railties (>= 3.0, < 5.0) @@ -162,7 +162,7 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) metaclass (0.0.1) - mime-types (1.25) + mime-types (1.25.1) mini_portile (0.5.1) mocha (0.13.3) metaclass (~> 0.0.1) diff --git a/core/leap_web_core.gemspec b/core/leap_web_core.gemspec index 4109a03..05874b2 100644 --- a/core/leap_web_core.gemspec +++ b/core/leap_web_core.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.add_dependency "couchrest", "~> 1.1.3" s.add_dependency "couchrest_model", "~> 2.0.0" - s.add_dependency "couchrest_session_store", "~> 0.2.2" + s.add_dependency "couchrest_session_store", "~> 0.2.3" s.add_dependency "json" end -- cgit v1.2.3 From 8fba6fae51e96ec3330896d107ab01fce2e322d9 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 12 Dec 2013 10:15:43 +0100 Subject: reraise with a better explaination on couch failure Removing our own error class for this. It interferes with couch_rest_session_store tryign to catch the same errors. --- core/lib/extensions/couchrest.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/lib/extensions/couchrest.rb b/core/lib/extensions/couchrest.rb index 84cfbb3..7450f59 100644 --- a/core/lib/extensions/couchrest.rb +++ b/core/lib/extensions/couchrest.rb @@ -23,10 +23,6 @@ module CouchRest end end - module Errors - class ConnectionFailed < CouchRestModelError; end - end - module Connection module ClassMethods @@ -36,7 +32,9 @@ module CouchRest rescue RestClient::Unauthorized, Errno::EHOSTUNREACH, Errno::ECONNREFUSED => e - raise CouchRest::Model::Errors::ConnectionFailed.new(e.to_s) + message = "Could not connect to couch database #{db} due to #{e.to_s}" + Rails.logger.warn message + raise e.class.new(message) end end -- cgit v1.2.3 From ce99e9892dc5f807e072be8161c19f4969b1dace Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 13 Dec 2013 11:13:08 +0100 Subject: minor: rename test --- test/integration/home_test.rb | 24 ------------------------ test/integration/os_detection_test.rb | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 test/integration/home_test.rb create mode 100644 test/integration/os_detection_test.rb diff --git a/test/integration/home_test.rb b/test/integration/home_test.rb deleted file mode 100644 index 126a420..0000000 --- a/test/integration/home_test.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'test_helper' - -class AccountTest < BrowserIntegrationTest - - setup do - Capybara.current_driver = Capybara.javascript_driver - end - - test "old windows shows deactivated download" do - page.driver.headers = { "User-Agent" => "Win98" } - visit '/' - assert_selector "html.oldwin" - assert has_text? "not available" - end - - test "android shows android download" do - page.driver.headers = { "User-Agent" => "Android" } - visit '/' - assert_selector "html.android" - assert has_no_text? "not available" - assert_selector "small", text: "Android" - end - -end diff --git a/test/integration/os_detection_test.rb b/test/integration/os_detection_test.rb new file mode 100644 index 0000000..cb254aa --- /dev/null +++ b/test/integration/os_detection_test.rb @@ -0,0 +1,24 @@ +require 'test_helper' + +class OsDetectionTest < BrowserIntegrationTest + + setup do + Capybara.current_driver = Capybara.javascript_driver + end + + test "old windows shows deactivated download" do + page.driver.headers = { "User-Agent" => "Win98" } + visit '/' + assert_selector "html.oldwin" + assert has_text? "not available" + end + + test "android shows android download" do + page.driver.headers = { "User-Agent" => "Android" } + visit '/' + assert_selector "html.android" + assert has_no_text? "not available" + assert_selector "small", text: "Android" + end + +end -- cgit v1.2.3 From 72087656e5092fd744f4314c9a0e91825399fefc Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 13 Dec 2013 11:16:11 +0100 Subject: proceed even if the couch is unreachable * in case the user has a session id, keep it but proceed without a session * in case we can't initialize the models proceed * if APP_CONFIG[:reraise_errors] is set we'll crash instead in the latter case default to reraise errors in dev and test environments. --- Gemfile.lock | 4 ++-- config/defaults.yml | 2 ++ core/leap_web_core.gemspec | 2 +- core/lib/extensions/couchrest.rb | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1c24bc6..918fdba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -25,7 +25,7 @@ PATH leap_web_core (0.2.8) couchrest (~> 1.1.3) couchrest_model (~> 2.0.0) - couchrest_session_store (~> 0.2.3) + couchrest_session_store (~> 0.2.4) json rails (~> 3.2.11) @@ -110,7 +110,7 @@ GEM couchrest (~> 1.1.3) mime-types (>= 1.15) tzinfo (>= 0.3.22) - couchrest_session_store (0.2.3) + couchrest_session_store (0.2.4) actionpack couchrest couchrest_model diff --git a/config/defaults.yml b/config/defaults.yml index 4530d47..4bd8eec 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -72,6 +72,7 @@ development: domain: example.org secret_token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' payment: [] + reraise_errors: true test: <<: *downloads @@ -83,6 +84,7 @@ test: domain: test.me secret_token: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' payment: [billing] + reraise_errors: true production: <<: *downloads diff --git a/core/leap_web_core.gemspec b/core/leap_web_core.gemspec index 05874b2..7ca4d90 100644 --- a/core/leap_web_core.gemspec +++ b/core/leap_web_core.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.add_dependency "couchrest", "~> 1.1.3" s.add_dependency "couchrest_model", "~> 2.0.0" - s.add_dependency "couchrest_session_store", "~> 0.2.3" + s.add_dependency "couchrest_session_store", "~> 0.2.4" s.add_dependency "json" end diff --git a/core/lib/extensions/couchrest.rb b/core/lib/extensions/couchrest.rb index 7450f59..9f27c3a 100644 --- a/core/lib/extensions/couchrest.rb +++ b/core/lib/extensions/couchrest.rb @@ -34,7 +34,7 @@ module CouchRest Errno::ECONNREFUSED => e message = "Could not connect to couch database #{db} due to #{e.to_s}" Rails.logger.warn message - raise e.class.new(message) + raise e.class.new(message) if APP_CONFIG[:reraise_errors] end end -- cgit v1.2.3