i18n-airbrake 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -6
- data/i18n-airbrake.gemspec +2 -2
- data/lib/i18n-airbrake/version.rb +1 -1
- data/spec/i18n-airbrake_spec.rb +30 -23
- metadata +26 -11
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# I18n::Airbrake
|
2
2
|
|
3
|
-
*
|
4
|
-
* translates
|
5
|
-
*
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
3
|
+
* when the translation can be found
|
4
|
+
* translates known keys normally
|
5
|
+
* uses the default normally
|
6
|
+
* when the translation cannot be found
|
7
|
+
* notifies airbrake in production environment
|
8
|
+
* titleizes the key in production environment
|
9
|
+
* raises the error in development environment
|
10
|
+
* raises the error in test environment
|
9
11
|
|
10
12
|
(straight from the specs)
|
11
13
|
|
data/i18n-airbrake.gemspec
CHANGED
@@ -15,8 +15,8 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = I18n::Airbrake::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency "i18n", "~> 0.6
|
19
|
-
gem.add_dependency "airbrake", "~> 3.0
|
18
|
+
gem.add_dependency "i18n", "~> 0.6"
|
19
|
+
gem.add_dependency "airbrake", "~> 3.0"
|
20
20
|
|
21
21
|
gem.add_development_dependency "rspec", "~> 2.9"
|
22
22
|
|
data/spec/i18n-airbrake_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'i18n-airbrake'
|
2
2
|
require 'airbrake'
|
3
3
|
|
4
|
-
|
5
4
|
describe I18n::Airbrake do
|
6
5
|
|
7
6
|
let(:env) { stub "env", :development? => false, :test? => false }
|
@@ -15,34 +14,42 @@ describe I18n::Airbrake do
|
|
15
14
|
Rails.stub(:env) { env }
|
16
15
|
end
|
17
16
|
|
18
|
-
|
19
|
-
I18n.t(:known).should == translation
|
20
|
-
end
|
17
|
+
context "when the translation can be found" do
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
it "translates normally" do
|
20
|
+
I18n.t(:known).should == translation
|
21
|
+
end
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
23
|
+
it "uses the default normally" do
|
24
|
+
I18n.t(:unknown, :default => "With Default").should == "With Default"
|
25
|
+
end
|
30
26
|
|
31
|
-
it "titleizes the key in production environment" do
|
32
|
-
::Airbrake.stub(:notify)
|
33
|
-
I18n.t(:unknown).should == "Unknown"
|
34
27
|
end
|
35
28
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
context "when the translation cannot be found" do
|
30
|
+
|
31
|
+
it "notifies airbrake in production environment" do
|
32
|
+
::Airbrake.should_receive(:notify).with(an_instance_of(I18n::MissingTranslationData))
|
33
|
+
I18n.t(:unknown)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "titleizes the key in production environment" do
|
37
|
+
::Airbrake.stub(:notify)
|
38
|
+
I18n.t(:unknown).should == "Unknown"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "raises the error in development environment" do
|
42
|
+
Rails.env.stub(:development?) { true }
|
43
|
+
::Airbrake.should_not_receive(:notify)
|
44
|
+
expect { I18n.t(:unknown) }.to raise_error I18n::MissingTranslationData
|
45
|
+
end
|
46
|
+
|
47
|
+
it "raises the error in test environment" do
|
48
|
+
Rails.env.stub(:test?) { true }
|
49
|
+
::Airbrake.should_not_receive(:notify)
|
50
|
+
expect { I18n.t(:unknown) }.to raise_error I18n::MissingTranslationData
|
51
|
+
end
|
41
52
|
|
42
|
-
it "raises the error in test environment" do
|
43
|
-
Rails.env.stub(:test?) { true }
|
44
|
-
::Airbrake.should_not_receive(:notify)
|
45
|
-
expect { I18n.t(:unknown) }.to raise_error I18n::MissingTranslationData
|
46
53
|
end
|
47
54
|
|
48
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n-airbrake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,33 +9,43 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.6
|
21
|
+
version: '0.6'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.6'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: airbrake
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
31
36
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.0
|
37
|
+
version: '3.0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rspec
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,7 +53,12 @@ dependencies:
|
|
43
53
|
version: '2.9'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.9'
|
47
62
|
description: Notifies Airbrake when you miss a translation
|
48
63
|
email:
|
49
64
|
- iain@iain.nl
|
@@ -83,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
98
|
version: '0'
|
84
99
|
requirements: []
|
85
100
|
rubyforge_project:
|
86
|
-
rubygems_version: 1.8.
|
101
|
+
rubygems_version: 1.8.24
|
87
102
|
signing_key:
|
88
103
|
specification_version: 3
|
89
104
|
summary: Notifies Airbrake when you miss a translation
|