#26 ✓resolved
Tom Meier

Private method `scan' when using click_first_link_in_email

Reported by Tom Meier | August 5th, 2010 @ 10:38 PM

Hi,

Having an issue on pickle with the 'click first link in email',

Ruby : 1.8.7 (or 1.9.1 tested via both)
Pickle : 0.3.3
gem 'email_spec', :git => "git://github.com/bmabey/email-spec.git", :branch => "rails3" (generated email spec file commented out, only using pickle email_steps.rb)

And 1 email should be delivered

And I click the first link in the email                                                           # features/step_definitions/email_steps.rb:25
  private method `scan' called for #<Mail::Body:0x106238668> (NoMethodError)
  /opt/local/lib/ruby/1.8/uri/common.rb:557:in `extract'
  ./features/step_definitions/email_steps.rb:26:in `/^(?:I|they) click the first link in ((?:(?:(?:a|an|another|the|that) )?(?:(?:first|last|(?:\d+(?:st|nd|rd|th))) )?email))$/'
  features/public/forgotten_password.feature:19:in `And I click the first link in the email'

email_steps.rb

When(/^(?:I|they) click the first link in #{capture_email}$/) do |email_ref|
click_first_link_in_email(email(email_ref)) end

(Show me the email - works perfectly just before) its failing when it goes through email(email_ref) in parser.rb:

given a string like 'foo: "bar", bar: "baz"' returns {"foo" => "bar", "bar" => "baz"}

def parse_fields(fields)
  if fields.blank?
    {}
  elsif fields =~ /^#{match_fields}$/
    fields.scan(/(#{match_field})(?:,|$)/).inject({}) do |m, match|
      m.merge(parse_field(match[0]))
    end
  else
    raise ArgumentError, "The fields string is not in the correct format.\n\n'#{fields}' did not match: #{match_fields}" 
  end
end

Have you seen this before? The email is seeming to fail when scan is run on the passed fields?

I've tested on 1.9.1 and same result too, I'll keep hunting around, but not sure if its come up before?

Cheers,
Tom

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Assign tickets to <b>Ian White</b>, so I get notified

People watching this ticket

Referenced by

Pages