2021-10-09 19:39:44 +00:00
|
|
|
require "../spec_helper"
|
2021-07-17 23:42:25 +00:00
|
|
|
|
2022-05-25 23:20:57 +00:00
|
|
|
Spectator.describe Spectator, :smoke do
|
2021-07-17 23:42:25 +00:00
|
|
|
it "supports custom expectation messages" do
|
|
|
|
expect do
|
|
|
|
expect(false).to be_true, "paradox!"
|
|
|
|
end.to raise_error(Spectator::ExampleFailed, "paradox!")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "supports custom expectation messages with a proc" do
|
|
|
|
count = 0
|
|
|
|
expect do
|
|
|
|
expect(false).to be_true, ->{ count += 1; "Failed #{count} times" }
|
|
|
|
end.to raise_error(Spectator::ExampleFailed, "Failed 1 times")
|
|
|
|
end
|
|
|
|
|
|
|
|
context "not_to" do
|
|
|
|
it "supports custom expectation messages" do
|
|
|
|
expect do
|
|
|
|
expect(true).not_to be_true, "paradox!"
|
|
|
|
end.to raise_error(Spectator::ExampleFailed, "paradox!")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "supports custom expectation messages with a proc" do
|
|
|
|
count = 0
|
|
|
|
expect do
|
|
|
|
expect(true).not_to be_true, ->{ count += 1; "Failed #{count} times" }
|
|
|
|
end.to raise_error(Spectator::ExampleFailed, "Failed 1 times")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|