This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from tinsep19/t/matcher
T/matcher
- Loading branch information
Showing
3 changed files
with
50 additions
and
17 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
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,42 @@ | ||
require 'spec_helper' | ||
require 'securerandom' | ||
RSpec.describe :be_ok do | ||
subject { be_ok } | ||
|
||
let(:passed) do | ||
item = double('passed') | ||
allow(item).to receive(:ok?) { true } | ||
item | ||
end | ||
|
||
let(:failed) do | ||
item = double('failed') | ||
item_desc = SecureRandom.uuid | ||
allow(item).to receive(:ok?) { false } | ||
allow(item).to receive(:execute?) { true } | ||
allow(item).to receive(:item) { item_desc } | ||
item | ||
end | ||
|
||
let(:not_started) do | ||
item = double('not_started') | ||
item_desc = SecureRandom.uuid | ||
allow(item).to receive(:ok?) {false} | ||
allow(item).to receive(:execute?) {false} | ||
allow(item).to receive(:item) { item_desc } | ||
item | ||
end | ||
|
||
its(:description) { should eq "should be passed." } | ||
describe "match" do | ||
it { expect(subject.matches?(passed)).to be_truthy } | ||
it { expect(subject.matches?(failed)).to be_falsy } | ||
it { expect(subject.matches?(not_started)).to be_falsy } | ||
end | ||
|
||
it "failure_message include testitem.item" do | ||
subject.matches?(not_started) | ||
expect(subject.failure_message).to include(not_started.item) | ||
end | ||
|
||
end |
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