mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Specify skip reason
This commit is contained in:
parent
a061bd2044
commit
dcdc64e134
8 changed files with 50 additions and 61 deletions
|
@ -34,16 +34,16 @@ Spectator.describe "Explicit Subject" do
|
|||
|
||||
subject { @@element_list.pop }
|
||||
|
||||
# TODO: RSpec calls the "actual" block after the "change block".
|
||||
xit "is memoized across calls (i.e. the block is invoked once)" do
|
||||
skip "is memoized across calls (i.e. the block is invoked once)",
|
||||
reason: "RSpec calls the \"actual\" block after the \"change block\"." do
|
||||
expect do
|
||||
3.times { subject }
|
||||
end.to change { @@element_list }.from([1, 2, 3]).to([1, 2])
|
||||
expect(subject).to eq(3)
|
||||
end
|
||||
|
||||
# TODO: RSpec calls the "actual" block after the "change block".
|
||||
xit "is not memoized across examples" do
|
||||
skip "is not memoized across examples",
|
||||
reason: "RSpec calls the \"actual\" block after the \"change block\"." do
|
||||
expect { subject }.to change { @@element_list }.from([1, 2]).to([1])
|
||||
expect(subject).to eq(2)
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ Spectator.describe "Let and let!" do
|
|||
describe "let" do
|
||||
let(:count) { @@count += 1 }
|
||||
|
||||
it "memoizes thte value" do
|
||||
it "memoizes the value" do
|
||||
expect(count).to eq(1)
|
||||
expect(count).to eq(1)
|
||||
end
|
||||
|
|
|
@ -21,17 +21,15 @@ Spectator.describe "`all` matcher" do
|
|||
# Changed `include` to `contain` to match our own.
|
||||
# `include` is a keyword and can't be used as a method name in Crystal.
|
||||
|
||||
# TODO: Add support for compound matchers.
|
||||
describe ["anything", "everything", "something"] do
|
||||
xit { is_expected.to all(be_a(String)) } # .and contain("thing") ) }
|
||||
xit { is_expected.to all(be_a(String)) } # .and end_with("g") ) }
|
||||
xit { is_expected.to all(start_with("s")) } # .or contain("y") ) }
|
||||
skip reason: "Add support for compound matchers." { is_expected.to all(be_a(String).and contain("thing")) }
|
||||
skip reason: "Add support for compound matchers." { is_expected.to all(be_a(String).and end_with("g")) }
|
||||
skip reason: "Add support for compound matchers." { is_expected.to all(start_with("s").or contain("y")) }
|
||||
|
||||
# deliberate failures
|
||||
# TODO: Add support for compound matchers.
|
||||
xit { is_expected.to all(contain("foo")) } # .and contain("bar") ) }
|
||||
xit { is_expected.to all(be_a(String)) } # .and start_with("a") ) }
|
||||
xit { is_expected.to all(start_with("a")) } # .or contain("z") ) }
|
||||
skip reason: "Add support for compound matchers." { is_expected.to all(contain("foo").and contain("bar")) }
|
||||
skip reason: "Add support for compound matchers." { is_expected.to all(be_a(String).and start_with("a")) }
|
||||
skip reason: "Add support for compound matchers." { is_expected.to all(start_with("a").or contain("z")) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,16 +12,14 @@ Spectator.describe "`contain` matcher" do
|
|||
it { is_expected.to contain(1, 7) }
|
||||
it { is_expected.to contain(1, 3, 7) }
|
||||
|
||||
# Utility matcher method `a_kind_of` is not supported.
|
||||
# it { is_expected.to contain(a_kind_of(Int)) }
|
||||
skip reason: "Utility matcher method `a_kind_of` is not supported." { is_expected.to contain(a_kind_of(Int)) }
|
||||
|
||||
# TODO: Compound matchers aren't supported.
|
||||
# it { is_expected.to contain(be_odd.and be < 10) }
|
||||
skip reason: "Compound matchers aren't supported." { is_expected.to contain(be_odd.and be < 10) }
|
||||
|
||||
# TODO: Fix behavior and cleanup output.
|
||||
# This syntax is allowed, but produces a wrong result and bad output.
|
||||
xit { is_expected.to contain(be_odd) }
|
||||
xit { is_expected.not_to contain(be_even) }
|
||||
skip reason: "Fix behavior and cleanup output." { is_expected.to contain(be_odd) }
|
||||
skip reason: "Fix behavior and cleanup output." { is_expected.not_to contain(be_even) }
|
||||
|
||||
it { is_expected.not_to contain(17) }
|
||||
it { is_expected.not_to contain(43, 100) }
|
||||
|
@ -62,35 +60,31 @@ Spectator.describe "`contain` matcher" do
|
|||
subject { {:a => 7, :b => 5} }
|
||||
|
||||
# Hash syntax is changed here from `:a => 7` to `a: 7`.
|
||||
# it { is_expected.to contain(:a) }
|
||||
# it { is_expected.to contain(:b, :a) }
|
||||
|
||||
# TODO: This hash-like syntax isn't supported.
|
||||
# it { is_expected.to contain(a: 7) }
|
||||
# it { is_expected.to contain(b: 5, a: 7) }
|
||||
# it { is_expected.not_to contain(:c) }
|
||||
# it { is_expected.not_to contain(:c, :d) }
|
||||
# it { is_expected.not_to contain(d: 2) }
|
||||
# it { is_expected.not_to contain(a: 5) }
|
||||
# it { is_expected.not_to contain(b: 7, a: 5) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.to contain(a: 7) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.to contain(b: 5, a: 7) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.not_to contain(:c) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.not_to contain(:c, :d) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.not_to contain(d: 2) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.not_to contain(a: 5) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.not_to contain(b: 7, a: 5) }
|
||||
|
||||
# deliberate failures
|
||||
# it { is_expected.not_to contain(:a) }
|
||||
# it { is_expected.not_to contain(:b, :a) }
|
||||
# it { is_expected.not_to contain(a: 7) }
|
||||
# it { is_expected.not_to contain(a: 7, b: 5) }
|
||||
# it { is_expected.to contain(:c) }
|
||||
# it { is_expected.to contain(:c, :d) }
|
||||
# it { is_expected.to contain(d: 2) }
|
||||
# it { is_expected.to contain(a: 5) }
|
||||
# it { is_expected.to contain(a: 5, b: 7) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.not_to contain(:a) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.not_to contain(:b, :a) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.not_to contain(a: 7) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.not_to contain(a: 7, b: 5) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.to contain(:c) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.to contain(:c, :d) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.to contain(d: 2) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.to contain(a: 5) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.to contain(a: 5, b: 7) }
|
||||
|
||||
# Mixed cases--the hash contains one but not the other.
|
||||
# All 4 of these cases should fail.
|
||||
# it { is_expected.to contain(:a, :d) }
|
||||
# it { is_expected.not_to contain(:a, :d) }
|
||||
# it { is_expected.to contain(a: 7, d: 3) }
|
||||
# it { is_expected.not_to contain(a: 7, d: 3) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.to contain(:a, :d) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.not_to contain(:a, :d) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.to contain(a: 7, d: 3) }
|
||||
skip reason: "This hash-like syntax isn't supported." { is_expected.not_to contain(a: 7, d: 3) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,10 +18,9 @@ Spectator.describe "`end_with` matcher" do
|
|||
context "array usage" do
|
||||
describe [0, 1, 2, 3, 4] do
|
||||
it { is_expected.to end_with 4 }
|
||||
# TODO: Add support for multiple items at the end of an array.
|
||||
# it { is_expected.to end_with 3, 4 }
|
||||
skip reason: "Add support for multiple items at the end of an array." { is_expected.to end_with 3, 4 }
|
||||
it { is_expected.not_to end_with 3 }
|
||||
# it { is_expected.not_to end_with 0, 1, 2, 3, 4, 5 }
|
||||
skip reason: "Add support for multiple items at the end of an array." { is_expected.not_to end_with 0, 1, 2, 3, 4, 5 }
|
||||
|
||||
# deliberate failures
|
||||
it_fails { is_expected.not_to end_with 4 }
|
||||
|
|
|
@ -14,14 +14,14 @@ Spectator.describe "`have_attributes` matcher" do
|
|||
# Spectator doesn't support helper matchers like `a_string_starting_with` and `a_value <`.
|
||||
# But maybe in the future it will.
|
||||
it { is_expected.to have_attributes(name: "Jim") }
|
||||
# it { is_expected.to have_attributes(name: a_string_starting_with("J") ) }
|
||||
skip reason: "Add support for fuzzy matchers." { is_expected.to have_attributes(name: a_string_starting_with("J")) }
|
||||
it { is_expected.to have_attributes(age: 32) }
|
||||
# it { is_expected.to have_attributes(age: (a_value > 30) ) }
|
||||
skip reason: "Add support for fuzzy matchers." { is_expected.to have_attributes(age: (a_value > 30)) }
|
||||
it { is_expected.to have_attributes(name: "Jim", age: 32) }
|
||||
# it { is_expected.to have_attributes(name: a_string_starting_with("J"), age: (a_value > 30) ) }
|
||||
skip reason: "Add support for fuzzy matchers." { is_expected.to have_attributes(name: a_string_starting_with("J"), age: (a_value > 30)) }
|
||||
it { is_expected.not_to have_attributes(name: "Bob") }
|
||||
it { is_expected.not_to have_attributes(age: 10) }
|
||||
# it { is_expected.not_to have_attributes(age: (a_value < 30) ) }
|
||||
skip reason: "Add support for fuzzy matchers." { is_expected.not_to have_attributes(age: (a_value < 30)) }
|
||||
|
||||
# deliberate failures
|
||||
it_fails { is_expected.to have_attributes(name: "Bob") }
|
||||
|
|
|
@ -75,14 +75,13 @@ Spectator.describe "`raise_error` matcher" do
|
|||
end
|
||||
end
|
||||
|
||||
# TODO: Support passing a block to `raise_error` matcher.
|
||||
# context "set expectations on error object passed to block" do
|
||||
# it "raises DivisionByZeroError" do
|
||||
# expect { 42 // 0 }.to raise_error do |error|
|
||||
# expect(error).to be_a(DivisionByZeroError)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
context "set expectations on error object passed to block" do
|
||||
skip "raises DivisionByZeroError", reason: "Support passing a block to `raise_error` matcher." do
|
||||
expect { 42 // 0 }.to raise_error do |error|
|
||||
expect(error).to be_a(DivisionByZeroError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "expect no error at all" do
|
||||
describe "#to_s" do
|
||||
|
|
|
@ -18,10 +18,9 @@ Spectator.describe "`start_with` matcher" do
|
|||
context "with an array" do
|
||||
describe [0, 1, 2, 3, 4] do
|
||||
it { is_expected.to start_with 0 }
|
||||
# TODO: Add support for multiple items at the beginning of an array.
|
||||
# it { is_expected.to start_with(0, 1) }
|
||||
skip reason: "Add support for multiple items at the beginning of an array." { is_expected.to start_with(0, 1) }
|
||||
it { is_expected.not_to start_with(2) }
|
||||
# it { is_expected.not_to start_with(0, 1, 2, 3, 4, 5) }
|
||||
skip reason: "Add support for multiple items at the beginning of an array." { is_expected.not_to start_with(0, 1, 2, 3, 4, 5) }
|
||||
|
||||
# deliberate failures
|
||||
it_fails { is_expected.not_to start_with 0 }
|
||||
|
|
Loading…
Reference in a new issue