mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add Ameba and address code linting issues
This commit is contained in:
parent
99926c775e
commit
53bfcc25ef
16 changed files with 33 additions and 32 deletions
|
@ -13,8 +13,9 @@ before_script:
|
||||||
|
|
||||||
spec:
|
spec:
|
||||||
script:
|
script:
|
||||||
- crystal tool format --check
|
|
||||||
- crystal spec
|
- crystal spec
|
||||||
|
- bin/ameba
|
||||||
|
- crystal tool format --check
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
|
|
|
@ -341,6 +341,7 @@ Contributing
|
||||||
|
|
||||||
Please make sure to run `crystal tool format` before submitting.
|
Please make sure to run `crystal tool format` before submitting.
|
||||||
The CI build checks for properly formatted code.
|
The CI build checks for properly formatted code.
|
||||||
|
[Ameba](https://github.com/veelenga/ameba) is run to check for code style.
|
||||||
|
|
||||||
Tests must be written for any new functionality.
|
Tests must be written for any new functionality.
|
||||||
Macros that create types are not as easy to test,
|
Macros that create types are not as easy to test,
|
||||||
|
|
|
@ -7,3 +7,8 @@ authors:
|
||||||
crystal: 0.27.2
|
crystal: 0.27.2
|
||||||
|
|
||||||
license: MIT
|
license: MIT
|
||||||
|
|
||||||
|
development_dependencies:
|
||||||
|
ameba:
|
||||||
|
github: veelenga/ameba
|
||||||
|
version: ~> 0.9
|
||||||
|
|
|
@ -154,7 +154,7 @@ describe Spectator::DSL::NestedExampleGroupBuilder do
|
||||||
it "adds a hook" do
|
it "adds a hook" do
|
||||||
hook_called = false
|
hook_called = false
|
||||||
builder = Spectator::DSL::NestedExampleGroupBuilder.new("foo")
|
builder = Spectator::DSL::NestedExampleGroupBuilder.new("foo")
|
||||||
builder.add_around_each_hook(->(proc : ->) {
|
builder.add_around_each_hook(->(_proc : ->) {
|
||||||
hook_called = true
|
hook_called = true
|
||||||
})
|
})
|
||||||
root = Spectator::DSL::RootExampleGroupBuilder.new.build(Spectator::Internals::SampleValues.empty)
|
root = Spectator::DSL::RootExampleGroupBuilder.new.build(Spectator::Internals::SampleValues.empty)
|
||||||
|
|
|
@ -143,7 +143,7 @@ describe Spectator::DSL::RootExampleGroupBuilder do
|
||||||
it "adds a hook" do
|
it "adds a hook" do
|
||||||
hook_called = false
|
hook_called = false
|
||||||
builder = Spectator::DSL::RootExampleGroupBuilder.new
|
builder = Spectator::DSL::RootExampleGroupBuilder.new
|
||||||
builder.add_around_each_hook(->(proc : ->) {
|
builder.add_around_each_hook(->(_proc : ->) {
|
||||||
hook_called = true
|
hook_called = true
|
||||||
})
|
})
|
||||||
group = builder.build(Spectator::Internals::SampleValues.empty)
|
group = builder.build(Spectator::Internals::SampleValues.empty)
|
||||||
|
|
|
@ -93,7 +93,7 @@ describe Spectator::ExampleIterator do
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Spectator::NestedExampleGroup.new(i.to_s, group, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty).tap do |sub_group|
|
Spectator::NestedExampleGroup.new(i.to_s, group, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty).tap do |sub_group|
|
||||||
sub_group.children = Array(Spectator::ExampleComponent).new(5) do |j|
|
sub_group.children = Array(Spectator::ExampleComponent).new(5) do |_|
|
||||||
PassingExample.new(sub_group, Spectator::Internals::SampleValues.empty).tap do |example|
|
PassingExample.new(sub_group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||||
expected_examples << example
|
expected_examples << example
|
||||||
end
|
end
|
||||||
|
@ -113,7 +113,7 @@ describe Spectator::ExampleIterator do
|
||||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty)
|
PassingExample.new(group, Spectator::Internals::SampleValues.empty)
|
||||||
else
|
else
|
||||||
Spectator::NestedExampleGroup.new(i.to_s, group, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty).tap do |sub_group|
|
Spectator::NestedExampleGroup.new(i.to_s, group, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty).tap do |sub_group|
|
||||||
sub_group.children = Array(Spectator::ExampleComponent).new(5) do |j|
|
sub_group.children = Array(Spectator::ExampleComponent).new(5) do |_|
|
||||||
PassingExample.new(sub_group, Spectator::Internals::SampleValues.empty)
|
PassingExample.new(sub_group, Spectator::Internals::SampleValues.empty)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,7 +53,6 @@ describe Spectator::Internals::Harness do
|
||||||
describe "#report_expectation" do
|
describe "#report_expectation" do
|
||||||
context "with a successful result" do
|
context "with a successful result" do
|
||||||
it "stores the result" do
|
it "stores the result" do
|
||||||
error = nil.as(Exception?)
|
|
||||||
expectation = new_satisfied_expectation
|
expectation = new_satisfied_expectation
|
||||||
spy = SpyExample.create do
|
spy = SpyExample.create do
|
||||||
harness = Spectator::Internals::Harness.current
|
harness = Spectator::Internals::Harness.current
|
||||||
|
@ -81,7 +80,6 @@ describe Spectator::Internals::Harness do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "stores the result" do
|
it "stores the result" do
|
||||||
error = nil.as(Exception?)
|
|
||||||
expectation = new_unsatisfied_expectation
|
expectation = new_unsatisfied_expectation
|
||||||
spy = SpyExample.create do
|
spy = SpyExample.create do
|
||||||
harness = Spectator::Internals::Harness.current
|
harness = Spectator::Internals::Harness.current
|
||||||
|
|
|
@ -125,7 +125,6 @@ describe Spectator::Matchers::TruthyMatcher do
|
||||||
|
|
||||||
it "contains the \"truthy\"" do
|
it "contains the \"truthy\"" do
|
||||||
value = 42
|
value = 42
|
||||||
label = "everything"
|
|
||||||
partial = new_partial(value)
|
partial = new_partial(value)
|
||||||
matcher = Spectator::Matchers::TruthyMatcher.new(true)
|
matcher = Spectator::Matchers::TruthyMatcher.new(true)
|
||||||
match_data = matcher.match(partial)
|
match_data = matcher.match(partial)
|
||||||
|
@ -145,7 +144,6 @@ describe Spectator::Matchers::TruthyMatcher do
|
||||||
|
|
||||||
it "contains the \"truthy\"" do
|
it "contains the \"truthy\"" do
|
||||||
value = 42
|
value = 42
|
||||||
label = "everything"
|
|
||||||
partial = new_partial(value)
|
partial = new_partial(value)
|
||||||
matcher = Spectator::Matchers::TruthyMatcher.new(true)
|
matcher = Spectator::Matchers::TruthyMatcher.new(true)
|
||||||
match_data = matcher.match(partial)
|
match_data = matcher.match(partial)
|
||||||
|
@ -261,7 +259,6 @@ describe Spectator::Matchers::TruthyMatcher do
|
||||||
|
|
||||||
it "contains the \"falsey\"" do
|
it "contains the \"falsey\"" do
|
||||||
value = 42
|
value = 42
|
||||||
label = "everything"
|
|
||||||
partial = new_partial(value)
|
partial = new_partial(value)
|
||||||
matcher = Spectator::Matchers::TruthyMatcher.new(false)
|
matcher = Spectator::Matchers::TruthyMatcher.new(false)
|
||||||
match_data = matcher.match(partial)
|
match_data = matcher.match(partial)
|
||||||
|
@ -281,7 +278,6 @@ describe Spectator::Matchers::TruthyMatcher do
|
||||||
|
|
||||||
it "contains the \"falsey\"" do
|
it "contains the \"falsey\"" do
|
||||||
value = 42
|
value = 42
|
||||||
label = "everything"
|
|
||||||
partial = new_partial(value)
|
partial = new_partial(value)
|
||||||
matcher = Spectator::Matchers::TruthyMatcher.new(false)
|
matcher = Spectator::Matchers::TruthyMatcher.new(false)
|
||||||
match_data = matcher.match(partial)
|
match_data = matcher.match(partial)
|
||||||
|
|
|
@ -28,7 +28,7 @@ def nested_group_with_sub_groups(sub_group_count = 5, example_count = 5)
|
||||||
examples = [] of Spectator::Example
|
examples = [] of Spectator::Example
|
||||||
group.children = Array(Spectator::ExampleComponent).new(sub_group_count) do |i|
|
group.children = Array(Spectator::ExampleComponent).new(sub_group_count) do |i|
|
||||||
Spectator::NestedExampleGroup.new(i.to_s, group, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty).tap do |sub_group|
|
Spectator::NestedExampleGroup.new(i.to_s, group, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty).tap do |sub_group|
|
||||||
sub_group.children = Array(Spectator::ExampleComponent).new(example_count) do |j|
|
sub_group.children = Array(Spectator::ExampleComponent).new(example_count) do |_|
|
||||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||||
examples << example
|
examples << example
|
||||||
end
|
end
|
||||||
|
@ -359,7 +359,7 @@ describe Spectator::NestedExampleGroup do
|
||||||
root = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
root = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
||||||
group = Spectator::NestedExampleGroup.new("what", root, hooks, Spectator::ExampleConditions.empty)
|
group = Spectator::NestedExampleGroup.new("what", root, hooks, Spectator::ExampleConditions.empty)
|
||||||
root.children = [group.as(Spectator::ExampleComponent)]
|
root.children = [group.as(Spectator::ExampleComponent)]
|
||||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
group.children = Array(Spectator::ExampleComponent).new(5) do |_|
|
||||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||||
examples << example
|
examples << example
|
||||||
end
|
end
|
||||||
|
@ -378,7 +378,7 @@ describe Spectator::NestedExampleGroup do
|
||||||
root = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
root = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
||||||
group = Spectator::NestedExampleGroup.new("what", root, hooks, Spectator::ExampleConditions.empty)
|
group = Spectator::NestedExampleGroup.new("what", root, hooks, Spectator::ExampleConditions.empty)
|
||||||
root.children = [group.as(Spectator::ExampleComponent)]
|
root.children = [group.as(Spectator::ExampleComponent)]
|
||||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
group.children = Array(Spectator::ExampleComponent).new(5) do |_|
|
||||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||||
examples << example
|
examples << example
|
||||||
end
|
end
|
||||||
|
@ -397,7 +397,7 @@ describe Spectator::NestedExampleGroup do
|
||||||
root = Spectator::RootExampleGroup.new(hooks, Spectator::ExampleConditions.empty)
|
root = Spectator::RootExampleGroup.new(hooks, Spectator::ExampleConditions.empty)
|
||||||
group = Spectator::NestedExampleGroup.new("what", root, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
group = Spectator::NestedExampleGroup.new("what", root, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
||||||
root.children = [group.as(Spectator::ExampleComponent)]
|
root.children = [group.as(Spectator::ExampleComponent)]
|
||||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
group.children = Array(Spectator::ExampleComponent).new(5) do |_|
|
||||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||||
examples << example
|
examples << example
|
||||||
end
|
end
|
||||||
|
@ -416,7 +416,7 @@ describe Spectator::NestedExampleGroup do
|
||||||
root = Spectator::RootExampleGroup.new(hooks, Spectator::ExampleConditions.empty)
|
root = Spectator::RootExampleGroup.new(hooks, Spectator::ExampleConditions.empty)
|
||||||
group = Spectator::NestedExampleGroup.new("what", root, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
group = Spectator::NestedExampleGroup.new("what", root, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
||||||
root.children = [group.as(Spectator::ExampleComponent)]
|
root.children = [group.as(Spectator::ExampleComponent)]
|
||||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
group.children = Array(Spectator::ExampleComponent).new(5) do |_|
|
||||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||||
examples << example
|
examples << example
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,7 +22,7 @@ def root_group_with_sub_groups(sub_group_count = 5, example_count = 5)
|
||||||
examples = [] of Spectator::Example
|
examples = [] of Spectator::Example
|
||||||
group.children = Array(Spectator::ExampleComponent).new(sub_group_count) do |i|
|
group.children = Array(Spectator::ExampleComponent).new(sub_group_count) do |i|
|
||||||
Spectator::NestedExampleGroup.new(i.to_s, group, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty).tap do |sub_group|
|
Spectator::NestedExampleGroup.new(i.to_s, group, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty).tap do |sub_group|
|
||||||
sub_group.children = Array(Spectator::ExampleComponent).new(example_count) do |j|
|
sub_group.children = Array(Spectator::ExampleComponent).new(example_count) do |_|
|
||||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||||
examples << example
|
examples << example
|
||||||
end
|
end
|
||||||
|
@ -246,7 +246,7 @@ describe Spectator::RootExampleGroup do
|
||||||
examples = [] of Spectator::Example
|
examples = [] of Spectator::Example
|
||||||
hooks = new_hooks(after_all: ->{ called = true; nil })
|
hooks = new_hooks(after_all: ->{ called = true; nil })
|
||||||
group = Spectator::RootExampleGroup.new(hooks, Spectator::ExampleConditions.empty)
|
group = Spectator::RootExampleGroup.new(hooks, Spectator::ExampleConditions.empty)
|
||||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
group.children = Array(Spectator::ExampleComponent).new(5) do |_|
|
||||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||||
examples << example
|
examples << example
|
||||||
end
|
end
|
||||||
|
@ -263,7 +263,7 @@ describe Spectator::RootExampleGroup do
|
||||||
examples = [] of Spectator::Example
|
examples = [] of Spectator::Example
|
||||||
hooks = new_hooks(after_each: ->{ called = true; nil })
|
hooks = new_hooks(after_each: ->{ called = true; nil })
|
||||||
group = Spectator::RootExampleGroup.new(hooks, Spectator::ExampleConditions.empty)
|
group = Spectator::RootExampleGroup.new(hooks, Spectator::ExampleConditions.empty)
|
||||||
group.children = Array(Spectator::ExampleComponent).new(5) do |i|
|
group.children = Array(Spectator::ExampleComponent).new(5) do |_|
|
||||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
PassingExample.new(group, Spectator::Internals::SampleValues.empty).tap do |example|
|
||||||
examples << example
|
examples << example
|
||||||
end
|
end
|
||||||
|
|
|
@ -856,7 +856,7 @@ describe Spectator::RunnableExample do
|
||||||
root = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, conditions)
|
root = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, conditions)
|
||||||
group = Spectator::NestedExampleGroup.new("what", root, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
group = Spectator::NestedExampleGroup.new("what", root, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
||||||
root.children = [group.as(Spectator::ExampleComponent)]
|
root.children = [group.as(Spectator::ExampleComponent)]
|
||||||
result = run_example(FailingExample, group)
|
run_example(FailingExample, group)
|
||||||
called.should be_false
|
called.should be_false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1219,7 +1219,7 @@ describe Spectator::RunnableExample do
|
||||||
root = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, conditions)
|
root = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, conditions)
|
||||||
group = Spectator::NestedExampleGroup.new("what", root, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
group = Spectator::NestedExampleGroup.new("what", root, Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
||||||
root.children = [group.as(Spectator::ExampleComponent)]
|
root.children = [group.as(Spectator::ExampleComponent)]
|
||||||
result = run_example(ErroredExample, group)
|
run_example(ErroredExample, group)
|
||||||
called.should be_false
|
called.should be_false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -100,7 +100,7 @@ describe Spectator::Runner do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "#start_example is called for each example" do
|
it "#start_example is called for each example" do
|
||||||
group = SpyExample.create_group(5) { |index| nil }
|
group = SpyExample.create_group(5) { |_| nil }
|
||||||
suite = new_test_suite(group)
|
suite = new_test_suite(group)
|
||||||
spy = SpyFormatter.new
|
spy = SpyFormatter.new
|
||||||
runner = Spectator::Runner.new(suite, spectator_test_config(spy))
|
runner = Spectator::Runner.new(suite, spectator_test_config(spy))
|
||||||
|
@ -109,7 +109,7 @@ describe Spectator::Runner do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "passes the correct example to #start_example" do
|
it "passes the correct example to #start_example" do
|
||||||
group = SpyExample.create_group(5) { |index| nil }
|
group = SpyExample.create_group(5) { |_| nil }
|
||||||
suite = new_test_suite(group)
|
suite = new_test_suite(group)
|
||||||
spy = SpyFormatter.new
|
spy = SpyFormatter.new
|
||||||
runner = Spectator::Runner.new(suite, spectator_test_config(spy))
|
runner = Spectator::Runner.new(suite, spectator_test_config(spy))
|
||||||
|
@ -125,7 +125,7 @@ describe Spectator::Runner do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "calls #end_example for each example" do
|
it "calls #end_example for each example" do
|
||||||
group = SpyExample.create_group(5) { |index| nil }
|
group = SpyExample.create_group(5) { |_| nil }
|
||||||
suite = new_test_suite(group)
|
suite = new_test_suite(group)
|
||||||
spy = SpyFormatter.new
|
spy = SpyFormatter.new
|
||||||
runner = Spectator::Runner.new(suite, spectator_test_config(spy))
|
runner = Spectator::Runner.new(suite, spectator_test_config(spy))
|
||||||
|
@ -175,7 +175,7 @@ describe Spectator::Runner do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "contains the expected time span" do
|
it "contains the expected time span" do
|
||||||
group = SpyExample.create_group(5) { |index| nil }
|
group = SpyExample.create_group(5) { |_| nil }
|
||||||
suite = new_test_suite(group)
|
suite = new_test_suite(group)
|
||||||
spy = SpyFormatter.new
|
spy = SpyFormatter.new
|
||||||
runner = Spectator::Runner.new(suite, spectator_test_config(spy))
|
runner = Spectator::Runner.new(suite, spectator_test_config(spy))
|
||||||
|
|
|
@ -4,7 +4,7 @@ describe Spectator::TestSuite do
|
||||||
describe "#each" do
|
describe "#each" do
|
||||||
it "yields each example" do
|
it "yields each example" do
|
||||||
group = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
group = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
||||||
group.children = Array.new(5) do |index|
|
group.children = Array.new(5) do |_|
|
||||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).as(Spectator::ExampleComponent)
|
PassingExample.new(group, Spectator::Internals::SampleValues.empty).as(Spectator::ExampleComponent)
|
||||||
end
|
end
|
||||||
test_suite = Spectator::TestSuite.new(group, Spectator::NullExampleFilter.new)
|
test_suite = Spectator::TestSuite.new(group, Spectator::NullExampleFilter.new)
|
||||||
|
@ -17,7 +17,7 @@ describe Spectator::TestSuite do
|
||||||
|
|
||||||
it "skips examples not in the filter" do
|
it "skips examples not in the filter" do
|
||||||
group = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
group = Spectator::RootExampleGroup.new(Spectator::ExampleHooks.empty, Spectator::ExampleConditions.empty)
|
||||||
group.children = Array.new(5) do |index|
|
group.children = Array.new(5) do |_|
|
||||||
PassingExample.new(group, Spectator::Internals::SampleValues.empty).as(Spectator::ExampleComponent)
|
PassingExample.new(group, Spectator::Internals::SampleValues.empty).as(Spectator::ExampleComponent)
|
||||||
end
|
end
|
||||||
test_suite = Spectator::TestSuite.new(group, Spectator::CompositeExampleFilter.new([] of Spectator::ExampleFilter))
|
test_suite = Spectator::TestSuite.new(group, Spectator::CompositeExampleFilter.new([] of Spectator::ExampleFilter))
|
||||||
|
|
|
@ -95,7 +95,7 @@ module Spectator
|
||||||
offset = index
|
offset = index
|
||||||
# Loop through each child
|
# Loop through each child
|
||||||
# until one is found to contain the index.
|
# until one is found to contain the index.
|
||||||
child = children.each do |child|
|
found = children.each do |child|
|
||||||
count = child.example_count
|
count = child.example_count
|
||||||
# Example groups consider their range to be [0, example_count).
|
# Example groups consider their range to be [0, example_count).
|
||||||
# Each child is offset by the total example count of the previous children.
|
# Each child is offset by the total example count of the previous children.
|
||||||
|
@ -114,7 +114,7 @@ module Spectator
|
||||||
# Otherwise, the indexer repeats the process for the next child.
|
# Otherwise, the indexer repeats the process for the next child.
|
||||||
# It should be impossible to get nil here,
|
# It should be impossible to get nil here,
|
||||||
# provided the bounds check and example counts are correct.
|
# provided the bounds check and example counts are correct.
|
||||||
child.not_nil![offset]
|
found.not_nil![offset]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Checks whether all examples in the group have been run.
|
# Checks whether all examples in the group have been run.
|
||||||
|
|
|
@ -35,7 +35,7 @@ module Spectator::Formatting
|
||||||
|
|
||||||
days = hours / 24
|
days = hours / 24
|
||||||
hours %= 24
|
hours %= 24
|
||||||
return sprintf("%i days %i:%02i:%02i", days, hours, minutes, int_seconds)
|
sprintf("%i days %i:%02i:%02i", days, hours, minutes, int_seconds)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,8 +11,8 @@ module Spectator::Matchers
|
||||||
values = ExpectedActual.new(expected, label, actual, partial.label)
|
values = ExpectedActual.new(expected, label, actual, partial.label)
|
||||||
if values.expected.size == values.actual.size
|
if values.expected.size == values.actual.size
|
||||||
index = 0
|
index = 0
|
||||||
values.expected.zip(values.actual) do |expected, actual|
|
values.expected.zip(values.actual) do |expected, element|
|
||||||
return ContentMatchData.new(index, values) unless expected == actual
|
return ContentMatchData.new(index, values) unless expected == element
|
||||||
index += 1
|
index += 1
|
||||||
end
|
end
|
||||||
IdenticalMatchData.new(values)
|
IdenticalMatchData.new(values)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue