Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `click_link' for #<Mail::Message:0x0000000877db18> #34

Open
kimohashem opened this issue Dec 9, 2013 · 16 comments
Open

Comments

@kimohashem
Copy link

when I do like the example to test link inside the email I get this error " undefined method `click_link' for #Mail::Message:0x0000000877db18 "

@bcardarella
Copy link
Contributor

Can you provide an example of what you're doing in your code along with what version of the gem you are using?

@kimohashem
Copy link
Author

I'm using version ~> "2.2.0"

code example:

open_email('[email protected]')
current_email.click_link 'change password'
page.should have_content 'reset password'

but the code crash on click_link and gave me the " undefined method `click_link' for #Mail::Message:0x0000000877db18 " error

@ghost
Copy link

ghost commented Dec 18, 2013

I'm getting a NotImplementedError for the same thing.

@bcardarella
Copy link
Contributor

Can I get a list of gems you have in your app? I am not able to recreate.

@ghost
Copy link

ghost commented Dec 18, 2013

Here's my whole gemfile

source 'https://rubygems.org'

ruby '2.0.0'

gem 'bourbon'
gem 'coffee-rails'
gem 'delayed_job_active_record', '>= 4.0.0'
gem 'devise'
gem 'email_validator'
gem 'figaro'
gem 'flutie'
gem 'haml'
gem 'high_voltage'
gem 'jquery-rails'
gem 'neat'
gem 'omniauth'
gem 'pg'
gem 'rack-timeout'
gem 'rails', '>= 4.0.0'
gem 'recipient_interceptor'
gem 'sass-rails'
gem 'simple_form'
gem 'uglifier'
gem 'unicorn'

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'foreman'
end

group :development, :test do
  gem 'factory_girl_rails'
  gem 'rspec-rails', '>= 2.14'
end

group :test do
  gem 'capybara-email'
  gem 'capybara-webkit', '>= 1.0.0'
  gem 'cucumber-rails', :require => false
  gem 'database_cleaner'
  gem 'launchy'
  gem 'shoulda-matchers'
  gem 'simplecov', require: false
  gem 'timecop'
  gem 'webmock'
end

group :staging, :production do
  gem 'newrelic_rpm', '>= 3.6.7'
  gem 'rails_12factor'
end

@bcardarella
Copy link
Contributor

Thank you, we have our open source day on Friday. I'll get to work on this then.

@dtuite
Copy link

dtuite commented Dec 29, 2013

I'm having the same problem with Rails 4.0.2, Capybara 2.1.0 and Capybara Email 2.2.0. You can probably see I'm using Capybara Webkit but the error occurs with both the JS and Ruby drivers. Here's my Gemfile:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'


# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. 
# Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

gem 'capistrano'
gem 'therubyracer'
gem 'httparty'
gem 'mail_view', '~> 1.0.3'
gem 'flakey', '0.6.0' # path: '~/dev/gems/flakey'
gem 'premailer-rails'
gem 'nokogiri'
gem 'whenever', require: false

gem 'foundation-rails'
gem 'foundation_rails_helper'

gem 'sidekiq'
# Sinatra and slim are needed for the sidekiq web interface.
gem 'sinatra', require: false
gem 'sidekiq-failures'
gem 'sidekiq-expected_failures'
gem 'slim'

gem 'rails_admin'
# Only added for RailsAdmin.
gem "devise"
# This is out here because I'm using it in the MailPreview class which is
# loaded in all environments.
gem 'factory_girl_rails', :require => false

gem 'omniauth'
gem 'omniauth-twitter'
gem 'sorcery', github: 'NoamB/sorcery'

gem 'open_uri_redirections'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

group :production, :staging do
  gem 'pg'
  gem 'exception_notification'
end

group :development, :production do
  gem 'thin'
end

group :development do
  gem 'mailcatcher'
end

group :development, :test do
  gem 'sqlite3'
  gem 'rspec-rails'
  gem 'foreman'
end

group :test do
  gem 'capybara-webkit'
  gem 'launchy'
  gem 'database_cleaner'
  gem 'shoulda-matchers'
  gem 'vcr'
  gem 'webmock'
  gem 'timecop'
  gem 'email_spec'
  gem 'capybara-email'
end

@dtuite
Copy link

dtuite commented Jan 26, 2014

Just FYI this persists in 2.2.1

@sid137
Copy link

sid137 commented Feb 12, 2014

Doing some debugging.. same problem.. in my app, "current_email" is a "Mail::Message", however in the repo tests, current_email is a "Capybara::Node::Email"

capybara-email/spec/email/driver_spec.rb:
screen shot 2014-02-12 at 1 10 15 am

capybara-email:
screen shot 2014-02-12 at 1 11 49 am

maybe the source of the problem?

ruby 2.1, Rails4.1.0.beta, capybara 2.2.1, capybara-email 2.3.0, rspec 3.0.0.beta1

@sid137
Copy link

sid137 commented Feb 12, 2014

@dtuite Figured out the issue in my case.. this gem's "open_email" method is conflicting with that from "email_spec", and therefore nothing gets loaded.. removing email_spec fixes the problem

@dtuite
Copy link

dtuite commented Feb 12, 2014

@sid137 That sounds likely since I'm using the email_spec gem also. I'll check it out later on and get back to you.

@dtuite
Copy link

dtuite commented Feb 12, 2014

@sid137 @bcardarella Confirmed. Removing email_spec fixes the issue.

@rsocci
Copy link

rsocci commented Apr 4, 2014

@bcardarella still an issue?

@dtuite
Copy link

dtuite commented Apr 4, 2014

@rsocci Fixed for me on 2.3.0

@eadz
Copy link

eadz commented Jul 6, 2014

I have this issue and I'm not using email_spec..

maybe it's because of devise ( the email is a devise email )

gemfile

source 'https://rubygems.org'
gem 'unicorn'
gem 'rails', '4.1.0'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jbuilder', '~> 2.0'
gem 'nokogiri'
gem 'sidekiq'
gem 'sinatra', '>= 1.3.0', :require => nil # for sidekiq
gem 'zurb-foundation'
gem 'jquery-rails'
gem 'pg'
gem 'devise'

group :development do
  gem 'spring'
  gem 'dotenv'
  gem 'rest-client'
  gem 'simplecov', '~> 0.7.1'
  gem 'sprinkle'
end

group :development, :test do
  gem 'rspec-rails', '~> 2.99'
  gem 'rspec', '~> 2.99'
  gem 'rspec-its'
  gem 'cucumber-rails'
  gem 'database_cleaner'
  gem 'capybara-email'
end

group :test do
  gem "fakeredis", :require => "fakeredis/rspec"
end

@rahilsondhi
Copy link

I have the same problem. It seems capybara-email and email_spec conflict. I need both gems in my project, so my solution is to only include email spec in the specific unit tests I need like this:

include EmailSpec::Helpers
include EmailSpec::Matchers

And include capybara-email in my spec_helper require 'capybara/email/rspec'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants