-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start adding specs for Helpers module:
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require "spec_helper" | ||
|
||
describe Helpers do | ||
describe "#with_exception_handling" do | ||
it "should execute healthy without any drama" do | ||
expect(with_exception_handling{1+1}).to eq(2) | ||
end | ||
|
||
|
||
context "When an exception has been encountered" do | ||
before(:each) do | ||
@exception = Exception.new("This is a test exception") | ||
@exception.set_backtrace(caller) | ||
end | ||
|
||
context "when debug_file_path hasn't been set in Sheldon's .dotfile" do | ||
it "should print the error message to the console in red text" do | ||
allow(subject).to receive(:red) | ||
subject.with_exception_handling{raise @exception} | ||
expect(subject).to have_received(:red).with(@exception.message) | ||
end | ||
end | ||
|
||
end | ||
end | ||
end |