text_helpers 0.1.2 → 0.1.3
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/lib/text_helpers/contexts.rb +18 -9
- data/lib/text_helpers/railtie.rb +15 -0
- data/lib/text_helpers/version.rb +1 -1
- 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: 274c1b8e544c80680eba4a1267782118c02dceb2
|
4
|
+
data.tar.gz: abbecfe7f9ef9595b7a6d852f6c7d9f91e91004c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/text_helpers/railtie.rb
CHANGED
@@ -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
|
|
data/lib/text_helpers/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2013-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|