Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## test_helper.rb defines an anchor
- # BEGIN custom_assertion
- class ActiveSupport::TestCase
- def assert_size(collection, size, message = nil)
- message ||= "expected #{collection.inspect} to have #{size} elements but instead had #{collection.size}"
- assert_block message do
- collection.size == size
- end
- end
- end
- # END custom_assertion
- ## test_helper_custom_assertion.rb.inc references the anchor
- testing/example/test/test_helper.rb#custom_assertion
- ## rake render complains
- code/output/testing/test_helper_custom_assertion.rb:7: syntax error, unexpected $end, expecting kEND
- end
- ^
- Validating syntax of code samples: 112 valid, 1 invalid
- Invalid files:
- code/output/testing/test_helper_custom_assertion.rb
- Rendering code samples
- ## the outputted test_helper_custom_assertion.rb is missing the last line
- class ActiveSupport::TestCase
- def assert_size(collection, size, message = nil)
- message ||= "expected #{collection.inspect} to have #{size} elements but instead had #{collection.size}"
- assert_block message do
- collection.size == size
- end
- end
Add Comment
Please, Sign In to add comment