user_notifier 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe UserNotifier::Mailer do
4
+ let(:user){ User.create email: 'foo@bar.com' }
5
+ let(:notification){ UserNotification.notify('test', user) }
6
+ let(:mailer){ UserNotifier::Mailer }
7
+
8
+ before{ user }
9
+
10
+ describe "#notify" do
11
+ subject{ mailer.notify(notification) }
12
+ its(:from){ should eq [] }
13
+ its(:reply_to){ should eq ["no-reply@yourdomain"] }
14
+ its(:to){ should eq ["foo@bar.com"] }
15
+
16
+ context "when notification's locale is en" do
17
+ let(:notification){ UserNotification.notify('test', user, nil, {locale: :en}) }
18
+ its(:subject){ should eq "test subject " }
19
+ it "should get body in english" do
20
+ expect(subject.body.to_s).to eq "test body\n\n"
21
+ end
22
+ end
23
+
24
+ context "when notification's locale is pt" do
25
+ let(:notification){ UserNotification.notify('test', user, nil, {locale: :pt}) }
26
+ its(:subject){ should eq "assunto de teste " }
27
+ it "should get body in english" do
28
+ expect(subject.body.to_s).to eq "corpo de teste\n\n"
29
+ end
30
+ end
31
+ end
32
+ end
33
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: user_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diogo Biazus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-15 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -129,6 +129,11 @@ files:
129
129
  - spec/dummy/app/models/order.rb
130
130
  - spec/dummy/app/models/user.rb
131
131
  - spec/dummy/app/views/layouts/application.html.erb
132
+ - spec/dummy/app/views/layouts/email.html.erb
133
+ - spec/dummy/app/views/user_notifier/mailer/test.en.html.erb
134
+ - spec/dummy/app/views/user_notifier/mailer/test.pt.html.erb
135
+ - spec/dummy/app/views/user_notifier/mailer/test_subject.en.text.erb
136
+ - spec/dummy/app/views/user_notifier/mailer/test_subject.pt.text.erb
132
137
  - spec/dummy/bin/bundle
133
138
  - spec/dummy/bin/rails
134
139
  - spec/dummy/bin/rake
@@ -148,6 +153,7 @@ files:
148
153
  - spec/dummy/config/initializers/session_store.rb
149
154
  - spec/dummy/config/initializers/wrap_parameters.rb
150
155
  - spec/dummy/config/locales/en.yml
156
+ - spec/dummy/config/locales/pt.yml
151
157
  - spec/dummy/config/routes.rb
152
158
  - spec/dummy/db/development.sqlite3
153
159
  - spec/dummy/db/migrate/20140625163719_create_users.rb
@@ -163,6 +169,7 @@ files:
163
169
  - spec/dummy/public/500.html
164
170
  - spec/dummy/public/favicon.ico
165
171
  - spec/lib/user_notifier/configuration_spec.rb
172
+ - spec/mailers/user_notifier/mailer_spec.rb
166
173
  - spec/models/user_notifier/base_spec.rb
167
174
  - spec/spec_helper.rb
168
175
  homepage: https://github.com/diogob/user_notifier
@@ -197,6 +204,11 @@ test_files:
197
204
  - spec/dummy/app/models/order.rb
198
205
  - spec/dummy/app/models/user.rb
199
206
  - spec/dummy/app/views/layouts/application.html.erb
207
+ - spec/dummy/app/views/layouts/email.html.erb
208
+ - spec/dummy/app/views/user_notifier/mailer/test.en.html.erb
209
+ - spec/dummy/app/views/user_notifier/mailer/test.pt.html.erb
210
+ - spec/dummy/app/views/user_notifier/mailer/test_subject.en.text.erb
211
+ - spec/dummy/app/views/user_notifier/mailer/test_subject.pt.text.erb
200
212
  - spec/dummy/bin/bundle
201
213
  - spec/dummy/bin/rails
202
214
  - spec/dummy/bin/rake
@@ -215,6 +227,7 @@ test_files:
215
227
  - spec/dummy/config/initializers/session_store.rb
216
228
  - spec/dummy/config/initializers/wrap_parameters.rb
217
229
  - spec/dummy/config/locales/en.yml
230
+ - spec/dummy/config/locales/pt.yml
218
231
  - spec/dummy/config/routes.rb
219
232
  - spec/dummy/config.ru
220
233
  - spec/dummy/db/development.sqlite3
@@ -233,5 +246,6 @@ test_files:
233
246
  - spec/dummy/Rakefile
234
247
  - spec/dummy/README.rdoc
235
248
  - spec/lib/user_notifier/configuration_spec.rb
249
+ - spec/mailers/user_notifier/mailer_spec.rb
236
250
  - spec/models/user_notifier/base_spec.rb
237
251
  - spec/spec_helper.rb