email_test_helpers 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/Appraisals +17 -0
  6. data/CODE_OF_CONDUCT.md +13 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +67 -0
  10. data/Rakefile +10 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +7 -0
  13. data/email_test_helpers.gemspec +30 -0
  14. data/gemfiles/actionmailer_3.0.0_capybara_1.0.0.gemfile +8 -0
  15. data/gemfiles/actionmailer_3.0.0_capybara_1.1.0.gemfile +8 -0
  16. data/gemfiles/actionmailer_3.0.0_capybara_2.0.0.gemfile +8 -0
  17. data/gemfiles/actionmailer_3.0.0_capybara_2.1.0.gemfile +8 -0
  18. data/gemfiles/actionmailer_3.0.0_capybara_2.2.0.gemfile +8 -0
  19. data/gemfiles/actionmailer_3.0.0_capybara_2.3.0.gemfile +8 -0
  20. data/gemfiles/actionmailer_3.0.0_capybara_2.4.0.gemfile +8 -0
  21. data/gemfiles/actionmailer_3.1.0_capybara_1.0.0.gemfile +8 -0
  22. data/gemfiles/actionmailer_3.1.0_capybara_1.1.0.gemfile +8 -0
  23. data/gemfiles/actionmailer_3.1.0_capybara_2.0.0.gemfile +8 -0
  24. data/gemfiles/actionmailer_3.1.0_capybara_2.1.0.gemfile +8 -0
  25. data/gemfiles/actionmailer_3.1.0_capybara_2.2.0.gemfile +8 -0
  26. data/gemfiles/actionmailer_3.1.0_capybara_2.3.0.gemfile +8 -0
  27. data/gemfiles/actionmailer_3.1.0_capybara_2.4.0.gemfile +8 -0
  28. data/gemfiles/actionmailer_3.2.0_capybara_1.0.0.gemfile +8 -0
  29. data/gemfiles/actionmailer_3.2.0_capybara_1.1.0.gemfile +8 -0
  30. data/gemfiles/actionmailer_3.2.0_capybara_2.0.0.gemfile +8 -0
  31. data/gemfiles/actionmailer_3.2.0_capybara_2.1.0.gemfile +8 -0
  32. data/gemfiles/actionmailer_3.2.0_capybara_2.2.0.gemfile +8 -0
  33. data/gemfiles/actionmailer_3.2.0_capybara_2.3.0.gemfile +8 -0
  34. data/gemfiles/actionmailer_3.2.0_capybara_2.4.0.gemfile +8 -0
  35. data/gemfiles/actionmailer_4.0.0_capybara_1.0.0.gemfile +8 -0
  36. data/gemfiles/actionmailer_4.0.0_capybara_1.1.0.gemfile +8 -0
  37. data/gemfiles/actionmailer_4.0.0_capybara_2.0.0.gemfile +8 -0
  38. data/gemfiles/actionmailer_4.0.0_capybara_2.1.0.gemfile +8 -0
  39. data/gemfiles/actionmailer_4.0.0_capybara_2.2.0.gemfile +8 -0
  40. data/gemfiles/actionmailer_4.0.0_capybara_2.3.0.gemfile +8 -0
  41. data/gemfiles/actionmailer_4.0.0_capybara_2.4.0.gemfile +8 -0
  42. data/gemfiles/actionmailer_4.1.0_capybara_1.0.0.gemfile +8 -0
  43. data/gemfiles/actionmailer_4.1.0_capybara_1.1.0.gemfile +8 -0
  44. data/gemfiles/actionmailer_4.1.0_capybara_2.0.0.gemfile +8 -0
  45. data/gemfiles/actionmailer_4.1.0_capybara_2.1.0.gemfile +8 -0
  46. data/gemfiles/actionmailer_4.1.0_capybara_2.2.0.gemfile +8 -0
  47. data/gemfiles/actionmailer_4.1.0_capybara_2.3.0.gemfile +8 -0
  48. data/gemfiles/actionmailer_4.1.0_capybara_2.4.0.gemfile +8 -0
  49. data/gemfiles/actionmailer_4.2.0_capybara_1.0.0.gemfile +8 -0
  50. data/gemfiles/actionmailer_4.2.0_capybara_1.1.0.gemfile +8 -0
  51. data/gemfiles/actionmailer_4.2.0_capybara_2.0.0.gemfile +8 -0
  52. data/gemfiles/actionmailer_4.2.0_capybara_2.1.0.gemfile +8 -0
  53. data/gemfiles/actionmailer_4.2.0_capybara_2.2.0.gemfile +8 -0
  54. data/gemfiles/actionmailer_4.2.0_capybara_2.3.0.gemfile +8 -0
  55. data/gemfiles/actionmailer_4.2.0_capybara_2.4.0.gemfile +8 -0
  56. data/lib/email_test_helpers/version.rb +3 -0
  57. data/lib/email_test_helpers.rb +47 -0
  58. metadata +198 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 41d7a056dfbf8f16212ce23a29cfa6d4f576b4ed
4
+ data.tar.gz: 12ab31396a2608a86391938cdfdc047d8e7f63cc
5
+ SHA512:
6
+ metadata.gz: 4bd54f712b97d8325ad74ac6558b25d825f24352e42053467b69f07657f76f8c683ef5259a21ce73b4f3fb7870235fdc47884a7726ebc07f35b8e0a9348f1a84
7
+ data.tar.gz: c91300738447594e6106942429296ab001525bae2c962803518ea463fb46512cdf9f5bc70d12997a7ac964bdee8128442d82efd89d2d7516d1687e83f1403da6
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /gemfiles/*.gemfile.lock
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.2.1
data/Appraisals ADDED
@@ -0,0 +1,17 @@
1
+ # Supported ActionMailer versions
2
+ actionmailer_versions = [
3
+ '3.0.0', '3.1.0', '3.2.0',
4
+ '4.0.0', '4.1.0', '4.2.0',
5
+ ]
6
+ # Supported Capybara versions
7
+ capybara_versions = [
8
+ '1.0.0', '1.1.0',
9
+ '2.0.0', '2.1.0', '2.2.0', '2.3.0', '2.4.0',
10
+ ]
11
+
12
+ actionmailer_versions.product(capybara_versions).each do |actionmailer_version, capybara_version|
13
+ appraise "actionmailer-#{actionmailer_version} capybara-#{capybara_version}" do
14
+ gem 'actionmailer', actionmailer_version
15
+ gem 'capybara', capybara_version
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in email_test_helpers.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Zubin Henner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # EmailTestHelpers
2
+
3
+ Simple acceptance test helpers for emails
4
+
5
+ [![Build Status](https://travis-ci.org/zubin/email_test_helpers.svg)](https://travis-ci.org/zubin/email_test_helpers)
6
+
7
+ ## Features
8
+
9
+ * Find emails with optional criteria: recipient (to, cc, bcc), subject, body
10
+ * Click links in emails
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'email_test_helpers', group: :test
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install email_test_helpers
27
+
28
+ Load it in your test library of choice, eg:
29
+
30
+ # spec/support/email_test_helpers.rb
31
+ RSpec.configure do |config|
32
+ config.include EmailTestHelpers
33
+ end
34
+
35
+ # features/support/email_test_helpers.rb
36
+ World(EmailTestHelpers)
37
+
38
+ ## Usage
39
+
40
+ Main methods are:
41
+
42
+ * `find_email`
43
+ * returns the most recent email matching optional criteria
44
+ * raises NotFound when no matches
45
+ * optional criteria:
46
+ * to (email address)
47
+ * cc (email address)
48
+ * bcc (email address)
49
+ * subject (string: exact match; or regexp)
50
+ * `click_email_link`
51
+ * follows first link matching optional argument
52
+ * in most recently found email or last sent email when no previous searches
53
+ * argument can be URL or link text
54
+ * argument can be string (exact match) or regexp
55
+
56
+ For example, to assert an email confirmation was sent and click the confirmation link:
57
+
58
+ find_email to: @current_user.email, subject: /confirm/i
59
+ click_email_link /confirm/i
60
+
61
+ See `spec/email_test_helpers_spec.rb` for more details.
62
+
63
+ ## Licence
64
+
65
+ MIT Licence
66
+
67
+ (c) 2015 Zubin Henner
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'bundler/gem_tasks'
4
+
5
+ begin
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new(:spec)
8
+ task default: :spec
9
+ rescue LoadError
10
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "email_test_helpers"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'email_test_helpers/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'email_test_helpers'
8
+ spec.version = EmailTestHelpers::VERSION
9
+ spec.authors = ["Zubin Henner"]
10
+ spec.email = ['zubin@rubidium.com.au']
11
+
12
+ spec.summary = %q{Simple acceptance test helpers for emails}
13
+ spec.description = %q{Adds ability to find emails and click links in them}
14
+ spec.homepage = 'https://github.com/zubin/email_test_helpers'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_dependency 'actionmailer', '>= 3.0.0'
23
+ spec.add_dependency 'capybara', '>= 1.0.0'
24
+
25
+ spec.add_development_dependency 'appraisal'
26
+ spec.add_development_dependency 'rake'
27
+ spec.add_development_dependency 'rspec-core', '~> 3.2.0'
28
+ spec.add_development_dependency 'rspec-expectations'
29
+ spec.add_development_dependency 'rspec-mocks'
30
+ end
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.0.0"
6
+ gem "capybara", "1.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.0.0"
6
+ gem "capybara", "1.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.0.0"
6
+ gem "capybara", "2.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.0.0"
6
+ gem "capybara", "2.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.0.0"
6
+ gem "capybara", "2.2.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.0.0"
6
+ gem "capybara", "2.3.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.0.0"
6
+ gem "capybara", "2.4.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.1.0"
6
+ gem "capybara", "1.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.1.0"
6
+ gem "capybara", "1.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.1.0"
6
+ gem "capybara", "2.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.1.0"
6
+ gem "capybara", "2.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.1.0"
6
+ gem "capybara", "2.2.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.1.0"
6
+ gem "capybara", "2.3.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.1.0"
6
+ gem "capybara", "2.4.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.2.0"
6
+ gem "capybara", "1.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.2.0"
6
+ gem "capybara", "1.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.2.0"
6
+ gem "capybara", "2.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.2.0"
6
+ gem "capybara", "2.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.2.0"
6
+ gem "capybara", "2.2.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.2.0"
6
+ gem "capybara", "2.3.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "3.2.0"
6
+ gem "capybara", "2.4.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.0.0"
6
+ gem "capybara", "1.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.0.0"
6
+ gem "capybara", "1.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.0.0"
6
+ gem "capybara", "2.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.0.0"
6
+ gem "capybara", "2.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.0.0"
6
+ gem "capybara", "2.2.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.0.0"
6
+ gem "capybara", "2.3.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.0.0"
6
+ gem "capybara", "2.4.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.1.0"
6
+ gem "capybara", "1.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.1.0"
6
+ gem "capybara", "1.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.1.0"
6
+ gem "capybara", "2.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.1.0"
6
+ gem "capybara", "2.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.1.0"
6
+ gem "capybara", "2.2.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.1.0"
6
+ gem "capybara", "2.3.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.1.0"
6
+ gem "capybara", "2.4.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.2.0"
6
+ gem "capybara", "1.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.2.0"
6
+ gem "capybara", "1.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.2.0"
6
+ gem "capybara", "2.0.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.2.0"
6
+ gem "capybara", "2.1.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.2.0"
6
+ gem "capybara", "2.2.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.2.0"
6
+ gem "capybara", "2.3.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "actionmailer", "4.2.0"
6
+ gem "capybara", "2.4.0"
7
+
8
+ gemspec :path => "../"
@@ -0,0 +1,3 @@
1
+ module EmailTestHelpers
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,47 @@
1
+ require 'email_test_helpers/version'
2
+ require 'action_mailer'
3
+ require 'capybara'
4
+
5
+ module EmailTestHelpers
6
+ NotFound = Class.new(StandardError)
7
+
8
+ def click_email_link(key)
9
+ visit find_email_link(key)
10
+ end
11
+
12
+ def emails
13
+ ActionMailer::Base.deliveries
14
+ end
15
+
16
+ def find_email(options = {})
17
+ @last_email = emails.reverse.detect do |mail|
18
+ [
19
+ options[:to].nil? || mail.to.include?(options[:to]),
20
+ options[:cc].nil? || mail.cc.include?(options[:cc]),
21
+ options[:bcc].nil? || mail.bcc.include?(options[:bcc]),
22
+ options[:subject].nil? || options[:subject] === mail.subject,
23
+ ].all?
24
+ end or raise(NotFound, "Couldn't find email with options: #{options.inspect}")
25
+ end
26
+
27
+ def find_email_link(key = nil)
28
+ if key
29
+ e = Capybara.string(last_email_body).first("a[href*='#{key}']") ||
30
+ Capybara.string(last_email_body).first("a", text: key) or
31
+ raise(NotFound, "Couldn't find link with key: #{key}")
32
+ e['href']
33
+ else
34
+ Capybara.string(last_email_body).first('a')['href']
35
+ end
36
+ end
37
+
38
+ private
39
+
40
+ def last_email
41
+ @last_email || find_email
42
+ end
43
+
44
+ def last_email_body
45
+ last_email.body.raw_source
46
+ end
47
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: email_test_helpers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Zubin Henner
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: actionmailer
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: capybara
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: appraisal
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-core
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.2.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.2.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-expectations
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-mocks
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Adds ability to find emails and click links in them
112
+ email:
113
+ - zubin@rubidium.com.au
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".travis.yml"
121
+ - Appraisals
122
+ - CODE_OF_CONDUCT.md
123
+ - Gemfile
124
+ - LICENSE.txt
125
+ - README.md
126
+ - Rakefile
127
+ - bin/console
128
+ - bin/setup
129
+ - email_test_helpers.gemspec
130
+ - gemfiles/actionmailer_3.0.0_capybara_1.0.0.gemfile
131
+ - gemfiles/actionmailer_3.0.0_capybara_1.1.0.gemfile
132
+ - gemfiles/actionmailer_3.0.0_capybara_2.0.0.gemfile
133
+ - gemfiles/actionmailer_3.0.0_capybara_2.1.0.gemfile
134
+ - gemfiles/actionmailer_3.0.0_capybara_2.2.0.gemfile
135
+ - gemfiles/actionmailer_3.0.0_capybara_2.3.0.gemfile
136
+ - gemfiles/actionmailer_3.0.0_capybara_2.4.0.gemfile
137
+ - gemfiles/actionmailer_3.1.0_capybara_1.0.0.gemfile
138
+ - gemfiles/actionmailer_3.1.0_capybara_1.1.0.gemfile
139
+ - gemfiles/actionmailer_3.1.0_capybara_2.0.0.gemfile
140
+ - gemfiles/actionmailer_3.1.0_capybara_2.1.0.gemfile
141
+ - gemfiles/actionmailer_3.1.0_capybara_2.2.0.gemfile
142
+ - gemfiles/actionmailer_3.1.0_capybara_2.3.0.gemfile
143
+ - gemfiles/actionmailer_3.1.0_capybara_2.4.0.gemfile
144
+ - gemfiles/actionmailer_3.2.0_capybara_1.0.0.gemfile
145
+ - gemfiles/actionmailer_3.2.0_capybara_1.1.0.gemfile
146
+ - gemfiles/actionmailer_3.2.0_capybara_2.0.0.gemfile
147
+ - gemfiles/actionmailer_3.2.0_capybara_2.1.0.gemfile
148
+ - gemfiles/actionmailer_3.2.0_capybara_2.2.0.gemfile
149
+ - gemfiles/actionmailer_3.2.0_capybara_2.3.0.gemfile
150
+ - gemfiles/actionmailer_3.2.0_capybara_2.4.0.gemfile
151
+ - gemfiles/actionmailer_4.0.0_capybara_1.0.0.gemfile
152
+ - gemfiles/actionmailer_4.0.0_capybara_1.1.0.gemfile
153
+ - gemfiles/actionmailer_4.0.0_capybara_2.0.0.gemfile
154
+ - gemfiles/actionmailer_4.0.0_capybara_2.1.0.gemfile
155
+ - gemfiles/actionmailer_4.0.0_capybara_2.2.0.gemfile
156
+ - gemfiles/actionmailer_4.0.0_capybara_2.3.0.gemfile
157
+ - gemfiles/actionmailer_4.0.0_capybara_2.4.0.gemfile
158
+ - gemfiles/actionmailer_4.1.0_capybara_1.0.0.gemfile
159
+ - gemfiles/actionmailer_4.1.0_capybara_1.1.0.gemfile
160
+ - gemfiles/actionmailer_4.1.0_capybara_2.0.0.gemfile
161
+ - gemfiles/actionmailer_4.1.0_capybara_2.1.0.gemfile
162
+ - gemfiles/actionmailer_4.1.0_capybara_2.2.0.gemfile
163
+ - gemfiles/actionmailer_4.1.0_capybara_2.3.0.gemfile
164
+ - gemfiles/actionmailer_4.1.0_capybara_2.4.0.gemfile
165
+ - gemfiles/actionmailer_4.2.0_capybara_1.0.0.gemfile
166
+ - gemfiles/actionmailer_4.2.0_capybara_1.1.0.gemfile
167
+ - gemfiles/actionmailer_4.2.0_capybara_2.0.0.gemfile
168
+ - gemfiles/actionmailer_4.2.0_capybara_2.1.0.gemfile
169
+ - gemfiles/actionmailer_4.2.0_capybara_2.2.0.gemfile
170
+ - gemfiles/actionmailer_4.2.0_capybara_2.3.0.gemfile
171
+ - gemfiles/actionmailer_4.2.0_capybara_2.4.0.gemfile
172
+ - lib/email_test_helpers.rb
173
+ - lib/email_test_helpers/version.rb
174
+ homepage: https://github.com/zubin/email_test_helpers
175
+ licenses:
176
+ - MIT
177
+ metadata: {}
178
+ post_install_message:
179
+ rdoc_options: []
180
+ require_paths:
181
+ - lib
182
+ required_ruby_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ requirements: []
193
+ rubyforge_project:
194
+ rubygems_version: 2.4.5
195
+ signing_key:
196
+ specification_version: 4
197
+ summary: Simple acceptance test helpers for emails
198
+ test_files: []