Open reconstructions opened 10 years ago
Additional weird behavior, no errors:
$ rspec spec/requests/setlists_pages_spec.rb
................................
Finished in 8.43 seconds
Same code, different rspec invocation:
$ rspec spec/
Failures:
1) Setlist pages setlist#show should be valid markup
Failure/Error: it { should be_valid_markup }
NoMethodError:
undefined method `collect' for nil:NilClass
# ./spec/requests/setlists_pages_spec.rb:59:in `block (3 levels) in <top (required)>'
...and 8 more...
Finished in 35.34 seconds
330 examples, 9 failures, 3 pending
This time, the failures occurred in only one rspec file, whereas other files with be_valid_markup
calls passed.
Also found some invalid HTML in Devise's markup using your gem:
Can you give us a little bit more information: e.g. rspec version, full stack trace of where the error occurs, etc?
My rspec version: gem "rspec-rails", "~> 2.14.1"
Here's a typical stack trace. Looks like `be_valid_asset' might be tangling with the 'representable' gem in some way:
Failures:
1) CSS Validation validate all .css files in '/public/assets/
Failure/Error: css.should be_valid_css3
NoMethodError:
undefined method `collect' for nil:NilClass
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/representable-1.8.5/lib/representable/bindings/hash_bindings.rb:40:in `serialize'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/representable-1.8.5/lib/representable/bindings/hash_bindings.rb:22:in `write'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/representable-1.8.5/lib/representable/hash/collection.rb:23:in `create_representation_with'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/representable-1.8.5/lib/representable/hash.rb:39:in `to_hash'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/roar-0.12.7/lib/roar/representer/json.rb:26:in `to_hash'
# /Users/reconstructions/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/http.rb:567:in `try_convert'
# /Users/reconstructions/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/http.rb:567:in `start'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/be_valid_asset-1.2.3/lib/be_valid_asset/be_valid_base.rb:94:in `http_start'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/be_valid_asset-1.2.3/lib/be_valid_asset/be_valid_base.rb:72:in `call_validator'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/be_valid_asset-1.2.3/lib/be_valid_asset/be_valid_base.rb:58:in `get_validator_response'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/be_valid_asset-1.2.3/lib/be_valid_asset/be_valid_base.rb:17:in `validate'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/be_valid_asset-1.2.3/lib/be_valid_asset/be_valid_css.rb:24:in `matches?'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-expectations-2.14.5/lib/rspec/expectations/handler.rb:24:in `handle_matcher'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-expectations-2.14.5/lib/rspec/expectations/syntax.rb:53:in `should'
# ./spec/assets/css_spec.rb:12:in `block (3 levels) in <top (required)>'
# ./spec/assets/css_spec.rb:6:in `foreach'
# ./spec/assets/css_spec.rb:6:in `block (2 levels) in <top (required)>'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:114:in `instance_eval'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:114:in `block in run'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:179:in `call'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:179:in `run'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_exec'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_eval_with_args'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:247:in `instance_eval_with_args'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/hooks.rb:106:in `block (2 levels) in run'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/hooks.rb:108:in `call'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/hooks.rb:108:in `run'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/hooks.rb:446:in `run_hook'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:340:in `run_around_each_hooks'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:256:in `with_around_each_hooks'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:111:in `run'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:390:in `block in run_examples'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:386:in `map'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:386:in `run_examples'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:371:in `run'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:28:in `map'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:28:in `block in run'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/reporter.rb:58:in `report'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:25:in `run'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run'
# /Users/reconstructions/.rvm/gems/ruby-2.1.0@sfrc/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun'
I have some unusual failures when using this gem in rspec tests:
If I run rspec like this:
I get lots of failures from
should be_valid_markup
, in all the tests where I use it.If I run my tests like this:
Or this:
They all pass.
Any idea what is going on here? This gem has helped me keep my HTML valid, so thanks for that!