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
-
Ian White August 5th, 2010 @ 11:25 PM
This must be a result of the changes in 0.3.2
Thanks for the bug report, will look into this tomorrow morning.
Cheers,
Ian -
Tom Meier August 6th, 2010 @ 07:13 AM
Found it, i'll work on a spec and commit to a fork... Let you know when its done :)
-
Tom Meier August 6th, 2010 @ 07:59 AM
run out of time, can't duplicate in specs without bringing in some ugly gems that i'd rather not pollute pickle with,
but in email.rb:
def links_in_email(email, protos=['http', 'https'])
URI.extract(email.body.to_s, protos)
end
(Having a to_s on email.body ensures no private method error is raised when it is scanned via 'extract')
Cheers,
Tom
-
Ian White August 6th, 2010 @ 09:43 AM
- State changed from new to resolved
(from [14e189dfbbc71becad59dd92581e3a3b57085796]) Added spec for tommeier's email fix [#26 state:resolved] http://github.com/ianwhite/pickle/commit/14e189dfbbc71becad59dd9258...
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.
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
Referenced by
- 26 Private method `scan' when using click_first_link_in_email (from [14e189dfbbc71becad59dd92581e3a3b57085796]) Added s...