flag_shih_tzu 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +1 -3
- data/.travis.yml +1 -1
- data/CHANGELOG +11 -0
- data/LICENSE +23 -0
- data/README.md +505 -0
- data/REEK +70 -0
- data/Rakefile +13 -0
- data/flag_shih_tzu.gemspec +3 -1
- data/gemfiles/Gemfile.activerecord-2.3.x +1 -0
- data/gemfiles/Gemfile.activerecord-3.0.x +1 -0
- data/gemfiles/Gemfile.activerecord-3.1.x +1 -0
- data/gemfiles/Gemfile.activerecord-3.2.x +1 -0
- data/lib/flag_shih_tzu.rb +2 -3
- data/lib/flag_shih_tzu/validators.rb +12 -1
- data/lib/flag_shih_tzu/version.rb +1 -1
- data/test/flag_shih_tzu_test.rb +104 -9
- data/test/test_helper.rb +16 -12
- metadata +37 -21
- data/README.rdoc +0 -433
data/REEK
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
lib/flag_shih_tzu.rb -- 62 warnings:
|
2
|
+
[329, 337, 344, 351, 411]:FlagShihTzu takes parameters [colmn, flag] to 5 methods (DataClump)
|
3
|
+
[339, 341]:FlagShihTzu#disable_flag calls self.class twice (DuplicateMethodCall)
|
4
|
+
[338]:FlagShihTzu#disable_flag performs a nil-check. (NilCheck)
|
5
|
+
[331, 333]:FlagShihTzu#enable_flag calls self.class twice (DuplicateMethodCall)
|
6
|
+
[330]:FlagShihTzu#enable_flag performs a nil-check. (NilCheck)
|
7
|
+
[352]:FlagShihTzu#flag_disabled? performs a nil-check. (NilCheck)
|
8
|
+
[345]:FlagShihTzu#flag_enabled? performs a nil-check. (NilCheck)
|
9
|
+
[394, 403, 403, 405, 405]:FlagShihTzu#update_flag! calls self.class 5 times (DuplicateMethodCall)
|
10
|
+
[403, 405]:FlagShihTzu#update_flag! calls self.class.primary_key twice (DuplicateMethodCall)
|
11
|
+
[392]:FlagShihTzu#update_flag! has approx 6 statements (TooManyStatements)
|
12
|
+
[392]:FlagShihTzu#update_flag! has boolean parameter 'update_instance' (BooleanParameter)
|
13
|
+
[395]:FlagShihTzu#update_flag! is controlled by argument update_instance (ControlParameter)
|
14
|
+
[180, 280, 303]:FlagShihTzu::ClassMethods takes parameters [colmn, custom_table_name, flag] to 3 methods (DataClump)
|
15
|
+
[180, 248, 280, 303]:FlagShihTzu::ClassMethods takes parameters [colmn, custom_table_name] to 4 methods (DataClump)
|
16
|
+
[173, 180, 280, 298, 303]:FlagShihTzu::ClassMethods takes parameters [colmn, flag] to 5 methods (DataClump)
|
17
|
+
[220, 222]:FlagShihTzu::ClassMethods#chained_flags_values calls flag.to_s twice (DuplicateMethodCall)
|
18
|
+
[216]:FlagShihTzu::ClassMethods#chained_flags_values has approx 10 statements (TooManyStatements)
|
19
|
+
[195, 197]:FlagShihTzu::ClassMethods#chained_flags_with calls chained_flags_condition(*args) twice (DuplicateMethodCall)
|
20
|
+
[175, 175]:FlagShihTzu::ClassMethods#check_flag calls flag_mapping[colmn] twice (DuplicateMethodCall)
|
21
|
+
[175]:FlagShihTzu::ClassMethods#check_flag performs a nil-check. (NilCheck)
|
22
|
+
[259, 269]:FlagShihTzu::ClassMethods#check_flag_column calls respond_to?(:logger) twice (DuplicateMethodCall)
|
23
|
+
[248]:FlagShihTzu::ClassMethods#check_flag_column has approx 10 statements (TooManyStatements)
|
24
|
+
[258]:FlagShihTzu::ClassMethods#check_flag_column performs a nil-check. (NilCheck)
|
25
|
+
[186, 187]:FlagShihTzu::ClassMethods#determine_flag_colmn_for calls self.flag_mapping twice (DuplicateMethodCall)
|
26
|
+
[186]:FlagShihTzu::ClassMethods#determine_flag_colmn_for performs a nil-check. (NilCheck)
|
27
|
+
[61, 64]:FlagShihTzu::ClassMethods#has_flags calls (1 << (flag_key - 1)) twice (DuplicateMethodCall)
|
28
|
+
[61, 64]:FlagShihTzu::ClassMethods#has_flags calls (flag_key - 1) twice (DuplicateMethodCall)
|
29
|
+
[35, 40]:FlagShihTzu::ClassMethods#has_flags calls caller.first twice (DuplicateMethodCall)
|
30
|
+
[61, 64]:FlagShihTzu::ClassMethods#has_flags calls flag_mapping[colmn] twice (DuplicateMethodCall)
|
31
|
+
[141, 154]:FlagShihTzu::ClassMethods#has_flags calls flag_options[colmn] twice (DuplicateMethodCall)
|
32
|
+
[33, 34, 36, 38]:FlagShihTzu::ClassMethods#has_flags calls opts[:column] 4 times (DuplicateMethodCall)
|
33
|
+
[33, 36]:FlagShihTzu::ClassMethods#has_flags calls opts[:column].to_s twice (DuplicateMethodCall)
|
34
|
+
[51, 52]:FlagShihTzu::ClassMethods#has_flags calls self.flag_mapping twice (DuplicateMethodCall)
|
35
|
+
[24]:FlagShihTzu::ClassMethods#has_flags has approx 26 statements (TooManyStatements)
|
36
|
+
[51]:FlagShihTzu::ClassMethods#has_flags performs a nil-check. (NilCheck)
|
37
|
+
[316]:FlagShihTzu::ClassMethods#is_valid_column_name refers to colmn more than self (FeatureEnvy)
|
38
|
+
[308]:FlagShihTzu::ClassMethods#is_valid_flag_key doesn't depend on instance state (UtilityFunction)
|
39
|
+
[308]:FlagShihTzu::ClassMethods#is_valid_flag_key refers to flag_key more than self (FeatureEnvy)
|
40
|
+
[312]:FlagShihTzu::ClassMethods#is_valid_flag_name refers to flag_name more than self (FeatureEnvy)
|
41
|
+
[236, 238]:FlagShihTzu::ClassMethods#parse_options calls args.shift twice (DuplicateMethodCall)
|
42
|
+
[235]:FlagShihTzu::ClassMethods#parse_options doesn't depend on instance state (UtilityFunction)
|
43
|
+
[235]:FlagShihTzu::ClassMethods#parse_options has approx 6 statements (TooManyStatements)
|
44
|
+
[235]:FlagShihTzu::ClassMethods#parse_options refers to args more than self (FeatureEnvy)
|
45
|
+
[180]:FlagShihTzu::ClassMethods#set_flag_sql has 4 parameters (LongParameterList)
|
46
|
+
[181]:FlagShihTzu::ClassMethods#set_flag_sql performs a nil-check. (NilCheck)
|
47
|
+
[286, 286]:FlagShihTzu::ClassMethods#sql_condition_for_flag calls flag_mapping[colmn] twice (DuplicateMethodCall)
|
48
|
+
[286, 286]:FlagShihTzu::ClassMethods#sql_condition_for_flag calls flag_mapping[colmn][flag] twice (DuplicateMethodCall)
|
49
|
+
[283, 287]:FlagShihTzu::ClassMethods#sql_condition_for_flag calls flag_options[colmn] twice (DuplicateMethodCall)
|
50
|
+
[283, 287]:FlagShihTzu::ClassMethods#sql_condition_for_flag calls flag_options[colmn][:flag_query_mode] twice (DuplicateMethodCall)
|
51
|
+
[280]:FlagShihTzu::ClassMethods#sql_condition_for_flag has 4 parameters (LongParameterList)
|
52
|
+
[280]:FlagShihTzu::ClassMethods#sql_condition_for_flag has approx 7 statements (TooManyStatements)
|
53
|
+
[280]:FlagShihTzu::ClassMethods#sql_condition_for_flag has boolean parameter 'enabled' (BooleanParameter)
|
54
|
+
[286, 290]:FlagShihTzu::ClassMethods#sql_condition_for_flag is controlled by argument enabled (ControlParameter)
|
55
|
+
[300]:FlagShihTzu::ClassMethods#sql_in_for_flag has the variable name 'i' (UncommunicativeVariableName)
|
56
|
+
[303]:FlagShihTzu::ClassMethods#sql_set_for_flag has 4 parameters (LongParameterList)
|
57
|
+
[303]:FlagShihTzu::ClassMethods#sql_set_for_flag has boolean parameter 'enabled' (BooleanParameter)
|
58
|
+
[303]:FlagShihTzu::ClassMethods#sql_set_for_flag has unused parameter 'custom_table_name' (UnusedParameters)
|
59
|
+
[305]:FlagShihTzu::ClassMethods#sql_set_for_flag is controlled by argument enabled (ControlParameter)
|
60
|
+
[21]:FlagShihTzu::DuplicateFlagColumnException has no descriptive comment (IrresponsibleModule)
|
61
|
+
[18]:FlagShihTzu::IncorrectFlagColumnException has no descriptive comment (IrresponsibleModule)
|
62
|
+
[20]:FlagShihTzu::NoSuchFlagException has no descriptive comment (IrresponsibleModule)
|
63
|
+
[19]:FlagShihTzu::NoSuchFlagQueryModeException has no descriptive comment (IrresponsibleModule)
|
64
|
+
lib/flag_shih_tzu/validators.rb -- 4 warnings:
|
65
|
+
[6]:ActiveModel::Validations::PresenceOfFlagsValidator has no descriptive comment (IrresponsibleModule)
|
66
|
+
[16, 17]:ActiveModel::Validations::PresenceOfFlagsValidator#check_flag calls record.class twice (DuplicateMethodCall)
|
67
|
+
[16, 17]:ActiveModel::Validations::PresenceOfFlagsValidator#check_flag calls record.class.flag_columns twice (DuplicateMethodCall)
|
68
|
+
[15]:ActiveModel::Validations::PresenceOfFlagsValidator#check_flag refers to record more than self (FeatureEnvy)
|
69
|
+
lib/flag_shih_tzu/version.rb -- 0 warnings
|
70
|
+
66 total warnings
|
data/Rakefile
CHANGED
@@ -24,6 +24,19 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
24
24
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
25
25
|
end
|
26
26
|
|
27
|
+
require 'reek/rake/task'
|
28
|
+
Reek::Rake::Task.new do |t|
|
29
|
+
t.fail_on_error = true
|
30
|
+
t.verbose = false
|
31
|
+
t.source_files = 'lib/**/*.rb'
|
32
|
+
end
|
33
|
+
|
34
|
+
require 'roodi'
|
35
|
+
require 'roodi_task'
|
36
|
+
RoodiTask.new do |t|
|
37
|
+
t.verbose = false
|
38
|
+
end
|
39
|
+
|
27
40
|
namespace :test do
|
28
41
|
desc 'Test against all supported ActiveRecord versions'
|
29
42
|
task :all do
|
data/flag_shih_tzu.gemspec
CHANGED
@@ -23,10 +23,12 @@ ActiveRecord object.
|
|
23
23
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
24
24
|
s.require_paths = ["lib"]
|
25
25
|
|
26
|
-
s.
|
26
|
+
s.add_development_dependency "activerecord", ">= 2.3.0"
|
27
27
|
|
28
28
|
s.add_development_dependency "bundler"
|
29
29
|
s.add_development_dependency "rdoc", ">= 2.4.2"
|
30
|
+
s.add_development_dependency(%q<reek>, [">= 1.2.8"])
|
31
|
+
s.add_development_dependency(%q<roodi>, [">= 2.1.0"])
|
30
32
|
s.add_development_dependency "rake"
|
31
33
|
s.add_development_dependency "coveralls"
|
32
34
|
s.add_development_dependency "sqlite3"
|
data/lib/flag_shih_tzu.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
require "active_support/all"
|
1
|
+
# Would like to support other database adapters so no more hard dependency on Active Record.
|
3
2
|
require "flag_shih_tzu/validators"
|
4
3
|
|
5
4
|
module FlagShihTzu
|
@@ -26,7 +25,7 @@ module FlagShihTzu
|
|
26
25
|
opts = {
|
27
26
|
:named_scopes => true,
|
28
27
|
:column => DEFAULT_COLUMN_NAME,
|
29
|
-
:flag_query_mode => :in_list,
|
28
|
+
:flag_query_mode => :in_list, # or :bit_operator
|
30
29
|
:strict => false,
|
31
30
|
:check_for_column => true
|
32
31
|
}.update(opts)
|
@@ -1,4 +1,15 @@
|
|
1
|
-
|
1
|
+
# Active Record is not defined as a runtime dependency in the gemspec.
|
2
|
+
unless defined?(::ActiveRecord)
|
3
|
+
begin
|
4
|
+
# If by some miracle it hasn't been loaded yet, try to load it.
|
5
|
+
require 'active_record'
|
6
|
+
rescue LoadError
|
7
|
+
# If it fails to load, then assume the user is try to use flag_shih_tzu with some other database adapter
|
8
|
+
warn "FlagShihTzu probably won't work unless you have some version of Active Record loaded. Versions >= 2.3 are supported."
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::MAJOR >= 3
|
2
13
|
|
3
14
|
module ActiveModel
|
4
15
|
module Validations
|
data/test/flag_shih_tzu_test.rb
CHANGED
@@ -30,7 +30,7 @@ class SpaceshipWithCustomFlagsColumn < ActiveRecord::Base
|
|
30
30
|
has_flags(1 => :warpdrive, 2 => :hyperspace, :column => 'bits')
|
31
31
|
end
|
32
32
|
|
33
|
-
class
|
33
|
+
class SpaceshipWithColumnNameAsSymbol < ActiveRecord::Base
|
34
34
|
self.table_name = 'spaceships_with_custom_flags_column'
|
35
35
|
include FlagShihTzu
|
36
36
|
|
@@ -54,6 +54,13 @@ class SpaceshipWith3CustomFlagsColumn < ActiveRecord::Base
|
|
54
54
|
has_flags({ 1 => :power, 2 => :anti_ax_routine }, :column => 'hal3000')
|
55
55
|
end
|
56
56
|
|
57
|
+
class SpaceshipWithInListQueryMode < ActiveRecord::Base
|
58
|
+
self.table_name = 'spaceships'
|
59
|
+
include FlagShihTzu
|
60
|
+
|
61
|
+
has_flags(1 => :warpdrive, 2 => :shields, :flag_query_mode => :in_list)
|
62
|
+
end
|
63
|
+
|
57
64
|
class SpaceshipWithBitOperatorQueryMode < ActiveRecord::Base
|
58
65
|
self.table_name = 'spaceships'
|
59
66
|
include FlagShihTzu
|
@@ -250,9 +257,21 @@ class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
|
|
250
257
|
assert_equal "(spaceships.flags not in (4,5,6,7))", SpaceshipWithMissingFlags.not_electrolytes_condition
|
251
258
|
end
|
252
259
|
|
253
|
-
def
|
260
|
+
def test_sql_condition_for_flag_with_custom_table_name_and_default_query_mode
|
254
261
|
assert_equal "(custom_spaceships.flags in (1,3,5,7))", Spaceship.send(:sql_condition_for_flag, :warpdrive, 'flags', true, 'custom_spaceships')
|
255
262
|
end
|
263
|
+
def test_sql_condition_for_flag_with_in_list_query_mode
|
264
|
+
assert_equal "(spaceships.flags in (1,3))", SpaceshipWithInListQueryMode.send(:sql_condition_for_flag, :warpdrive, 'flags', true, 'spaceships')
|
265
|
+
end
|
266
|
+
def test_sql_condition_for_flag_with_bit_operator_query_mode
|
267
|
+
assert_equal "(spaceships.flags & 1 = 1)", SpaceshipWithBitOperatorQueryMode.send(:sql_condition_for_flag, :warpdrive, 'flags', true, 'spaceships')
|
268
|
+
end
|
269
|
+
def test_sql_in_for_flag
|
270
|
+
assert_equal [1,3,5,7], Spaceship.send(:sql_in_for_flag, :warpdrive, 'flags')
|
271
|
+
end
|
272
|
+
def test_sql_set_for_flag
|
273
|
+
assert_equal "flags = flags | 1", Spaceship.send(:sql_set_for_flag, :warpdrive, 'flags')
|
274
|
+
end
|
256
275
|
|
257
276
|
def test_should_define_a_sql_condition_method_for_flag_enabled_with_2_colmns_not_enabled
|
258
277
|
assert_equal "(spaceships_with_2_custom_flags_column.bits not in (1,3))", SpaceshipWith2CustomFlagsColumn.not_warpdrive_condition
|
@@ -430,7 +449,7 @@ class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
|
|
430
449
|
end
|
431
450
|
|
432
451
|
def test_should_work_with_a_custom_flags_column_name_as_symbol
|
433
|
-
spaceship =
|
452
|
+
spaceship = SpaceshipWithColumnNameAsSymbol.new
|
434
453
|
spaceship.enable_flag(:warpdrive)
|
435
454
|
spaceship.save!
|
436
455
|
spaceship.reload
|
@@ -877,10 +896,10 @@ class FlagShihTzuInstanceMethodsTest < Test::Unit::TestCase
|
|
877
896
|
end
|
878
897
|
end
|
879
898
|
|
880
|
-
def
|
899
|
+
def test_should_ignore_has_flags_call_if_column_does_not_exist_yet_default_check_for_column
|
881
900
|
assert_nothing_raised do
|
882
901
|
eval(<<-EOF
|
883
|
-
class
|
902
|
+
class SpaceshipWithoutFlagsColumn1 < ActiveRecord::Base
|
884
903
|
self.table_name = 'spaceships_without_flags_column'
|
885
904
|
include FlagShihTzu
|
886
905
|
|
@@ -892,13 +911,13 @@ class FlagShihTzuInstanceMethodsTest < Test::Unit::TestCase
|
|
892
911
|
)
|
893
912
|
end
|
894
913
|
|
895
|
-
assert !
|
914
|
+
assert !SpaceshipWithoutFlagsColumn1.method_defined?(:warpdrive)
|
896
915
|
end
|
897
916
|
|
898
|
-
def
|
917
|
+
def test_should_ignore_has_flags_call_if_column_not_integer_default_check_for_column
|
899
918
|
assert_raises FlagShihTzu::IncorrectFlagColumnException do
|
900
919
|
eval(<<-EOF
|
901
|
-
class
|
920
|
+
class SpaceshipWithNonIntegerColumn1 < ActiveRecord::Base
|
902
921
|
self.table_name ='spaceships_with_non_integer_column'
|
903
922
|
include FlagShihTzu
|
904
923
|
|
@@ -910,7 +929,83 @@ class FlagShihTzuInstanceMethodsTest < Test::Unit::TestCase
|
|
910
929
|
)
|
911
930
|
end
|
912
931
|
|
913
|
-
assert !
|
932
|
+
assert !SpaceshipWithNonIntegerColumn1.method_defined?(:warpdrive)
|
933
|
+
end
|
934
|
+
|
935
|
+
def test_should_ignore_has_flags_call_if_column_does_not_exist_yet_and_check_for_column_true
|
936
|
+
assert_nothing_raised do
|
937
|
+
eval(<<-EOF
|
938
|
+
class SpaceshipWithoutFlagsColumn2 < ActiveRecord::Base
|
939
|
+
self.table_name = 'spaceships_without_flags_column'
|
940
|
+
include FlagShihTzu
|
941
|
+
|
942
|
+
has_flags 1 => :warpdrive,
|
943
|
+
2 => :shields,
|
944
|
+
3 => :electrolytes,
|
945
|
+
:check_for_column => true
|
946
|
+
end
|
947
|
+
EOF
|
948
|
+
)
|
949
|
+
end
|
950
|
+
|
951
|
+
assert !SpaceshipWithoutFlagsColumn2.method_defined?(:warpdrive)
|
952
|
+
end
|
953
|
+
|
954
|
+
def test_should_ignore_has_flags_call_if_column_not_integer_and_check_for_column_true
|
955
|
+
assert_raises FlagShihTzu::IncorrectFlagColumnException do
|
956
|
+
eval(<<-EOF
|
957
|
+
class SpaceshipWithNonIntegerColumn2 < ActiveRecord::Base
|
958
|
+
self.table_name ='spaceships_with_non_integer_column'
|
959
|
+
include FlagShihTzu
|
960
|
+
|
961
|
+
has_flags 1 => :warpdrive,
|
962
|
+
2 => :shields,
|
963
|
+
3 => :electrolytes,
|
964
|
+
:check_for_column => true
|
965
|
+
end
|
966
|
+
EOF
|
967
|
+
)
|
968
|
+
end
|
969
|
+
|
970
|
+
assert !SpaceshipWithNonIntegerColumn2.method_defined?(:warpdrive)
|
971
|
+
end
|
972
|
+
|
973
|
+
def test_should_ignore_has_flags_call_if_column_does_not_exist_yet_and_check_for_column_false
|
974
|
+
assert_nothing_raised do
|
975
|
+
eval(<<-EOF
|
976
|
+
class SpaceshipWithoutFlagsColumn3 < ActiveRecord::Base
|
977
|
+
self.table_name = 'spaceships_without_flags_column'
|
978
|
+
include FlagShihTzu
|
979
|
+
|
980
|
+
has_flags 1 => :warpdrive,
|
981
|
+
2 => :shields,
|
982
|
+
3 => :electrolytes,
|
983
|
+
:check_for_column => false
|
984
|
+
end
|
985
|
+
EOF
|
986
|
+
)
|
987
|
+
end
|
988
|
+
|
989
|
+
assert SpaceshipWithoutFlagsColumn3.method_defined?(:warpdrive)
|
990
|
+
end
|
991
|
+
|
992
|
+
def test_should_ignore_has_flags_call_if_column_not_integer_and_check_for_column_false
|
993
|
+
assert_nothing_raised do
|
994
|
+
eval(<<-EOF
|
995
|
+
class SpaceshipWithNonIntegerColumn3 < ActiveRecord::Base
|
996
|
+
self.table_name ='spaceships_with_non_integer_column'
|
997
|
+
include FlagShihTzu
|
998
|
+
|
999
|
+
has_flags 1 => :warpdrive,
|
1000
|
+
2 => :shields,
|
1001
|
+
3 => :electrolytes,
|
1002
|
+
:check_for_column => false
|
1003
|
+
end
|
1004
|
+
EOF
|
1005
|
+
)
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
assert SpaceshipWithNonIntegerColumn3.method_defined?(:warpdrive)
|
914
1009
|
end
|
915
1010
|
|
916
1011
|
def test_column_guessing_for_default_column_2
|
data/test/test_helper.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
+
require "active_record"
|
1
2
|
require "test/unit"
|
2
3
|
require "yaml"
|
3
4
|
require "logger"
|
4
|
-
require "flag_shih_tzu"
|
5
5
|
|
6
6
|
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
7
7
|
ActiveRecord::Migration.verbose = false
|
8
8
|
|
9
9
|
configs = YAML.load_file(File.dirname(__FILE__) + "/database.yml")
|
10
10
|
if RUBY_PLATFORM == "java"
|
11
|
-
configs['sqlite']['adapter'] = 'jdbcsqlite3'
|
12
|
-
configs['mysql']['adapter'] = 'jdbcmysql'
|
13
|
-
configs['postgresql']['adapter'] = 'jdbcpostgresql'
|
11
|
+
configs['sqlite']['adapter'] = 'jdbcsqlite3'
|
12
|
+
configs['mysql']['adapter'] = 'jdbcmysql'
|
13
|
+
configs['postgresql']['adapter'] = 'jdbcpostgresql'
|
14
14
|
end
|
15
15
|
ActiveRecord::Base.configurations = configs
|
16
16
|
|
@@ -19,15 +19,19 @@ ActiveRecord::Base.establish_connection(db_name)
|
|
19
19
|
|
20
20
|
load(File.dirname(__FILE__) + "/schema.rb")
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
22
|
class Test::Unit::TestCase
|
27
23
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
def assert_array_similarity(expected, actual, message=nil)
|
25
|
+
full_message = build_message(message, "<?> expected but was\n<?>.\n", expected, actual)
|
26
|
+
assert_block(full_message) { (expected.size == actual.size) && (expected - actual == []) }
|
27
|
+
end
|
32
28
|
|
33
29
|
end
|
30
|
+
|
31
|
+
# For code coverage, must be required before all application / gem / library code.
|
32
|
+
unless ENV['NOCOVER']
|
33
|
+
require 'coveralls'
|
34
|
+
Coveralls.wear!
|
35
|
+
end
|
36
|
+
|
37
|
+
require "flag_shih_tzu"
|
metadata
CHANGED
@@ -1,8 +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.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.9
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Peter Boling
|
@@ -13,20 +12,18 @@ authors:
|
|
13
12
|
autorequire:
|
14
13
|
bindir: bin
|
15
14
|
cert_chain: []
|
16
|
-
date: 2013-11-
|
15
|
+
date: 2013-11-26 00:00:00.000000000 Z
|
17
16
|
dependencies:
|
18
17
|
- !ruby/object:Gem::Dependency
|
19
18
|
name: activerecord
|
20
19
|
requirement: !ruby/object:Gem::Requirement
|
21
|
-
none: false
|
22
20
|
requirements:
|
23
21
|
- - ! '>='
|
24
22
|
- !ruby/object:Gem::Version
|
25
23
|
version: 2.3.0
|
26
|
-
type: :
|
24
|
+
type: :development
|
27
25
|
prerelease: false
|
28
26
|
version_requirements: !ruby/object:Gem::Requirement
|
29
|
-
none: false
|
30
27
|
requirements:
|
31
28
|
- - ! '>='
|
32
29
|
- !ruby/object:Gem::Version
|
@@ -34,7 +31,6 @@ dependencies:
|
|
34
31
|
- !ruby/object:Gem::Dependency
|
35
32
|
name: bundler
|
36
33
|
requirement: !ruby/object:Gem::Requirement
|
37
|
-
none: false
|
38
34
|
requirements:
|
39
35
|
- - ! '>='
|
40
36
|
- !ruby/object:Gem::Version
|
@@ -42,7 +38,6 @@ dependencies:
|
|
42
38
|
type: :development
|
43
39
|
prerelease: false
|
44
40
|
version_requirements: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
41
|
requirements:
|
47
42
|
- - ! '>='
|
48
43
|
- !ruby/object:Gem::Version
|
@@ -50,7 +45,6 @@ dependencies:
|
|
50
45
|
- !ruby/object:Gem::Dependency
|
51
46
|
name: rdoc
|
52
47
|
requirement: !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
48
|
requirements:
|
55
49
|
- - ! '>='
|
56
50
|
- !ruby/object:Gem::Version
|
@@ -58,15 +52,41 @@ dependencies:
|
|
58
52
|
type: :development
|
59
53
|
prerelease: false
|
60
54
|
version_requirements: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
55
|
requirements:
|
63
56
|
- - ! '>='
|
64
57
|
- !ruby/object:Gem::Version
|
65
58
|
version: 2.4.2
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: reek
|
61
|
+
requirement: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.2.8
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 1.2.8
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: roodi
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 2.1.0
|
80
|
+
type: :development
|
81
|
+
prerelease: false
|
82
|
+
version_requirements: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 2.1.0
|
66
87
|
- !ruby/object:Gem::Dependency
|
67
88
|
name: rake
|
68
89
|
requirement: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
90
|
requirements:
|
71
91
|
- - ! '>='
|
72
92
|
- !ruby/object:Gem::Version
|
@@ -74,7 +94,6 @@ dependencies:
|
|
74
94
|
type: :development
|
75
95
|
prerelease: false
|
76
96
|
version_requirements: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
97
|
requirements:
|
79
98
|
- - ! '>='
|
80
99
|
- !ruby/object:Gem::Version
|
@@ -82,7 +101,6 @@ dependencies:
|
|
82
101
|
- !ruby/object:Gem::Dependency
|
83
102
|
name: coveralls
|
84
103
|
requirement: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
104
|
requirements:
|
87
105
|
- - ! '>='
|
88
106
|
- !ruby/object:Gem::Version
|
@@ -90,7 +108,6 @@ dependencies:
|
|
90
108
|
type: :development
|
91
109
|
prerelease: false
|
92
110
|
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
111
|
requirements:
|
95
112
|
- - ! '>='
|
96
113
|
- !ruby/object:Gem::Version
|
@@ -98,7 +115,6 @@ dependencies:
|
|
98
115
|
- !ruby/object:Gem::Dependency
|
99
116
|
name: sqlite3
|
100
117
|
requirement: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
118
|
requirements:
|
103
119
|
- - ! '>='
|
104
120
|
- !ruby/object:Gem::Version
|
@@ -106,7 +122,6 @@ dependencies:
|
|
106
122
|
type: :development
|
107
123
|
prerelease: false
|
108
124
|
version_requirements: !ruby/object:Gem::Requirement
|
109
|
-
none: false
|
110
125
|
requirements:
|
111
126
|
- - ! '>='
|
112
127
|
- !ruby/object:Gem::Version
|
@@ -133,7 +148,9 @@ files:
|
|
133
148
|
- .travis.yml
|
134
149
|
- CHANGELOG
|
135
150
|
- Gemfile
|
136
|
-
-
|
151
|
+
- LICENSE
|
152
|
+
- README.md
|
153
|
+
- REEK
|
137
154
|
- Rakefile
|
138
155
|
- flag_shih_tzu.gemspec
|
139
156
|
- gemfiles/Gemfile.activerecord-2.3.x
|
@@ -151,27 +168,26 @@ files:
|
|
151
168
|
homepage: https://github.com/pboling/flag_shih_tzu
|
152
169
|
licenses:
|
153
170
|
- MIT
|
171
|
+
metadata: {}
|
154
172
|
post_install_message:
|
155
173
|
rdoc_options: []
|
156
174
|
require_paths:
|
157
175
|
- lib
|
158
176
|
required_ruby_version: !ruby/object:Gem::Requirement
|
159
|
-
none: false
|
160
177
|
requirements:
|
161
178
|
- - ! '>='
|
162
179
|
- !ruby/object:Gem::Version
|
163
180
|
version: '0'
|
164
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
-
none: false
|
166
182
|
requirements:
|
167
183
|
- - ! '>='
|
168
184
|
- !ruby/object:Gem::Version
|
169
185
|
version: '0'
|
170
186
|
requirements: []
|
171
187
|
rubyforge_project:
|
172
|
-
rubygems_version: 1.
|
188
|
+
rubygems_version: 2.1.11
|
173
189
|
signing_key:
|
174
|
-
specification_version:
|
190
|
+
specification_version: 4
|
175
191
|
summary: Bit fields for ActiveRecord
|
176
192
|
test_files:
|
177
193
|
- test/database.yml
|