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