{"id":696,"date":"2022-08-30T15:05:39","date_gmt":"2022-08-30T15:05:39","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/rspec-should-include-tries-to-chomp-an-array-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:05:39","modified_gmt":"2022-08-30T15:05:39","slug":"rspec-should-include-tries-to-chomp-an-array-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/rspec-should-include-tries-to-chomp-an-array-collection-of-common-programming-errors\/","title":{"rendered":"rspec should include tries to chomp an array-Collection of common programming errors"},"content":{"rendered":"<p><strong>[EDIT] The issue is corrected in <code>rspec-expectations<\/code>, on <code>master<\/code> branch. You can fix it by using this in your <code>Gemfile<\/code>:<\/strong><\/p>\n<pre><code>gem 'rspec-rails', '~&gt; 2.9'\ngem 'rspec-expectations', :git =&gt; \"https:\/\/github.com\/rspec\/rspec-expectations.git\", :branch =&gt; 'master'\n<\/code><\/pre>\n<p>I encountered the same issue on <code>Rails 3.0.12<\/code> with <code>rspec 2.9.0<\/code>. Reverting to <code>rspec 2.8.0<\/code> \/ <code>rspec-rails 2.8.1<\/code> did the trick.<\/p>\n<p>I raised an issue on Github, <code>rspec\/rspec-expectations<\/code>, we&#8217;ll see if it&#8217;s really a bug.<\/p>\n<p><em>For reference, this is the step definition:<\/em><\/p>\n<pre><code>Then \/^(?:I|they) should see \"([^\"]*?)\" in the email body$\/ do |text|\n  current_email.default_part_body.to_s.should include(text)\nend\n<\/code><\/pre>\n<p>&#8230; the step in the feature:<\/p>\n<pre><code>step %{I should see \"changer de mot de passe\" in the email body}\n<\/code><\/pre>\n<p>&#8230; which was raising:<\/p>\n<pre><code>undefined method `chomp' for [\"changer de mot de passe\"]:Array (NoMethodError)\n  .\/features\/step_definitions\/email_steps.rb:110:in `\/^(?:I|they) should see \"([^\"]*?)\" in the email body$\/'\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-09 21:40:06. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>[EDIT] The issue is corrected in rspec-expectations, on master branch. You can fix it by using this in your Gemfile: gem &#8216;rspec-rails&#8217;, &#8216;~&gt; 2.9&#8217; gem &#8216;rspec-expectations&#8217;, :git =&gt; &#8220;https:\/\/github.com\/rspec\/rspec-expectations.git&#8221;, :branch =&gt; &#8216;master&#8217; I encountered the same issue on Rails 3.0.12 with rspec 2.9.0. Reverting to rspec 2.8.0 \/ rspec-rails 2.8.1 did the trick. I raised [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-696","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/696","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=696"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/696\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=696"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=696"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}