mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add spec for ExampleFactory
This commit is contained in:
parent
8e7f5cf82b
commit
ffdc0c40ac
1 changed files with 27 additions and 0 deletions
27
spec/dsl/example_factory_spec.cr
Normal file
27
spec/dsl/example_factory_spec.cr
Normal file
|
@ -0,0 +1,27 @@
|
|||
require "../spec_helper"
|
||||
|
||||
describe Spectator::DSL::ExampleFactory do
|
||||
describe "#build" do
|
||||
it "creates an example of the correct type" do
|
||||
factory = Spectator::DSL::ExampleFactory.new(SpyExample)
|
||||
group = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty)
|
||||
example = factory.build(group, Spectator::Internals::SampleValues.empty)
|
||||
example.should be_a(SpyExample)
|
||||
end
|
||||
|
||||
it "passes along the group" do
|
||||
factory = Spectator::DSL::ExampleFactory.new(SpyExample)
|
||||
group = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty)
|
||||
example = factory.build(group, Spectator::Internals::SampleValues.empty)
|
||||
example.group.should eq(group)
|
||||
end
|
||||
|
||||
it "passes along the sample values" do
|
||||
factory = Spectator::DSL::ExampleFactory.new(SpyExample)
|
||||
group = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty)
|
||||
values = Spectator::Internals::SampleValues.empty.add(:foo, "foo", 12345)
|
||||
example = factory.build(group, values)
|
||||
example.as(SpyExample).sample_values.should eq(values)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue