decent_exposure 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/decent_exposure/mailer.rb +2 -1
- data/lib/decent_exposure/version.rb +1 -1
- data/spec/features/birds_mailer_spec.rb +26 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c9a6c2a86d5405d34833d333e2786a9a020880a
|
4
|
+
data.tar.gz: 8f0b11451440f2cf4fda457e664fa428b632e4a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d3ab21ece1e48a834ccca316a055918c71c93540a7da92ead194b418bc13892be81fa0aa989d8c923b729148f03def10380e59a7c1280638cf641055135269b
|
7
|
+
data.tar.gz: e8fe7a63933c623650566b27b937a772faafde5b2933955c6789f2fc06f1af3b4b4ebf7467003452ee3a5737942b90af270e5baf59a2100a79ed8578f460bad9
|
data/CHANGELOG.md
CHANGED
@@ -6,19 +6,29 @@ require "action_mailer"
|
|
6
6
|
class BirdsMailer < ActionMailer::Base
|
7
7
|
end
|
8
8
|
|
9
|
+
class BirdsMailer
|
10
|
+
expose(:birds, -> { Bird.all })
|
11
|
+
expose(:bird)
|
12
|
+
|
13
|
+
def hello_birds
|
14
|
+
mail { |format| format.text { render plain: "Hello #{birds}" } }
|
15
|
+
end
|
16
|
+
|
17
|
+
def hello_bird(id:)
|
18
|
+
mail { |format| format.text { render plain: "Hello #{bird}" } }
|
19
|
+
end
|
20
|
+
|
21
|
+
def hello_bird_by_id(id)
|
22
|
+
bird = Bird.find(id)
|
23
|
+
mail { |format| format.text { render plain: "Hello #{bird}" } }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
9
27
|
RSpec.describe BirdsMailer, type: :mailer do
|
10
28
|
let(:bird){ double :bird }
|
11
29
|
let(:birds) { double :birds }
|
12
30
|
|
13
31
|
context "when birds relation is exposed" do
|
14
|
-
class BirdsMailer
|
15
|
-
expose(:birds, -> { Bird.all })
|
16
|
-
|
17
|
-
def hello_birds
|
18
|
-
mail { |format| format.text { render plain: "Hello #{birds}" } }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
32
|
it "sends the email with exposed birds" do
|
23
33
|
expect(Bird).to receive(:all).and_return(birds)
|
24
34
|
expect(described_class.hello_birds.body.to_s)
|
@@ -27,18 +37,18 @@ RSpec.describe BirdsMailer, type: :mailer do
|
|
27
37
|
end
|
28
38
|
|
29
39
|
context "when bird is exposed" do
|
30
|
-
class BirdsMailer
|
31
|
-
expose(:bird)
|
32
|
-
|
33
|
-
def hello_bird(id:)
|
34
|
-
mail { |format| format.text { render plain: "Hello #{bird}" } }
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
40
|
it "sends the email with exposed bird" do
|
39
41
|
expect(Bird).to receive(:find).with('some-id').and_return(bird)
|
40
42
|
expect(described_class.hello_bird(id: 'some-id').body.to_s)
|
41
43
|
.to include("Hello #{bird}")
|
42
44
|
end
|
43
45
|
end
|
46
|
+
|
47
|
+
context "with non hash argument" do
|
48
|
+
it "does not set params" do
|
49
|
+
expect(Bird).to receive(:find).with('some-id').and_return(bird)
|
50
|
+
expect(described_class.hello_bird_by_id('some-id').body.to_s)
|
51
|
+
.to include("Hello #{bird}")
|
52
|
+
end
|
53
|
+
end
|
44
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decent_exposure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pravosud
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
12
|
+
date: 2016-10-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|