capybara-email
capybara-email copied to clipboard
undefined method `click_link' for #<Mail::Message:0x0000000877db18>
when I do like the example to test link inside the email I get this error " undefined method `click_link' for #Mail::Message:0x0000000877db18 "
Can you provide an example of what you're doing in your code along with what version of the gem you are using?
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
I'm getting a NotImplementedError for the same thing.
Can I get a list of gems you have in your app? I am not able to recreate.
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
Thank you, we have our open source day on Friday. I'll get to work on this then.
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
Just FYI this persists in 2.2.1
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:

capybara-email:

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
@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
@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.
@sid137 @bcardarella Confirmed. Removing email_spec fixes the issue.
@bcardarella still an issue?
@rsocci Fixed for me on 2.3.0
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
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'