mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix collateral damage from rev aeebbaa
This commit is contained in:
parent
aeebbaa5b6
commit
d710929479
2 changed files with 30 additions and 6 deletions
|
@ -354,60 +354,76 @@ describe Spectator::NestedExampleGroup do
|
|||
context "with some examples finished" do
|
||||
it "doesn't run the after_all hooks" do
|
||||
called = false
|
||||
examples = [] of Spectator::Example
|
||||
hooks = new_hooks(after_all: ->{ called = true; nil })
|
||||
root = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty)
|
||||
group = Spectator::NestedExampleGroup.new("what", root, hooks)
|
||||
root.children = [group.as(Spectator::ExampleComponent)]
|
||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||
Spectator::Internals::Harness.run(example) if i % 2 == 0
|
||||
examples << example
|
||||
end
|
||||
end
|
||||
examples.each_with_index do |example, index|
|
||||
Spectator::Internals::Harness.run(example) if index % 2 == 0
|
||||
end
|
||||
group.run_after_hooks
|
||||
called.should be_false
|
||||
end
|
||||
|
||||
it "runs the after_each hooks" do
|
||||
called = false
|
||||
examples = [] of Spectator::Example
|
||||
hooks = new_hooks(after_each: ->{ called = true; nil })
|
||||
root = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty)
|
||||
group = Spectator::NestedExampleGroup.new("what", root, hooks)
|
||||
root.children = [group.as(Spectator::ExampleComponent)]
|
||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||
Spectator::Internals::Harness.run(example) if i % 2 == 0
|
||||
examples << example
|
||||
end
|
||||
end
|
||||
examples.each_with_index do |example, index|
|
||||
Spectator::Internals::Harness.run(example) if index % 2 == 0
|
||||
end
|
||||
group.run_after_hooks
|
||||
called.should be_true
|
||||
end
|
||||
|
||||
it "doesn't run the parent after_all hooks" do
|
||||
called = false
|
||||
examples = [] of Spectator::Example
|
||||
hooks = new_hooks(after_all: ->{ called = true; nil })
|
||||
root = Spectator::RootExampleGroup.new(hooks)
|
||||
group = Spectator::NestedExampleGroup.new("what", root, Spectator::ExampleHooks.empty)
|
||||
root.children = [group.as(Spectator::ExampleComponent)]
|
||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||
Spectator::Internals::Harness.run(example) if i % 2 == 0
|
||||
examples << example
|
||||
end
|
||||
end
|
||||
examples.each_with_index do |example, index|
|
||||
Spectator::Internals::Harness.run(example) if index % 2 == 0
|
||||
end
|
||||
group.run_after_hooks
|
||||
called.should be_false
|
||||
end
|
||||
|
||||
it "runs the parent after_each hooks" do
|
||||
called = false
|
||||
examples = [] of Spectator::Example
|
||||
hooks = new_hooks(after_each: ->{ called = true; nil })
|
||||
root = Spectator::RootExampleGroup.new(hooks)
|
||||
group = Spectator::NestedExampleGroup.new("what", root, Spectator::ExampleHooks.empty)
|
||||
root.children = [group.as(Spectator::ExampleComponent)]
|
||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||
Spectator::Internals::Harness.run(example) if i % 2 == 0
|
||||
examples << example
|
||||
end
|
||||
end
|
||||
examples.each_with_index do |example, index|
|
||||
Spectator::Internals::Harness.run(example) if index % 2 == 0
|
||||
end
|
||||
group.run_after_hooks
|
||||
called.should be_true
|
||||
end
|
||||
|
|
|
@ -243,26 +243,34 @@ describe Spectator::RootExampleGroup do
|
|||
context "with some examples finished" do
|
||||
it "doesn't run the after_all hooks" do
|
||||
called = false
|
||||
examples = [] of Spectator::Example
|
||||
hooks = new_hooks(after_all: ->{ called = true; nil })
|
||||
group = Spectator::RootExampleGroup.new(hooks)
|
||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||
Spectator::Internals::Harness.run(example) if i % 2 == 0
|
||||
examples << example
|
||||
end
|
||||
end
|
||||
examples.each_with_index do |example, index|
|
||||
Spectator::Internals::Harness.run(example) if index % 2 == 0
|
||||
end
|
||||
group.run_after_hooks
|
||||
called.should be_false
|
||||
end
|
||||
|
||||
it "runs the after_each hooks" do
|
||||
called = false
|
||||
examples = [] of Spectator::Example
|
||||
hooks = new_hooks(after_each: ->{ called = true; nil })
|
||||
group = Spectator::RootExampleGroup.new(hooks)
|
||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||
Spectator::Internals::Harness.run(example) if i % 2 == 0
|
||||
examples << example
|
||||
end
|
||||
end
|
||||
examples.each_with_index do |example, index|
|
||||
Spectator::Internals::Harness.run(example) if index % 2 == 0
|
||||
end
|
||||
group.run_after_hooks
|
||||
called.should be_true
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue