Add spec that produces error

When forcing all expectations to be shown (via --json), an error occurs.
It looks like Crystal doesn't know what the types of some expectation 
values are.

can't execute `value.negate` at 
/home/michael/Projects/spectator/src/spectator/expectations/expectation.cr:28:13: 
`value` has no type
src/spectator/expectations/expectation.cr:28:13 in 'values'
src/spectator/expectations/expectation.cr:266:5 in 'to_json'
src/spectator/expectations/example_expectations.cr:58:16 in 'to_json'
/usr/share/crystal/src/json/builder.cr:249:5 in 'field'
src/spectator/finished_result.cr:24:7 in 'add_json_fields'
src/spectator/result.cr:29:9 in 'to_json'
src/spectator/formatting/json_formatter.cr:40:7 in 'end_example'
src/spectator/runner.cr:59:32 in 'run_example'
src/spectator/runner.cr:35:9 in 'collect_results'
src/spectator/runner.cr:356:5 in 'run'
src/spectator.cr:107:5 in 'run'
src/spectator.cr:81:29 in '->'
/usr/share/crystal/src/kernel.cr:255:3 in 'run'
/usr/share/crystal/src/crystal/main.cr:47:5 in 'main'
/usr/share/crystal/src/crystal/main.cr:106:3 in 'main'
__libc_start_main
_start
???
This commit is contained in:
Michael Miller 2019-04-06 11:53:51 -06:00
parent 12c71a25cd
commit 61ee8ce1e1

19
test_hooks.cr Normal file
View file

@ -0,0 +1,19 @@
require "./src/spectator"
Spectator.describe Array do
let(array) { %i[a b c] }
let(original_array) { array.dup }
pre_condition { is_expected.to_not be_nil } # 1
post_condition { expect(array).to match_array(original_array) } # 5
subject { array.map(&.to_s) }
describe "#foo" do
pre_condition { expect(subject.first).to eq("a") } # 2
post_condition { expect(array.size).to eq(26) } # 4
it "does a cool thing" do
# 3
end
end
end