efficient_translations 0.0.6 → 0.0.7

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- efficient_translations (0.0.6)
4
+ efficient_translations (0.0.7)
5
5
  activerecord (~> 2.3)
6
6
  activesupport (~> 2.3)
7
7
 
@@ -40,7 +40,7 @@ module EfficientTranslations
40
40
  }
41
41
  end
42
42
 
43
- def self.scope_conditions
43
+ def scope_conditions
44
44
  "#{translation_model.table_name}.locale = ? OR #{translation_model.table_name}.locale = ?"
45
45
  end
46
46
 
@@ -1,3 +1,3 @@
1
1
  module EfficientTranslations
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -54,7 +54,7 @@ describe EfficientTranslations do
54
54
  end
55
55
  end
56
56
 
57
- context '::WorkingModel' do
57
+ describe '::WorkingModel' do
58
58
  it 'should include the translation model' do
59
59
  WorkingModel.translation_model.should be_kind_of(Class)
60
60
  end
@@ -69,6 +69,17 @@ describe EfficientTranslations do
69
69
  WorkingModel.should respond_to :with_translation_for
70
70
  end
71
71
 
72
+ describe '::with_current_translation' do
73
+ it 'should return only items with translations for I18n.locale or I18n.default_locale' do
74
+ I18n.locale, I18n.default_locale = :en, :it
75
+ WorkingModel.delete_all
76
+ WorkingModel.create! :translations_attributes => [{:locale => :en, :name => 'pippo'}]
77
+ WorkingModel.create! :translations_attributes => [{:locale => :it, :name => 'pippo'}]
78
+ WorkingModel.create! :translations_attributes => [{:locale => :fr, :name => 'pippo'}]
79
+ WorkingModel.with_current_translation.size.should == 2
80
+ end
81
+ end
82
+
72
83
  it 'should accept nested attributes' do
73
84
  WorkingModel.delete_all
74
85
  WorkingModel.create! :translations_attributes => [{ :locale => :en, :name => 'pippo' }]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: efficient_translations
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nicola Racco