Skip to content

Commit

Permalink
Start adding specs for Helpers module:
Browse files Browse the repository at this point in the history
  • Loading branch information
dvjones89 committed Mar 31, 2018
1 parent ac813ea commit 52e7d6b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions spec/sheldon/helpers_spec.rb
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

0 comments on commit 52e7d6b

Please sign in to comment.