flag_shih_tzu 0.3.21 → 0.3.22

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
  SHA256:
3
- metadata.gz: 8433736f25b1a4e35506a62d4379bca4a604c356890784361bd9dc5f6da1d281
4
- data.tar.gz: 7280c2aa6c7ab7e08a733c412496b399f7d1f7369ec8ab871f12a75cd90ddb1e
3
+ metadata.gz: 5e43199789d6c30b71d15139ed647229e02f49116c45c4f4b7780b1d8a37f8b2
4
+ data.tar.gz: 7d5616a0535b314704e7d71420d2bbd3f3075e1aafd9a0ee9a77f8ab7974a425
5
5
  SHA512:
6
- metadata.gz: f669b8f544f906f217b02538da085c2862d373cf6cd84648033461762cea501827ced978955ee6bb2fdc67c01643a51ddf1fbdd3925fab7b997a16041a220000
7
- data.tar.gz: 2eef7f1dbf8cc80927c292f60fc1acc4e21ec4ee12683c00bf85495efac39494dc013cd0c48bd1d12a3fc5eb1d31ac1b5721a5f563fb541eba068b1de840e743
6
+ metadata.gz: b7e2245c742d73eaa3b9099fee558f276d18507e65f079b951a23d170ded6128564b72a1a94aaa89556b5b34241891128f6bd702f41e05b8ea1b36de6f44d239
7
+ data.tar.gz: 4dd8a47b5730c3ace7e6ae611efeaad46e4a983d4d7a0e01fe94c35e41fc945e09244fef47d15a49ca64ab8ce0b8cf5983c8055e577c8d13697ff7989c56adab
@@ -2,10 +2,16 @@
2
2
 
3
3
  * Work merged into master branch goes here until it is released.
4
4
 
5
+ # Version 0.3.22 - SEP.18.2018
6
+
7
+ * When #selected_flags= passed with nil it clears flag bits, by xpol
8
+ - This makes flag_shih_tzu behave like Rails: converts empty array to nil.
9
+
5
10
  # Version 0.3.21 - SEP.09.2018
6
11
 
12
+ * Make required minimum Ruby version explicit: 1.9.3 and up by Peter Boling
7
13
  * Support Rails 5.2 by Peter Boling
8
- * Add Ruby 2.5 to build, and update/fix build
14
+ * Add Ruby 2.5 to build, and update/fix build by Peter Boling
9
15
 
10
16
  # Version 0.3.20 - SEP.08.2018
11
17
 
@@ -31,7 +37,7 @@
31
37
  # Version 0.3.16 - JAN.16.2017
32
38
 
33
39
  * Fix complex custom sql queries with multiple references to the column by vegetaras
34
- * Improved documentation and compatibility matrix by pboling
40
+ * Improved documentation and compatibility matrix by Peter Boling
35
41
 
36
42
  # Version 0.3.15 - OCT.11.2015
37
43
 
data/README.md CHANGED
@@ -5,9 +5,9 @@ Bit fields for ActiveRecord
5
5
  | Project | FlagShihTzu |
6
6
  |------------------------ | ----------------- |
7
7
  | gem name | flag_shih_tzu |
8
- | license | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) |
8
+ | license | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) |
9
9
  | expert support | [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github) |
10
- | download rank | [![Total Downloads](https://img.shields.io/gem/rt/flag_shih_tzu.svg)](https://rubygems.org/gems/flag_shih_tzu) |
10
+ | download rank | [![Total Downloads](https://img.shields.io/gem/rt/flag_shih_tzu.svg)](https://rubygems.org/gems/flag_shih_tzu) [![Daily Downloads](https://img.shields.io/gem/rd/flag_shih_tzu.svg)](https://rubygems.org/gems/flag_shih_tzu) |
11
11
  | version | [![Gem Version](https://badge.fury.io/rb/flag_shih_tzu.png)](http://badge.fury.io/rb/flag_shih_tzu) |
12
12
  | dependencies | [![Depfu](https://badges.depfu.com/badges/f011a69cf2426f91483aaade580823ac/count.svg)](https://depfu.com/github/pboling/flag_shih_tzu?project_id=2685) |
13
13
  | code quality | [![Code Climate](https://codeclimate.com/github/pboling/flag_shih_tzu.png)](https://codeclimate.com/github/pboling/flag_shih_tzu) |
@@ -82,7 +82,7 @@ The gem is actively being tested against:
82
82
 
83
83
  * Ruby 1.8.7 compatibility is in the [0.2.X branch](https://github.com/pboling/flag_shih_tzu/tree/0.2.X) and no further releases are expected. If you need a patch submit a pull request.
84
84
 
85
- * Ruby 1.9.3, 2.0.0, and 2.1.0 compatibility is still current on master, and the 0.3.x series releases, but those EOL'd Rubies, and any others that become EOL'd in the meantime, will not be supported in the next major release, version 1.0.
85
+ * Ruby 1.9.3, 2.0.0, 2.1.x, and 2.2.x compatibility is still current on master, and the 0.3.x series releases, but those EOL'd Rubies, and any others that become EOL'd in the meantime, will not be supported in the next major release, version 1.0.
86
86
 
87
87
  ## Installation
88
88
 
@@ -64,6 +64,16 @@ do
64
64
  run_all_tests_for $rvm_ruby_version $rails_version
65
65
  done
66
66
 
67
+ # Then run the tests for all versions supported on Ruby 2.5.1
68
+ COMPATIBLE_VERSIONS=(5.0.x 5.1.x 5.2.x)
69
+ Count=0
70
+ while [ "x${COMPATIBLE_VERSIONS[Count]}" != "x" ]
71
+ do
72
+ rvm_ruby_version=2.5.1
73
+ rails_version=${COMPATIBLE_VERSIONS[Count]}
74
+ run_all_tests_for $rvm_ruby_version $rails_version
75
+ done
76
+
67
77
  # Then run the tests for all versions supported on jruby-1.7.26
68
78
  # (which appears to pass for 3.1 - 4.2 inclusive)
69
79
  # TODO: Investigate 2 failures on Rails 2.3 and 3.0
@@ -224,6 +224,7 @@ To turn off this warning set check_for_column: false in has_flags definition her
224
224
  # useful for a form builder
225
225
  def selected_#{colmn}=(chosen_flags)
226
226
  unselect_all_flags("#{colmn}")
227
+ return if chosen_flags.nil?
227
228
  chosen_flags.each do |selected_flag|
228
229
  enable_flag(selected_flag.to_sym, "#{colmn}") if selected_flag.present?
229
230
  end
@@ -514,6 +515,7 @@ To turn off this warning set check_for_column: false in has_flags definition her
514
515
  # use selected_#{column}= for custom column names.
515
516
  def selected_flags=(chosen_flags)
516
517
  unselect_all_flags
518
+ return if chosen_flags.nil?
517
519
  chosen_flags.each do |selected_flag|
518
520
  if selected_flag.present?
519
521
  enable_flag(selected_flag.to_sym, DEFAULT_COLUMN_NAME)
@@ -1,3 +1,3 @@
1
1
  module FlagShihTzu
2
- VERSION = "0.3.21"
2
+ VERSION = "0.3.22"
3
3
  end
@@ -846,6 +846,29 @@ class FlagShihTzuInstanceMethodsTest < Test::Unit::TestCase
846
846
  assert !@spaceship.has_flag?
847
847
  end
848
848
 
849
+ def test_should_define_a_selected_flags_writer_method
850
+ @spaceship.selected_flags = [:warpdrive]
851
+ assert @spaceship.warpdrive
852
+ assert !@spaceship.shields
853
+ assert !@spaceship.electrolytes
854
+
855
+ @spaceship.selected_flags = [:warpdrive, :shields, :electrolytes]
856
+ assert @spaceship.warpdrive
857
+ assert @spaceship.shields
858
+ assert @spaceship.electrolytes
859
+
860
+ @spaceship.selected_flags = []
861
+ assert !@spaceship.warpdrive
862
+ assert !@spaceship.shields
863
+ assert !@spaceship.electrolytes
864
+
865
+ @spaceship.selected_flags = [:warpdrive, :shields, :electrolytes]
866
+ @spaceship.selected_flags = nil
867
+ assert !@spaceship.warpdrive
868
+ assert !@spaceship.shields
869
+ assert !@spaceship.electrolytes
870
+ end
871
+
849
872
  # --------------------------------------------------
850
873
 
851
874
  def test_should_define_a_customized_all_flags_reader_method
@@ -901,6 +924,10 @@ class FlagShihTzuInstanceMethodsTest < Test::Unit::TestCase
901
924
  @small_spaceship.selected_bits = []
902
925
  assert !@small_spaceship.warpdrive
903
926
  assert !@small_spaceship.hyperspace
927
+
928
+ @small_spaceship.selected_bits = nil
929
+ assert !@small_spaceship.warpdrive
930
+ assert !@small_spaceship.hyperspace
904
931
  end
905
932
 
906
933
  def test_should_define_a_customized_has_flag_method
@@ -1007,6 +1034,13 @@ class FlagShihTzuInstanceMethodsTest < Test::Unit::TestCase
1007
1034
  assert !@big_spaceship.hyperspace
1008
1035
  assert !@big_spaceship.jeanlucpicard
1009
1036
  assert !@big_spaceship.dajanatroj
1037
+
1038
+ @big_spaceship.selected_bits = nil
1039
+ @big_spaceship.selected_commanders = nil
1040
+ assert !@big_spaceship.warpdrive
1041
+ assert !@big_spaceship.hyperspace
1042
+ assert !@big_spaceship.jeanlucpicard
1043
+ assert !@big_spaceship.dajanatroj
1010
1044
  end
1011
1045
 
1012
1046
  def test_should_define_a_customized_has_flag_method_with_2_columns
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flag_shih_tzu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.21
4
+ version: 0.3.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2018-09-09 00:00:00.000000000 Z
15
+ date: 2018-09-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activerecord