MrDys / blacklight

Blacklight Plugin
http://projectblacklight.org/
Other
1 stars 1 forks source link

certain specs for ActionMailer fail for some people mysteriously #424

Closed MrDys closed 12 years ago

MrDys commented 12 years ago

CODEBASE-227: The three specs below all fail for some people some time, but work for other peopel toher times (Hudson currently has them passing). Me and Jessie have both independently tried to look into it, but been unable to figure out what's going on.

Temporarily commented out with pending() until someone has a chance to look at them.

(the functions tested by these specs (coincidentally?) all use ActionMailer, although there are toher specs testing ActionMailer behavior (I think?) that work fine).

1) ActionView::TemplateError in 'CatalogController send_email_record sms should redirect back to the record upon success' You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[] On line #1 of app/views/record_mailer/sms_record.erb

1: <%- if @document.respond_to?(:to_marc) and ! @document.to_marc['245'].nil? -%>
2: <%= @document.to_marc['245']['a'] unless @document.to_marc['245']['a'].nil? -%>
3: <%- end -%>
4: <%- if @document.to_marc and ! @document.to_marc['100'].nil? -%>

app/views/record_mailer/sms_record.erb:1
haml (2.2.19) lib/haml/helpers/action_view_mods.rb:13:in `render_without_mock_proxy'
/usr/lib64/ruby/gems/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
app/controllers/catalog_controller.rb:118:in `send_email_record'
haml (2.2.19) rails/./lib/sass/plugin/rails.rb:19:in `process'
/spec/controllers/catalog_controller_spec.rb:323
rspec (1.3.0) lib/spec/example/example_methods.rb:40:in `instance_eval'
rspec (1.3.0) lib/spec/example/example_methods.rb:40:in `execute'
/usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
rspec (1.3.0) lib/spec/example/example_methods.rb:37:in `execute'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:214:in `run_examples'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:212:in `each'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:212:in `run_examples'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:103:in `run'
rspec (1.3.0) lib/spec/runner/example_group_runner.rb:23:in `run'
rspec (1.3.0) lib/spec/runner/example_group_runner.rb:22:in `each'
rspec (1.3.0) lib/spec/runner/example_group_runner.rb:22:in `run'
rspec (1.3.0) lib/spec/runner/options.rb:152:in `run_examples'
rspec (1.3.0) lib/spec/runner/command_line.rb:9:in `run'
rspec (1.3.0) bin/spec:5
rcov (0.9.7.1) bin/rcov:508:in `load'
rcov (0.9.7.1) bin/rcov:508
/usr/bin/rcov:19:in `load'
/usr/bin/rcov:19

2) ActionView::TemplateError in 'CatalogController send_email_record email should not give error if no Message paramater is set' You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[] On line #1 of app/views/record_mailer/email_record.erb

1: <%- if @document.respond_to?(:to_marc) and ! @document.to_marc['245'].nil? -%>
2: <%= "Title: #{@document.to_marc['245']['a']}" unless @document.to_marc['245']['a'].nil? %> <%= @document.to_marc['245']['b'] unless @document.to_marc['245']['b'].nil? %>
3: <%- end -%>
4: <%- if @document.to_marc and ! @document.to_marc['100'].nil? -%>

app/views/record_mailer/email_record.erb:1
haml (2.2.19) lib/haml/helpers/action_view_mods.rb:13:in `render_without_mock_proxy'
/usr/lib64/ruby/gems/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
app/controllers/catalog_controller.rb:125:in `send_email_record'
haml (2.2.19) rails/./lib/sass/plugin/rails.rb:19:in `process'
/spec/controllers/catalog_controller_spec.rb:300
rspec (1.3.0) lib/spec/example/example_methods.rb:40:in `instance_eval'
rspec (1.3.0) lib/spec/example/example_methods.rb:40:in `execute'
/usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
rspec (1.3.0) lib/spec/example/example_methods.rb:37:in `execute'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:214:in `run_examples'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:212:in `each'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:212:in `run_examples'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:103:in `run'
rspec (1.3.0) lib/spec/runner/example_group_runner.rb:23:in `run'
rspec (1.3.0) lib/spec/runner/example_group_runner.rb:22:in `each'
rspec (1.3.0) lib/spec/runner/example_group_runner.rb:22:in `run'
rspec (1.3.0) lib/spec/runner/options.rb:152:in `run_examples'
rspec (1.3.0) lib/spec/runner/command_line.rb:9:in `run'
rspec (1.3.0) bin/spec:5
rcov (0.9.7.1) bin/rcov:508:in `load'
rcov (0.9.7.1) bin/rcov:508
/usr/bin/rcov:19:in `load'
/usr/bin/rcov:19

3) ActionView::TemplateError in 'CatalogController send_email_record email should redirect back to the record upon success' You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[] On line #1 of app/views/record_mailer/email_record.erb

1: <%- if @document.respond_to?(:to_marc) and ! @document.to_marc['245'].nil? -%>
2: <%= "Title: #{@document.to_marc['245']['a']}" unless @document.to_marc['245']['a'].nil? %> <%= @document.to_marc['245']['b'] unless @document.to_marc['245']['b'].nil? %>
3: <%- end -%>
4: <%- if @document.to_marc and ! @document.to_marc['100'].nil? -%>

app/views/record_mailer/email_record.erb:1
haml (2.2.19) lib/haml/helpers/action_view_mods.rb:13:in `render_without_mock_proxy'
/usr/lib64/ruby/gems/1.8/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render'
app/controllers/catalog_controller.rb:125:in `send_email_record'
haml (2.2.19) rails/./lib/sass/plugin/rails.rb:19:in `process'
/spec/controllers/catalog_controller_spec.rb:304
rspec (1.3.0) lib/spec/example/example_methods.rb:40:in `instance_eval'
rspec (1.3.0) lib/spec/example/example_methods.rb:40:in `execute'
/usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
rspec (1.3.0) lib/spec/example/example_methods.rb:37:in `execute'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:214:in `run_examples'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:212:in `each'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:212:in `run_examples'
rspec (1.3.0) lib/spec/example/example_group_methods.rb:103:in `run'
rspec (1.3.0) lib/spec/runner/example_group_runner.rb:23:in `run'
rspec (1.3.0) lib/spec/runner/example_group_runner.rb:22:in `each'
rspec (1.3.0) lib/spec/runner/example_group_runner.rb:22:in `run'
rspec (1.3.0) lib/spec/runner/options.rb:152:in `run_examples'
rspec (1.3.0) lib/spec/runner/command_line.rb:9:in `run'
rspec (1.3.0) bin/spec:5
rcov (0.9.7.1) bin/rcov:508:in `load'
rcov (0.9.7.1) bin/rcov:508
/usr/bin/rcov:19:in `load'
/usr/bin/rcov:19

Finished in 10.148066 seconds

MrDys commented 12 years ago

Original reporter: jrochkind

MrDys commented 12 years ago

jkeck: Re-write to SMS/Email has resolved this issue.

MrDys commented 12 years ago

jkeck: There is a remote branch that has a non-marc email export in it. Since this error appears to be on the marc records then this shouldn't be a problem any longer. I have removed the calls to pending() from those specs and they are passing locally. If this branch gets merged into master and nobody reports the failures again we can close this ticket.

MrDys commented 12 years ago

jkeck: Oh! And it may have been because we needed to call SolrDocument.use_extension( Blacklight::Solr::Document::Marc ) from the failing spec. I found inconsistent passes and failures when fixing the specs to not use MARC anymore and calling SolrDocumnet.use_extension seemed to resolve it.