i18n-spec 0.5.1 → 0.5.2

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: c461556989f0f5c2f6fa965f61f6ea6e2dd1608f
4
- data.tar.gz: cc8bff3d5bf38c7260d75ce0f64fc19a848cd952
3
+ metadata.gz: 9f98bd04f57bcd38cd4ddbe0e602af7b40b13c17
4
+ data.tar.gz: f412910af3c451d65aa56b0cbcab5229966ecce2
5
5
  SHA512:
6
- metadata.gz: 62800d74c38de3006d8538c890873331a196ca50f12f354938d88e1376d457b9acf412ba0a909175c8abc6c04ab5182946d00834776970712bf6552799d1daf2
7
- data.tar.gz: bfb27e4abdfa363fcf5e94ef6735a1907a6e882fc9bc5ca73576b7987056555f5454061f50d32c93be2c63ffce1a846b45f149818d63fce70566d99465554ecb
6
+ metadata.gz: 049b6449737469f47587f31628ca059aee1f146347e9e7fc5d47bacbd1cac7cb8381800d87fd53e60701f40d3cc3203836cbdf5179bd218133954ec5f43dae14
7
+ data.tar.gz: 2565f959ad8f856902c219fdf00ac7963a6545193e03c6bd9366e3d717ca7c30981a678da7a7dae20ffa7b725b42a091fdaa42322b509e8f3c022376504574b9
@@ -1,3 +1,8 @@
1
1
  rvm:
2
2
  - 1.9.3
3
3
  - 2.0.0
4
+ - 2.1
5
+
6
+ gemfile:
7
+ - gemfiles/rspec_2.99.gemfile
8
+ - gemfiles/rspec_3.gemfile
data/README.md CHANGED
@@ -9,13 +9,13 @@ i18n-spec provides RSpec matchers for testing your locale files and their transl
9
9
  There are a few matchers available; the subject of the spec is always a path to a locale file.
10
10
 
11
11
  describe "config/locales/en.yml" do
12
- it { should be_parseable }
13
- it { should have_valid_pluralization_keys }
14
- it { should_not have_missing_pluralization_keys }
15
- it { should have_one_top_level_namespace }
16
- it { should be_named_like_top_level_namespace }
17
- it { should_not have_legacy_interpolations }
18
- it { should have_a_valid_locale }
12
+ it { is_expected.to be_parseable }
13
+ it { is_expected.to have_valid_pluralization_keys }
14
+ it { is_expected.to_not have_missing_pluralization_keys }
15
+ it { is_expected.to have_one_top_level_namespace }
16
+ it { is_expected.to be_named_like_top_level_namespace }
17
+ it { is_expected.to_not have_legacy_interpolations }
18
+ it { is_expected.to have_a_valid_locale }
19
19
  end
20
20
 
21
21
  All of these tests can be ran in one line with a shared example :
@@ -37,13 +37,13 @@ Even better, you can run all of these tests for every file in a directory like s
37
37
  To test that your locale file is a subset of the default locale file
38
38
 
39
39
  describe "config/locales/fr.yml" do
40
- it { should be_a_subset_of 'config/locales/en.yml' }
40
+ it { is_expected.to be_a_subset_of 'config/locales/en.yml' }
41
41
  end
42
42
 
43
43
  If you need to test that all translations have been completed :
44
44
 
45
45
  describe "config/locales/fr.yml" do
46
- it { should be_a_complete_translation_of 'config/locales/en.yml' }
46
+ it { is_expected.to be_a_complete_translation_of 'config/locales/en.yml' }
47
47
  end
48
48
 
49
49
  ## Rake tasks
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'bundler'
4
+ gem 'iso'
5
+ gem 'jeweler'
6
+ gem 'rake'
7
+ gem 'rdoc'
8
+ gem 'rspec', '~> 2.99'
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'bundler'
4
+ gem 'iso'
5
+ gem 'jeweler'
6
+ gem 'rake'
7
+ gem 'rdoc'
8
+ gem 'rspec', '~> 3.0'
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: i18n-spec 0.5.1 ruby lib
5
+ # stub: i18n-spec 0.5.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "i18n-spec"
9
- s.version = "0.5.1"
9
+ s.version = "0.5.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Christopher Dell"]
14
- s.date = "2014-07-23"
14
+ s.date = "2014-08-03"
15
15
  s.description = "Includes a number of rspec matchers to make specing your locale files easy peasy."
16
16
  s.email = "chris@tigrish.com"
17
17
  s.extra_rdoc_files = [
@@ -23,13 +23,15 @@ Gem::Specification.new do |s|
23
23
  ".rspec",
24
24
  ".travis.yml",
25
25
  "Gemfile",
26
- "Gemfile.lock",
27
26
  "LICENSE.txt",
28
27
  "README.md",
29
28
  "Rakefile",
30
29
  "VERSION",
30
+ "gemfiles/rspec_2.99.gemfile",
31
+ "gemfiles/rspec_3.gemfile",
31
32
  "i18n-spec.gemspec",
32
33
  "lib/i18n-spec.rb",
34
+ "lib/i18n-spec/failure_message.rb",
33
35
  "lib/i18n-spec/matchers/be_a_complete_translation_of_matcher.rb",
34
36
  "lib/i18n-spec/matchers/be_a_subset_of_matcher.rb",
35
37
  "lib/i18n-spec/matchers/be_named_like_top_level_namespace_matcher.rb",
@@ -5,6 +5,8 @@ end
5
5
  require 'rspec/core'
6
6
  require 'iso'
7
7
  require 'yaml'
8
+ require 'i18n-spec/failure_message'
9
+ Dir[File.dirname(__FILE__) + '/i18n-spec/models/*.rb'].each {|file| require file }
8
10
  Dir[File.dirname(__FILE__) + '/i18n-spec/models/*.rb'].each {|file| require file }
9
11
  Dir[File.dirname(__FILE__) + '/i18n-spec/matchers/*.rb'].each {|file| require file }
10
12
  Dir[File.dirname(__FILE__) + '/i18n-spec/shared_examples/*.rb'].each {|file| require file }
@@ -0,0 +1,23 @@
1
+ module I18nSpec
2
+ module FailureMessage
3
+ def failure_for_should
4
+ if respond_to?(:failure_message)
5
+ # Rspec 3
6
+ failure_message { |f| yield(f) }
7
+ else
8
+ # Rspec 2
9
+ failure_message_for_should { |f| yield(f) }
10
+ end
11
+ end
12
+
13
+ def failure_for_should_not
14
+ if respond_to?(:failure_message_when_negated)
15
+ # Rspec 3
16
+ failure_message_when_negated { |f| yield(f) }
17
+ else
18
+ # Rspec 2
19
+ failure_message_for_should_not { |f| yield(f) }
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,4 +1,6 @@
1
1
  RSpec::Matchers.define :be_a_complete_translation_of do |default_locale_filepath|
2
+ extend I18nSpec::FailureMessage
3
+
2
4
  match do |filepath|
3
5
  locale_file = I18nSpec::LocaleFile.new(filepath)
4
6
  default_locale = I18nSpec::LocaleFile.new(default_locale_filepath)
@@ -8,13 +10,7 @@ RSpec::Matchers.define :be_a_complete_translation_of do |default_locale_filepath
8
10
  @misses.empty?
9
11
  end
10
12
 
11
- failure_meth = begin
12
- method(:failure_message)
13
- rescue NameError
14
- method(:failure_message_for_should)
15
- end
16
-
17
- failure_meth.call do |filepath|
13
+ failure_for_should do |filepath|
18
14
  "expected #{filepath} to include :\n- " << @misses.join("\n- ")
19
15
  end
20
16
  end
@@ -1,4 +1,6 @@
1
1
  RSpec::Matchers.define :be_a_subset_of do |default_locale_filepath|
2
+ extend I18nSpec::FailureMessage
3
+
2
4
  match do |filepath|
3
5
  locale_file = I18nSpec::LocaleFile.new(filepath)
4
6
  default_locale = I18nSpec::LocaleFile.new(default_locale_filepath)
@@ -8,13 +10,7 @@ RSpec::Matchers.define :be_a_subset_of do |default_locale_filepath|
8
10
  @superset.empty?
9
11
  end
10
12
 
11
- failure_meth = begin
12
- method(:failure_message)
13
- rescue NameError
14
- method(:failure_message_for_should)
15
- end
16
-
17
- failure_meth.call do |filepath|
13
+ failure_for_should do |filepath|
18
14
  "expected #{filepath} to not include :\n- " << @superset.join("\n- ")
19
15
  end
20
16
  end
@@ -1,16 +1,12 @@
1
1
  RSpec::Matchers.define :be_parseable do
2
+ extend I18nSpec::FailureMessage
3
+
2
4
  match do |actual|
3
5
  @locale_file = I18nSpec::LocaleFile.new(actual)
4
6
  @locale_file.is_parseable?
5
7
  end
6
8
 
7
- failure_meth = begin
8
- method(:failure_message)
9
- rescue NameError
10
- method(:failure_message_for_should)
11
- end
12
-
13
- failure_meth.call do |filepath|
9
+ failure_for_should do |filepath|
14
10
  "expected #{filepath} to be parseable but got :\n- #{@locale_file.errors[:unparseable]}"
15
11
  end
16
12
  end
@@ -1,16 +1,12 @@
1
1
  RSpec::Matchers.define :have_missing_pluralization_keys do
2
+ extend I18nSpec::FailureMessage
3
+
2
4
  match do |actual|
3
5
  @locale_file = I18nSpec::LocaleFile.new(actual)
4
6
  @locale_file.missing_pluralization_keys.any?
5
7
  end
6
8
 
7
- failure_meth = begin
8
- method(:failure_message_when_negated)
9
- rescue NameError
10
- method(:failure_message_for_should_not)
11
- end
12
-
13
- failure_meth.call do |filepath|
9
+ failure_for_should_not do |filepath|
14
10
  flattened_keys = []
15
11
 
16
12
  @locale_file.errors[:missing_pluralization_keys].each do |parent, subkeys|
@@ -1,16 +1,12 @@
1
1
  RSpec::Matchers.define :have_valid_pluralization_keys do
2
+ extend I18nSpec::FailureMessage
3
+
2
4
  match do |actual|
3
5
  @locale_file = I18nSpec::LocaleFile.new(actual)
4
6
  @locale_file.invalid_pluralization_keys.empty?
5
7
  end
6
8
 
7
- failure_meth = begin
8
- method(:failure_message)
9
- rescue NameError
10
- method(:failure_message_for_should)
11
- end
12
-
13
- failure_meth.call do |filepath|
9
+ failure_for_should do |filepath|
14
10
  "expected #{filepath} to not contain invalid pluralization keys in the following namespaces :\n- " << @locale_file.errors[:invalid_pluralization_keys].join("\n- ")
15
11
  end
16
12
  end
@@ -1,11 +1,11 @@
1
- shared_examples_for "a valid locale file" do |locale_file|
1
+ RSpec.shared_examples_for "a valid locale file" do |locale_file|
2
2
  describe locale_file do
3
- it { should be_parseable }
4
- it { should have_valid_pluralization_keys }
5
- it { should_not have_missing_pluralization_keys }
6
- it { should have_one_top_level_namespace }
7
- it { should be_named_like_top_level_namespace }
8
- it { should_not have_legacy_interpolations }
9
- it { should have_a_valid_locale }
3
+ it { is_expected.to be_parseable }
4
+ it { is_expected.to have_valid_pluralization_keys }
5
+ it { is_expected.to_not have_missing_pluralization_keys }
6
+ it { is_expected.to have_one_top_level_namespace }
7
+ it { is_expected.to be_named_like_top_level_namespace }
8
+ it { is_expected.to_not have_legacy_interpolations }
9
+ it { is_expected.to have_a_valid_locale }
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Dell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-23 00:00:00.000000000 Z
11
+ date: 2014-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso
@@ -93,13 +93,15 @@ files:
93
93
  - ".rspec"
94
94
  - ".travis.yml"
95
95
  - Gemfile
96
- - Gemfile.lock
97
96
  - LICENSE.txt
98
97
  - README.md
99
98
  - Rakefile
100
99
  - VERSION
100
+ - gemfiles/rspec_2.99.gemfile
101
+ - gemfiles/rspec_3.gemfile
101
102
  - i18n-spec.gemspec
102
103
  - lib/i18n-spec.rb
104
+ - lib/i18n-spec/failure_message.rb
103
105
  - lib/i18n-spec/matchers/be_a_complete_translation_of_matcher.rb
104
106
  - lib/i18n-spec/matchers/be_a_subset_of_matcher.rb
105
107
  - lib/i18n-spec/matchers/be_named_like_top_level_namespace_matcher.rb
@@ -1,74 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- addressable (2.3.6)
5
- builder (3.2.2)
6
- descendants_tracker (0.0.4)
7
- thread_safe (~> 0.3, >= 0.3.1)
8
- diff-lcs (1.2.5)
9
- faraday (0.9.0)
10
- multipart-post (>= 1.2, < 3)
11
- git (1.2.7)
12
- github_api (0.11.3)
13
- addressable (~> 2.3)
14
- descendants_tracker (~> 0.0.1)
15
- faraday (~> 0.8, < 0.10)
16
- hashie (>= 1.2)
17
- multi_json (>= 1.7.5, < 2.0)
18
- nokogiri (~> 1.6.0)
19
- oauth2
20
- hashie (3.1.0)
21
- highline (1.6.21)
22
- i18n (0.6.9)
23
- iso (0.2.1)
24
- i18n
25
- jeweler (2.0.1)
26
- builder
27
- bundler (>= 1.0)
28
- git (>= 1.2.5)
29
- github_api
30
- highline (>= 1.6.15)
31
- nokogiri (>= 1.5.10)
32
- rake
33
- rdoc
34
- json (1.8.1)
35
- jwt (1.0.0)
36
- mini_portile (0.6.0)
37
- multi_json (1.10.1)
38
- multi_xml (0.5.5)
39
- multipart-post (2.0.0)
40
- nokogiri (1.6.2.1)
41
- mini_portile (= 0.6.0)
42
- oauth2 (0.9.4)
43
- faraday (>= 0.8, < 0.10)
44
- jwt (~> 1.0)
45
- multi_json (~> 1.3)
46
- multi_xml (~> 0.5)
47
- rack (~> 1.2)
48
- rack (1.5.2)
49
- rake (10.3.2)
50
- rdoc (4.1.1)
51
- json (~> 1.4)
52
- rspec (3.0.0)
53
- rspec-core (~> 3.0.0)
54
- rspec-expectations (~> 3.0.0)
55
- rspec-mocks (~> 3.0.0)
56
- rspec-core (3.0.2)
57
- rspec-support (~> 3.0.0)
58
- rspec-expectations (3.0.2)
59
- diff-lcs (>= 1.2.0, < 2.0)
60
- rspec-support (~> 3.0.0)
61
- rspec-mocks (3.0.2)
62
- rspec-support (~> 3.0.0)
63
- rspec-support (3.0.2)
64
- thread_safe (0.3.4)
65
-
66
- PLATFORMS
67
- ruby
68
-
69
- DEPENDENCIES
70
- bundler
71
- iso
72
- jeweler
73
- rdoc
74
- rspec (>= 2.4.0)