i18n-spec 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,8 +1,10 @@
1
1
  source :rubygems
2
2
 
3
+ gem "iso"
4
+
3
5
  group :development do
4
6
  gem "rspec", ">= 2.4.0"
5
- gem "bundler", "~> 1.1.3"
7
+ gem "bundler", "~> 1.2.0"
6
8
  gem "jeweler", "~> 1.6.4"
7
9
  gem "rdoc"
8
10
  gem "rcov", ">= 0" if RUBY_VERSION < '1.9'
data/Gemfile.lock CHANGED
@@ -3,6 +3,9 @@ GEM
3
3
  specs:
4
4
  diff-lcs (1.1.3)
5
5
  git (1.2.5)
6
+ i18n (0.6.1)
7
+ iso (0.0.3)
8
+ i18n
6
9
  jeweler (1.6.4)
7
10
  bundler (~> 1.0)
8
11
  git (>= 1.2.5)
@@ -24,7 +27,8 @@ PLATFORMS
24
27
  ruby
25
28
 
26
29
  DEPENDENCIES
27
- bundler (~> 1.1.3)
30
+ bundler (~> 1.2.0)
31
+ iso
28
32
  jeweler (~> 1.6.4)
29
33
  rdoc
30
34
  rspec (>= 2.4.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
data/i18n-spec.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{i18n-spec}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
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}]
12
- s.date = %q{2012-04-26}
12
+ s.date = %q{2012-09-14}
13
13
  s.description = %q{Includes a number of rspec matchers to make specing your locale files easy peasy.}
14
14
  s.email = %q{chris@tigrish.com}
15
15
  s.extra_rdoc_files = [
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  ".document",
21
21
  ".rspec",
22
- ".rvmrc",
23
22
  ".travis.yml",
24
23
  "Gemfile",
25
24
  "Gemfile.lock",
@@ -33,6 +32,7 @@ Gem::Specification.new do |s|
33
32
  "lib/i18n-spec/matchers/be_a_subset_of_matcher.rb",
34
33
  "lib/i18n-spec/matchers/be_named_like_top_level_namespace_matcher.rb",
35
34
  "lib/i18n-spec/matchers/be_parseable_matcher.rb",
35
+ "lib/i18n-spec/matchers/have_a_valid_locale_matcher.rb",
36
36
  "lib/i18n-spec/matchers/have_legacy_interpolations.rb",
37
37
  "lib/i18n-spec/matchers/have_one_top_level_namespace_matcher.rb",
38
38
  "lib/i18n-spec/matchers/have_valid_pluralization_keys_matcher.rb",
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
42
42
  "spec/fixtures/en.yml",
43
43
  "spec/fixtures/es.yml",
44
44
  "spec/fixtures/fr.yml",
45
+ "spec/fixtures/invalid_locale.yml",
45
46
  "spec/fixtures/invalid_pluralization_keys.yml",
46
47
  "spec/fixtures/legacy_interpolations.yml",
47
48
  "spec/fixtures/multiple_top_levels.yml",
@@ -61,19 +62,22 @@ Gem::Specification.new do |s|
61
62
  s.specification_version = 3
62
63
 
63
64
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
65
+ s.add_runtime_dependency(%q<iso>, [">= 0"])
64
66
  s.add_development_dependency(%q<rspec>, [">= 2.4.0"])
65
- s.add_development_dependency(%q<bundler>, ["~> 1.1.3"])
67
+ s.add_development_dependency(%q<bundler>, ["~> 1.2.0"])
66
68
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
67
69
  s.add_development_dependency(%q<rdoc>, [">= 0"])
68
70
  else
71
+ s.add_dependency(%q<iso>, [">= 0"])
69
72
  s.add_dependency(%q<rspec>, [">= 2.4.0"])
70
- s.add_dependency(%q<bundler>, ["~> 1.1.3"])
73
+ s.add_dependency(%q<bundler>, ["~> 1.2.0"])
71
74
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
72
75
  s.add_dependency(%q<rdoc>, [">= 0"])
73
76
  end
74
77
  else
78
+ s.add_dependency(%q<iso>, [">= 0"])
75
79
  s.add_dependency(%q<rspec>, [">= 2.4.0"])
76
- s.add_dependency(%q<bundler>, ["~> 1.1.3"])
80
+ s.add_dependency(%q<bundler>, ["~> 1.2.0"])
77
81
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
78
82
  s.add_dependency(%q<rdoc>, [">= 0"])
79
83
  end
data/lib/i18n-spec.rb CHANGED
@@ -2,6 +2,7 @@ if defined?(Psych) and defined?(Psych::VERSION) and !defined?(YAML::ParseError)
2
2
  YAML::ParseError = Psych::SyntaxError
3
3
  end
4
4
 
5
+ require 'iso'
5
6
  Dir[File.dirname(__FILE__) + '/i18n-spec/models/*.rb'].each {|file| require file }
6
7
  Dir[File.dirname(__FILE__) + '/i18n-spec/matchers/*.rb'].each {|file| require file }
7
8
  Dir[File.dirname(__FILE__) + '/i18n-spec/shared_examples/*.rb'].each {|file| require file }
@@ -0,0 +1,6 @@
1
+ RSpec::Matchers.define :have_a_valid_locale do
2
+ match do |actual|
3
+ locale_file = I18nSpec::LocaleFile.new(actual)
4
+ locale_file.has_a_valid_locale?
5
+ end
6
+ end
@@ -66,6 +66,10 @@ module I18nSpec
66
66
  translations.keys.first == File.basename(@filepath, File.extname(@filepath))
67
67
  end
68
68
 
69
+ def has_a_valid_locale?
70
+ ISO::Tag.new(translations.keys.first).valid?
71
+ end
72
+
69
73
  protected
70
74
 
71
75
  def flatten_tree(data, prefix = '', result = {})
@@ -5,5 +5,6 @@ shared_examples_for "a valid locale file" do |locale_file|
5
5
  it { should have_one_top_level_namespace }
6
6
  it { should be_named_like_top_level_namespace }
7
7
  it { should_not have_legacy_interpolations }
8
+ it { should have_a_valid_locale }
8
9
  end
9
10
  end
@@ -0,0 +1,2 @@
1
+ lol:
2
+ foo: bar
@@ -10,6 +10,7 @@ describe "Invalid files" do
10
10
  it { 'spec/fixtures/multiple_top_levels.yml'.should_not have_one_top_level_namespace }
11
11
  it { 'spec/fixtures/multiple_top_levels.yml'.should_not be_named_like_top_level_namespace }
12
12
  it { 'spec/fixtures/legacy_interpolations.yml'.should have_legacy_interpolations }
13
+ it { 'spec/fixtures/invalid_locale.yml'.should_not have_a_valid_locale }
13
14
  it { 'spec/fixtures/not_subset.yml'.should_not be_a_subset_of 'spec/fixtures/en.yml' }
14
15
  end
15
16
 
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.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-26 00:00:00.000000000 Z
12
+ date: 2012-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: iso
16
+ requirement: &70224352320400 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70224352320400
14
25
  - !ruby/object:Gem::Dependency
15
26
  name: rspec
16
- requirement: &70137508974540 !ruby/object:Gem::Requirement
27
+ requirement: &70224352318980 !ruby/object:Gem::Requirement
17
28
  none: false
18
29
  requirements:
19
30
  - - ! '>='
@@ -21,21 +32,21 @@ dependencies:
21
32
  version: 2.4.0
22
33
  type: :development
23
34
  prerelease: false
24
- version_requirements: *70137508974540
35
+ version_requirements: *70224352318980
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: bundler
27
- requirement: &70137508973920 !ruby/object:Gem::Requirement
38
+ requirement: &70224352317340 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ~>
31
42
  - !ruby/object:Gem::Version
32
- version: 1.1.3
43
+ version: 1.2.0
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *70137508973920
46
+ version_requirements: *70224352317340
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: jeweler
38
- requirement: &70137508973280 !ruby/object:Gem::Requirement
49
+ requirement: &70224352316420 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ~>
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: 1.6.4
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *70137508973280
57
+ version_requirements: *70224352316420
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: rdoc
49
- requirement: &70137508528580 !ruby/object:Gem::Requirement
60
+ requirement: &70224352315200 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
@@ -54,7 +65,7 @@ dependencies:
54
65
  version: '0'
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *70137508528580
68
+ version_requirements: *70224352315200
58
69
  description: Includes a number of rspec matchers to make specing your locale files
59
70
  easy peasy.
60
71
  email: chris@tigrish.com
@@ -66,7 +77,6 @@ extra_rdoc_files:
66
77
  files:
67
78
  - .document
68
79
  - .rspec
69
- - .rvmrc
70
80
  - .travis.yml
71
81
  - Gemfile
72
82
  - Gemfile.lock
@@ -80,6 +90,7 @@ files:
80
90
  - lib/i18n-spec/matchers/be_a_subset_of_matcher.rb
81
91
  - lib/i18n-spec/matchers/be_named_like_top_level_namespace_matcher.rb
82
92
  - lib/i18n-spec/matchers/be_parseable_matcher.rb
93
+ - lib/i18n-spec/matchers/have_a_valid_locale_matcher.rb
83
94
  - lib/i18n-spec/matchers/have_legacy_interpolations.rb
84
95
  - lib/i18n-spec/matchers/have_one_top_level_namespace_matcher.rb
85
96
  - lib/i18n-spec/matchers/have_valid_pluralization_keys_matcher.rb
@@ -89,6 +100,7 @@ files:
89
100
  - spec/fixtures/en.yml
90
101
  - spec/fixtures/es.yml
91
102
  - spec/fixtures/fr.yml
103
+ - spec/fixtures/invalid_locale.yml
92
104
  - spec/fixtures/invalid_pluralization_keys.yml
93
105
  - spec/fixtures/legacy_interpolations.yml
94
106
  - spec/fixtures/multiple_top_levels.yml
@@ -112,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
124
  version: '0'
113
125
  segments:
114
126
  - 0
115
- hash: -1989462955785697085
127
+ hash: 91530797002698873
116
128
  required_rubygems_version: !ruby/object:Gem::Requirement
117
129
  none: false
118
130
  requirements:
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm 1.9.2@i18n-spec