text_helpers 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 996306b0551d3cd8246576a7defc878787d17469
4
- data.tar.gz: 64432996505abf2e1e6b837c3c587f07644ac8fd
3
+ metadata.gz: 274c1b8e544c80680eba4a1267782118c02dceb2
4
+ data.tar.gz: abbecfe7f9ef9595b7a6d852f6c7d9f91e91004c
5
5
  SHA512:
6
- metadata.gz: 5b5660acf1e43a12751ed2cc6922419f8d37acc1363899fa66f2dd165097a4e88def4324bdcaaf438ba37ec1de2ec81e5fe1b83b3b00a9d7f88befaee66baf9f
7
- data.tar.gz: 3e47547c8df102e6c60afa5e1a45ac726a4890b14b7e07c161505f3f8baac9c7250cbea9d8e7f82ddbfab6415db19658666f8ec576d2f1d070b4a5f1a3b804d0
6
+ metadata.gz: 9c202226b2b8ae93d52ce223a0b6cc866f1d2a3c6c725e5956482a9e448d82e4d03f065431dfe1c3e73c17da6ed8e0b1dd0297ee1db6f6ac410635956345883e
7
+ data.tar.gz: f076df16353840899e5d6e323c71662f4bb71392447f41e5ed1e655681ef9e2bf9b0ccb25db311bbc4f429799e465e4fcfa30ae1e5de506c3f41c34571deeb65
@@ -1,3 +1,21 @@
1
+ shared_context "a controller spec", controller: true do
2
+ include TextHelpers::Translation
3
+
4
+ def translation_scope
5
+ controller_name = described_class.name.sub(/Controller\z/, '').underscore
6
+ "controllers.#{controller_name}"
7
+ end
8
+ end
9
+
10
+ shared_context "a mailer spec", mailer: true do
11
+ include TextHelpers::Translation
12
+
13
+ def translation_scope
14
+ mailer_name = described_class.name.sub(/Mailer\z/, '').underscore
15
+ "mailers.#{mailer_name}"
16
+ end
17
+ end
18
+
1
19
  shared_context "a view spec", view: true do
2
20
  include TextHelpers::Translation
3
21
 
@@ -13,12 +31,3 @@ shared_context "a view spec", view: true do
13
31
  end
14
32
  end
15
33
  end
16
-
17
- shared_context "a controller spec", controller: true do
18
- include TextHelpers::Translation
19
-
20
- def translation_scope
21
- controller_name = described_class.name.sub(/Controller\z/, '').underscore
22
- "controllers.#{controller_name}"
23
- end
24
- end
@@ -28,6 +28,21 @@ module TextHelpers
28
28
  end
29
29
  end
30
30
 
31
+ class ActionMailer::Base
32
+ include TextHelpers::Translation
33
+
34
+ protected
35
+
36
+ # Protected: Provides a scope for I18n lookups.
37
+ #
38
+ # Should look like `mailers.<mailer>.<action>`
39
+ #
40
+ # Returns a String.
41
+ def translation_scope
42
+ "mailers.#{mailer_name.tr("/", ".").sub("_mailer", "")}.#{action_name}"
43
+ end
44
+ end
45
+
31
46
  class ActionController::Base
32
47
  include TextHelpers::Translation
33
48
 
@@ -1,3 +1,3 @@
1
1
  module TextHelpers
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: text_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Horner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-01 00:00:00.000000000 Z
11
+ date: 2013-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport