Skip to content

Instantly share code, notes, and snippets.

@Alpa84
Last active December 28, 2015 05:59
Show Gist options
  • Save Alpa84/7454193 to your computer and use it in GitHub Desktop.
Save Alpa84/7454193 to your computer and use it in GitHub Desktop.
require 'mock_redis'
require 'spec_helper'
describe ApplicationController do
it "should return 200 as status" do
reponse = get "status"
response.status.should eq 200
end
it "should return 200 as status" do
RedisConnection.instance.stub(:connection) { raise Redis::TimeoutError, "Connection timed out" }
Smrt::Record.stub(:connection) { raise "Connection timed out" }
Scr::Record.stub(:connection) { raise "Connection timed out" }
Backend::Record.stub(:connection) { raise "Connection timed out" }
DelayedJob::Record.stub(:connection) { raise "Connection timed out" }
Airbrake.should_receive(:notify) {#<RuntimeError: Connection timed out>")}
reponse = get "status"
response.status.should eq 200
end
it "should return 200 as status" do
RedisConnection.instance.stub(:connection) { raise Redis::TimeoutError, "Connection timed out" }
Smrt::Record.stub(:connection) { "2" }
Scr::Record.stub(:connection) { "3" }
Backend::Record.stub(:connection) { "4"}
DelayedJob::Record.stub(:connection) { "5" }
Airbrake.should_receive(:notify).with"#<RuntimeError: Connection timed out>"
reponse = get "status"
response.status.should eq 200
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment