Commit c641828c02d339f8cbaacefa10c249d27fcc6dda
1 parent
266e73bd
Exists in
master
and in
1 other branch
Fixes Redis' mocking.
We need to require mock_redis before calling MockRedis.new inside config/environments/*.rb. This because, inside that, Bundler haven't required our environments' gems yet. This patch moves that to spec/spec_helper.rb and features/support/env.rb. This fixes this problem, and also mocks Redis even if we don't run the tests through Rake. I also forgot to commit the Gemfile.lock. Adding this here.
Showing
5 changed files
with
4 additions
and
5 deletions
Show diff stats
Gemfile.lock
config/environments/cucumber.rb
... | ... | @@ -21,8 +21,6 @@ config.action_controller.allow_forgery_protection = false |
21 | 21 | # ActionMailer::Base.deliveries array. |
22 | 22 | config.action_mailer.delivery_method = :test |
23 | 23 | |
24 | -$redis = MockRedis.new | |
25 | - | |
26 | 24 | HOST = "localhost" |
27 | 25 | AUTHORIZE_NET_API_LOGIN_ID = '' |
28 | 26 | AUTHORIZE_NET_TRANSACTION_KEY = '' | ... | ... |
config/environments/test.rb
features/support/env.rb
... | ... | @@ -21,6 +21,7 @@ Webrat.configure do |config| |
21 | 21 | config.open_error_files = false # Set to true if you want error pages to pop up in the browser |
22 | 22 | end |
23 | 23 | |
24 | +$redis = MockRedis.new | |
24 | 25 | |
25 | 26 | # If you set this to false, any error raised from within your app will bubble |
26 | 27 | # up to your step definition and out to cucumber unless you catch it somewhere | ... | ... |
spec/spec_helper.rb
... | ... | @@ -9,6 +9,8 @@ require 'spec/rails' |
9 | 9 | # in ./support/ and its subdirectories. |
10 | 10 | Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} |
11 | 11 | |
12 | +$redis = MockRedis.new | |
13 | + | |
12 | 14 | Spec::Runner.configure do |config| |
13 | 15 | # If you're not using ActiveRecord you should remove these |
14 | 16 | # lines, delete config/database.yml and disable :active_record | ... | ... |