i18n-spec 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -11,6 +11,8 @@ i18n-spec provides RSpec matchers for testing your locale files.
11
11
  describe "config/locales/en.yml" do
12
12
  it { should be_parseable }
13
13
  it { should have_valid_pluralization_keys }
14
+ it { should have_one_top_level_namespace }
15
+ it { should be_named_like_top_level_namespace }
14
16
  end
15
17
 
16
18
  All of these tests can be ran with a shared example :
@@ -30,8 +32,6 @@ You can run all of these tests for every file in a directory like so :
30
32
  ## TODO
31
33
 
32
34
  describe "config/locales/fr.yml" do
33
- it { should have_one_top_level_namespace }
34
- it { should be_named_after_the_top_level_namespace }
35
35
  it { should be_a_subset_of('config/locales/en.yml')
36
36
  it { should be_a_complete_translation_of('config/locales/en.yml') }
37
37
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/i18n-spec.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{i18n-spec}
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Christopher Dell}]
@@ -29,12 +29,15 @@ Gem::Specification.new do |s|
29
29
  "VERSION",
30
30
  "i18n-spec.gemspec",
31
31
  "lib/i18n-spec.rb",
32
+ "lib/i18n-spec/matchers/be_named_like_top_level_namespace_matcher.rb",
32
33
  "lib/i18n-spec/matchers/be_parseable_matcher.rb",
34
+ "lib/i18n-spec/matchers/have_one_top_level_namespace_matcher.rb",
33
35
  "lib/i18n-spec/matchers/have_valid_pluralization_keys_matcher.rb",
34
36
  "lib/i18n-spec/models/locale_file.rb",
35
37
  "lib/i18n-spec/shared_examples/valid_locale_file.rb",
36
38
  "spec/fixtures/en.yml",
37
39
  "spec/fixtures/invalid_pluralization_keys.yml",
40
+ "spec/fixtures/multiple_top_levels.yml",
38
41
  "spec/fixtures/unparseable.yml",
39
42
  "spec/lib/i18n-spec/matchers_spec.rb",
40
43
  "spec/spec_helper.rb"
@@ -0,0 +1,6 @@
1
+ RSpec::Matchers.define :be_named_like_top_level_namespace do |expected|
2
+ match do |actual|
3
+ locale_file = I18nSpec::LocaleFile.new(actual)
4
+ locale_file.is_named_like_top_level_namespace?
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ RSpec::Matchers.define :have_one_top_level_namespace do |expected|
2
+ match do |actual|
3
+ locale_file = I18nSpec::LocaleFile.new(actual)
4
+ locale_file.has_one_top_level_namespace?
5
+ end
6
+ end
@@ -22,6 +22,14 @@ module I18nSpec
22
22
  true
23
23
  end
24
24
 
25
+ def has_one_top_level_namespace?
26
+ translations.keys.size == 1
27
+ end
28
+
29
+ def is_named_like_top_level_namespace?
30
+ translations.keys.first == File.basename(@filepath, File.extname(@filepath))
31
+ end
32
+
25
33
  protected
26
34
 
27
35
  def translations
@@ -2,5 +2,7 @@ shared_examples_for "a valid locale file" do |locale_file|
2
2
  describe locale_file do
3
3
  it { should be_parseable }
4
4
  it { should have_valid_pluralization_keys }
5
+ it { should have_one_top_level_namespace }
6
+ it { should be_named_like_top_level_namespace }
5
7
  end
6
8
  end
@@ -0,0 +1,4 @@
1
+ en:
2
+ hello: world
3
+ fr:
4
+ bonjour: monde
@@ -7,4 +7,6 @@ end
7
7
  describe "Invalid files" do
8
8
  it { 'spec/fixtures/unparseable.yml'.should_not be_parseable }
9
9
  it { 'spec/fixtures/invalid_pluralization_keys.yml'.should_not have_valid_pluralization_keys }
10
+ it { 'spec/fixtures/multiple_top_levels.yml'.should_not have_one_top_level_namespace }
11
+ it { 'spec/fixtures/multiple_top_levels.yml'.should_not be_named_like_top_level_namespace }
10
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70318761122560 !ruby/object:Gem::Requirement
16
+ requirement: &70124559385520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.3.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70318761122560
24
+ version_requirements: *70124559385520
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &70318761122080 !ruby/object:Gem::Requirement
27
+ requirement: &70124559385040 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.10
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70318761122080
35
+ version_requirements: *70124559385040
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &70318761121600 !ruby/object:Gem::Requirement
38
+ requirement: &70124559384560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.6.4
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70318761121600
46
+ version_requirements: *70124559384560
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rcov
49
- requirement: &70318761121120 !ruby/object:Gem::Requirement
49
+ requirement: &70124559384080 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70318761121120
57
+ version_requirements: *70124559384080
58
58
  description: Includes a number of rspec matchers to make specing your locale files
59
59
  easy peasy.
60
60
  email: chris@tigrish.com
@@ -76,12 +76,15 @@ files:
76
76
  - VERSION
77
77
  - i18n-spec.gemspec
78
78
  - lib/i18n-spec.rb
79
+ - lib/i18n-spec/matchers/be_named_like_top_level_namespace_matcher.rb
79
80
  - lib/i18n-spec/matchers/be_parseable_matcher.rb
81
+ - lib/i18n-spec/matchers/have_one_top_level_namespace_matcher.rb
80
82
  - lib/i18n-spec/matchers/have_valid_pluralization_keys_matcher.rb
81
83
  - lib/i18n-spec/models/locale_file.rb
82
84
  - lib/i18n-spec/shared_examples/valid_locale_file.rb
83
85
  - spec/fixtures/en.yml
84
86
  - spec/fixtures/invalid_pluralization_keys.yml
87
+ - spec/fixtures/multiple_top_levels.yml
85
88
  - spec/fixtures/unparseable.yml
86
89
  - spec/lib/i18n-spec/matchers_spec.rb
87
90
  - spec/spec_helper.rb
@@ -100,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
103
  version: '0'
101
104
  segments:
102
105
  - 0
103
- hash: 884231516008428020
106
+ hash: -4198525936416785934
104
107
  required_rubygems_version: !ruby/object:Gem::Requirement
105
108
  none: false
106
109
  requirements: