serial_translator 0.0.2 → 0.0.3

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: 2d9a361ac3956ed0f39ecda9c4ef8a791d73e648
4
- data.tar.gz: 61bf47fefc8860f5b4ff7891150c76bac52fae9d
3
+ metadata.gz: bd4d2cf24fa2a993a3ca81f41d10c809a2d8e3af
4
+ data.tar.gz: f4f8e3a631db7ca33d30bf1379599bae0732394b
5
5
  SHA512:
6
- metadata.gz: 5aa2be05d525d8786cb8bfdc8c2484e321cf49c0434bc5ae06f2a69a1be9606525cd0bb3eb90bec82ba94d580ea2b2d0049762300ca097d7c7f221ea2939a449
7
- data.tar.gz: 6e86c7ecb095ee16134e39826ca43655cb0e6fc4ac784a6cc81129cc2dd20d522968c6f0144f6ff90d14f9e59c3b97d6b7be86a68d95feae09379db07623bd00
6
+ metadata.gz: 1a508e0d3ff34d9dd91134b35de20f9441dcc12c9057ee05cbd4379bc9861489678b3a79e90fee7feb418d6c64d31bfc4895edf4bf47b764fe35956edbfeab53
7
+ data.tar.gz: b95fd270b3e37a5dd4eac91b7a4d98de009da1513e50d3e17893d624a9df1a26c9d9e0c980c0cbdf66f90cce8e2e6f39569dfb3b589b36847adc836996d18ae4
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  rvm:
2
2
  - 2.0.0
3
3
 
4
- script: "bundle exec rspec"
4
+ script: "bundle exec rake"
5
5
 
6
6
  notifications:
7
7
  disabled: false
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -28,7 +28,11 @@ module SerialTranslator
28
28
 
29
29
  define_method "#{attribute}=" do |value|
30
30
  translations = translations_for(attribute)
31
- translations[current_translation_locale] = value
31
+ if value.present?
32
+ translations[current_translation_locale] = value
33
+ else
34
+ translations.delete(current_translation_locale)
35
+ end
32
36
  __send__(:"#{attribute}_translations=", translations)
33
37
  end
34
38
  end
@@ -1,3 +1,3 @@
1
1
  module SerialTranslator
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -42,6 +42,20 @@ describe SerialTranslator do
42
42
  object.title = 'Deutsch'
43
43
  object.title_translations.should eq({ de: 'Deutsch' })
44
44
  end
45
+
46
+ it 'nil removes the value for the current text locale' do
47
+ object.title_translations = { de: 'Deutsch' }
48
+ object.current_translation_locale = :de
49
+ object.title = nil
50
+ object.title_translations.should eq({})
51
+ end
52
+
53
+ it 'blank string removes the value for the current text locale' do
54
+ object.title_translations = { de: 'Deutsch' }
55
+ object.current_translation_locale = :de
56
+ object.title = " "
57
+ object.title_translations.should eq({})
58
+ end
45
59
  end
46
60
 
47
61
  describe '#current_translation_locale' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serial_translator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - betterplace development team