mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
parent
b305c829be
commit
1d530de5b1
2 changed files with 42 additions and 0 deletions
|
@ -33,4 +33,12 @@ class FailingExample < Spectator::RunnableExample
|
||||||
group.children = [example.as(Spectator::ExampleComponent)]
|
group.children = [example.as(Spectator::ExampleComponent)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Creates a group of failing examples.
|
||||||
|
def self.create_group(count = 5, hooks = Spectator::ExampleHooks.empty, conditions = Spectator::ExampleConditions.empty)
|
||||||
|
values = Spectator::Internals::SampleValues.empty
|
||||||
|
Spectator::RootExampleGroup.new(hooks, conditions).tap do |group|
|
||||||
|
group.children = Array.new(count) { new(group, values).as(Spectator::ExampleComponent) }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,6 +40,40 @@ describe Spectator::Runner do
|
||||||
called.should eq([0, 1, 2, 3, 4, 5, 6])
|
called.should eq([0, 1, 2, 3, 4, 5, 6])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "runs after_each hooks" do
|
||||||
|
called = false
|
||||||
|
hooks = new_hooks(after_each: ->{ called = true; nil })
|
||||||
|
group = FailingExample.create_group(hooks: hooks)
|
||||||
|
suite = new_test_suite(group)
|
||||||
|
runner = Spectator::Runner.new(suite, spectator_test_config(fail_fast: true))
|
||||||
|
runner.run
|
||||||
|
called.should be_true
|
||||||
|
end
|
||||||
|
|
||||||
|
it "runs after_all hooks" do
|
||||||
|
called = false
|
||||||
|
hooks = new_hooks(after_all: ->{ called = true; nil })
|
||||||
|
group = FailingExample.create_group(hooks: hooks)
|
||||||
|
suite = new_test_suite(group)
|
||||||
|
runner = Spectator::Runner.new(suite, spectator_test_config(fail_fast: true))
|
||||||
|
runner.run
|
||||||
|
called.should be_true
|
||||||
|
end
|
||||||
|
|
||||||
|
it "runs the remaining around_each hook code" do
|
||||||
|
called = false
|
||||||
|
hooks = new_hooks(around_each: ->(proc : ->) {
|
||||||
|
proc.call
|
||||||
|
called = true
|
||||||
|
nil
|
||||||
|
})
|
||||||
|
group = FailingExample.create_group(hooks: hooks)
|
||||||
|
suite = new_test_suite(group)
|
||||||
|
runner = Spectator::Runner.new(suite, spectator_test_config(fail_fast: true))
|
||||||
|
runner.run
|
||||||
|
called.should be_true
|
||||||
|
end
|
||||||
|
|
||||||
context "the report" do
|
context "the report" do
|
||||||
it "has the remaining tests" do
|
it "has the remaining tests" do
|
||||||
spy = SpyFormatter.new
|
spy = SpyFormatter.new
|
||||||
|
|
Loading…
Reference in a new issue