rspec-mailer_matcher 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +36 -0
- data/.github/workflows/release.yml +52 -0
- data/.github/workflows/test.yml +20 -0
- data/README.md +23 -1
- data/lib/mailer_matcher/version.rb +1 -1
- data/lib/rspec-mailer_matcher.rb +10 -7
- data/rspec-mailer_matcher.gemspec +3 -3
- metadata +20 -22
- data/Gemfile.lock +0 -35
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b8849da66d7a1c28bc68c648dc5400476ec0ec97e78c98e18bbbc66f88c0df0
|
|
4
|
+
data.tar.gz: c3c43e2d812eba78de21372cd979e478ecf2058dc546c4236b3470348c9ef428
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3efbd737b7ba04959fe63e00c63793d6f7a799a84c5269e0e05e43b50f9bb0f8a0a56649856267fad9128b1999be43949eca552a79bf5bfd6eb6d858045661d1
|
|
7
|
+
data.tar.gz: 0e7be1021032915217fe581471f3365ec928e007627683977529b79bb4117d04f9fa4dd656b16db7de8db9ebfa72e38008e1785637961935282d261b5a81ab9e
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: bundler
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: daily
|
|
7
|
+
open-pull-requests-limit: 10
|
|
8
|
+
ignore:
|
|
9
|
+
- dependency-name: nokogiri
|
|
10
|
+
versions:
|
|
11
|
+
- 1.11.1
|
|
12
|
+
- 1.11.2
|
|
13
|
+
- dependency-name: actionmailer
|
|
14
|
+
versions:
|
|
15
|
+
- 6.1.1
|
|
16
|
+
- 6.1.2
|
|
17
|
+
- 6.1.2.1
|
|
18
|
+
- 6.1.3
|
|
19
|
+
- dependency-name: actionview
|
|
20
|
+
versions:
|
|
21
|
+
- 6.1.1
|
|
22
|
+
- 6.1.2
|
|
23
|
+
- 6.1.2.1
|
|
24
|
+
- 6.1.3
|
|
25
|
+
- dependency-name: activesupport
|
|
26
|
+
versions:
|
|
27
|
+
- 6.1.1
|
|
28
|
+
- 6.1.2
|
|
29
|
+
- 6.1.2.1
|
|
30
|
+
- 6.1.3
|
|
31
|
+
- dependency-name: actionpack
|
|
32
|
+
versions:
|
|
33
|
+
- 6.1.1
|
|
34
|
+
- 6.1.2
|
|
35
|
+
- 6.1.2.1
|
|
36
|
+
- 6.1.3
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
bump:
|
|
7
|
+
description: "Version bump type"
|
|
8
|
+
required: true
|
|
9
|
+
type: choice
|
|
10
|
+
options:
|
|
11
|
+
- patch
|
|
12
|
+
- minor
|
|
13
|
+
- major
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: write
|
|
17
|
+
id-token: write
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
release:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v6
|
|
24
|
+
|
|
25
|
+
- name: Set up Ruby
|
|
26
|
+
uses: ruby/setup-ruby@v1
|
|
27
|
+
with:
|
|
28
|
+
ruby-version: ruby
|
|
29
|
+
bundler-cache: true
|
|
30
|
+
|
|
31
|
+
- name: Install gem-release
|
|
32
|
+
run: gem install gem-release
|
|
33
|
+
|
|
34
|
+
- name: Configure git
|
|
35
|
+
run: |
|
|
36
|
+
git config user.name "github-actions[bot]"
|
|
37
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
38
|
+
|
|
39
|
+
- name: Bump version, commit, tag, push
|
|
40
|
+
id: version
|
|
41
|
+
run: |
|
|
42
|
+
gem bump --version ${{ inputs.bump }} --file lib/mailer_matcher/version.rb --tag --push
|
|
43
|
+
new=$(ruby -r ./lib/mailer_matcher/version -e 'print MailerMatcher::VERSION')
|
|
44
|
+
echo "tag=v${new}" >> "$GITHUB_OUTPUT"
|
|
45
|
+
|
|
46
|
+
- name: Create GitHub Release
|
|
47
|
+
run: gh release create "${{ steps.version.outputs.tag }}" --generate-notes
|
|
48
|
+
env:
|
|
49
|
+
GH_TOKEN: ${{ github.token }}
|
|
50
|
+
|
|
51
|
+
- name: Publish gem to RubyGems
|
|
52
|
+
uses: rubygems/release-gem@v1
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
matrix:
|
|
10
|
+
ruby: ["3.3", "3.4", "4.0"]
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v6
|
|
14
|
+
- name: Set up Ruby
|
|
15
|
+
uses: ruby/setup-ruby@v1
|
|
16
|
+
with:
|
|
17
|
+
ruby-version: ${{ matrix.ruby }}
|
|
18
|
+
bundler-cache: true
|
|
19
|
+
- name: Build and test with Rake
|
|
20
|
+
run: bundle exec rake
|
data/README.md
CHANGED
|
@@ -19,8 +19,30 @@ Or install it yourself as:
|
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
|
+
First of all, add the following line to your `spec_helper.rb` or `rails_helper.rb`:
|
|
23
|
+
|
|
24
|
+
```ruby
|
|
25
|
+
require 'rspec-mailer_matcher'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then, you can use `deliver` matcher:
|
|
29
|
+
|
|
22
30
|
```ruby
|
|
23
|
-
|
|
31
|
+
it {
|
|
32
|
+
expect { _any_action_ }.to deliver to: 'to@example.org', from: 'from@example.org', subject: 'Hello world'
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
or using `subject` block:
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
subject {
|
|
40
|
+
proc { _any_action_ }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
it {
|
|
44
|
+
is_expected.to deliver to: 'to@example.org', from: 'from@example.org', subject: 'Hello world'
|
|
45
|
+
}
|
|
24
46
|
```
|
|
25
47
|
|
|
26
48
|
## Development
|
data/lib/rspec-mailer_matcher.rb
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
require 'mailer_matcher/version'
|
|
2
|
+
require 'action_mailer'
|
|
2
3
|
|
|
3
4
|
RSpec::Matchers.define :deliver do
|
|
4
5
|
supports_block_expectations
|
|
5
6
|
|
|
6
7
|
match do
|
|
7
8
|
mail_keys = %i[to from subject]
|
|
8
|
-
if actual.is_a?(Proc) && expected.is_a?(Hash) && (expected.keys - mail_keys).
|
|
9
|
+
if actual.is_a?(Proc) && expected.is_a?(Hash) && (expected.keys - mail_keys).empty?
|
|
9
10
|
deliveries = ActionMailer::Base.deliveries.clone
|
|
10
11
|
actual.call
|
|
11
12
|
new_deliveries = ActionMailer::Base.deliveries - deliveries
|
|
12
13
|
|
|
13
14
|
expected_mail = new_deliveries.find { |mail|
|
|
14
|
-
|
|
15
|
-
if expected[:to].present?
|
|
15
|
+
unless expected[:to].nil?
|
|
16
16
|
matched = mail.to.include? expected[:to]
|
|
17
|
+
next unless matched
|
|
17
18
|
end
|
|
18
|
-
|
|
19
|
+
unless expected[:subject].nil?
|
|
19
20
|
matched = mail.subject == expected[:subject]
|
|
21
|
+
next unless matched
|
|
20
22
|
end
|
|
21
|
-
|
|
23
|
+
unless expected[:from].nil?
|
|
22
24
|
matched = mail.from.include? expected[:from]
|
|
25
|
+
next unless matched
|
|
23
26
|
end
|
|
24
|
-
|
|
27
|
+
true
|
|
25
28
|
}
|
|
26
|
-
expected_mail.
|
|
29
|
+
!expected_mail.nil?
|
|
27
30
|
else
|
|
28
31
|
false
|
|
29
32
|
end
|
|
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
|
36
36
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
37
37
|
spec.require_paths = ["lib"]
|
|
38
38
|
|
|
39
|
-
spec.
|
|
40
|
-
spec.add_development_dependency "rake"
|
|
41
|
-
spec.add_development_dependency "rspec"
|
|
39
|
+
spec.add_dependency "actionmailer"
|
|
40
|
+
spec.add_development_dependency "rake"
|
|
41
|
+
spec.add_development_dependency "rspec"
|
|
42
42
|
end
|
metadata
CHANGED
|
@@ -1,57 +1,56 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-mailer_matcher
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- d-mato
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: actionmailer
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
|
-
- - "
|
|
16
|
+
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
20
|
-
type: :
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
|
-
- - "
|
|
23
|
+
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
25
|
+
version: '0'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
27
|
name: rake
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
|
-
- - "
|
|
30
|
+
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
32
|
+
version: '0'
|
|
34
33
|
type: :development
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
|
-
- - "
|
|
37
|
+
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
39
|
+
version: '0'
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
41
|
name: rspec
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
43
|
requirements:
|
|
45
|
-
- - "
|
|
44
|
+
- - ">="
|
|
46
45
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
46
|
+
version: '0'
|
|
48
47
|
type: :development
|
|
49
48
|
prerelease: false
|
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
50
|
requirements:
|
|
52
|
-
- - "
|
|
51
|
+
- - ">="
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
53
|
+
version: '0'
|
|
55
54
|
description: Rspec macther for ActionMailer
|
|
56
55
|
email:
|
|
57
56
|
- telnetstat@gmail.com
|
|
@@ -59,11 +58,13 @@ executables: []
|
|
|
59
58
|
extensions: []
|
|
60
59
|
extra_rdoc_files: []
|
|
61
60
|
files:
|
|
61
|
+
- ".github/dependabot.yml"
|
|
62
|
+
- ".github/workflows/release.yml"
|
|
63
|
+
- ".github/workflows/test.yml"
|
|
62
64
|
- ".gitignore"
|
|
63
65
|
- ".rspec"
|
|
64
66
|
- ".travis.yml"
|
|
65
67
|
- Gemfile
|
|
66
|
-
- Gemfile.lock
|
|
67
68
|
- LICENSE.txt
|
|
68
69
|
- README.md
|
|
69
70
|
- Rakefile
|
|
@@ -76,7 +77,6 @@ homepage: https://github.com/d-mato/rspec-mailer_matcher
|
|
|
76
77
|
licenses:
|
|
77
78
|
- MIT
|
|
78
79
|
metadata: {}
|
|
79
|
-
post_install_message:
|
|
80
80
|
rdoc_options: []
|
|
81
81
|
require_paths:
|
|
82
82
|
- lib
|
|
@@ -91,9 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
91
91
|
- !ruby/object:Gem::Version
|
|
92
92
|
version: '0'
|
|
93
93
|
requirements: []
|
|
94
|
-
|
|
95
|
-
rubygems_version: 2.7.6
|
|
96
|
-
signing_key:
|
|
94
|
+
rubygems_version: 4.0.6
|
|
97
95
|
specification_version: 4
|
|
98
96
|
summary: Rspec macther for ActionMailer
|
|
99
97
|
test_files: []
|
data/Gemfile.lock
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
rspec-mailer_matcher (0.1.0)
|
|
5
|
-
|
|
6
|
-
GEM
|
|
7
|
-
remote: https://rubygems.org/
|
|
8
|
-
specs:
|
|
9
|
-
diff-lcs (1.3)
|
|
10
|
-
rake (10.5.0)
|
|
11
|
-
rspec (3.8.0)
|
|
12
|
-
rspec-core (~> 3.8.0)
|
|
13
|
-
rspec-expectations (~> 3.8.0)
|
|
14
|
-
rspec-mocks (~> 3.8.0)
|
|
15
|
-
rspec-core (3.8.0)
|
|
16
|
-
rspec-support (~> 3.8.0)
|
|
17
|
-
rspec-expectations (3.8.2)
|
|
18
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
19
|
-
rspec-support (~> 3.8.0)
|
|
20
|
-
rspec-mocks (3.8.0)
|
|
21
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
22
|
-
rspec-support (~> 3.8.0)
|
|
23
|
-
rspec-support (3.8.0)
|
|
24
|
-
|
|
25
|
-
PLATFORMS
|
|
26
|
-
ruby
|
|
27
|
-
|
|
28
|
-
DEPENDENCIES
|
|
29
|
-
bundler (~> 1.17)
|
|
30
|
-
rake (~> 10.0)
|
|
31
|
-
rspec (~> 3.0)
|
|
32
|
-
rspec-mailer_matcher!
|
|
33
|
-
|
|
34
|
-
BUNDLED WITH
|
|
35
|
-
1.17.1
|