has_many_booleans 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +73 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +9 -7
- data/Rakefile +3 -1
- data/lib/has_many_booleans.rb +14 -58
- data/lib/has_many_booleans/version.rb +3 -0
- data/test/database.yml +1 -1
- data/test/debug.log +1757 -16500
- data/test/has_many_booleans_test.rb +11 -12
- data/test/simple_bitset_test.rb +1 -1
- data/test/test_helper.rb +6 -1
- metadata +14 -14
- data/test/has_many_booleans_plugin.sqlite3 +0 -0
@@ -1,8 +1,4 @@
|
|
1
|
-
|
2
|
-
# available at <http://github.com/janlelis/has_many_booleans>
|
3
|
-
# more info at <http://rbjl.net/22>
|
4
|
-
|
5
|
-
require File.dirname(__FILE__) + '/test_helper.rb'
|
1
|
+
require File.expand_path( File.dirname(__FILE__) + '/test_helper' )
|
6
2
|
|
7
3
|
class HasManyBooleansTest < ActiveSupport::TestCase
|
8
4
|
load_schema
|
@@ -89,12 +85,14 @@ class HasManyBooleansTest < ActiveSupport::TestCase
|
|
89
85
|
|
90
86
|
class ArCallback < ActiveRecord::Base
|
91
87
|
has_many_booleans :name, :password, :admin
|
88
|
+
after_initialize :cb_after_initialize
|
89
|
+
before_save :cb_before_save
|
92
90
|
|
93
|
-
def
|
91
|
+
def cb_after_initialize
|
94
92
|
self.name = "Yukihiro"
|
95
93
|
end
|
96
94
|
|
97
|
-
def
|
95
|
+
def cb_before_save
|
98
96
|
self.name = 'matz'
|
99
97
|
end
|
100
98
|
end
|
@@ -273,7 +271,7 @@ class HasManyBooleansTest < ActiveSupport::TestCase
|
|
273
271
|
@a = ArCallback.new :name_activated => true, :name => 'Hildegard', :password => '123'
|
274
272
|
|
275
273
|
assert @a.name_activated
|
276
|
-
assert_equal @a.name, '
|
274
|
+
assert_equal @a.name, 'Hildegard'
|
277
275
|
assert_equal @a.password, '123'
|
278
276
|
end
|
279
277
|
|
@@ -396,9 +394,9 @@ class HasManyBooleansTest < ActiveSupport::TestCase
|
|
396
394
|
|
397
395
|
snd :password, '=', false
|
398
396
|
snd :name, '=', false
|
399
|
-
assert_not @a.save, @a.errors.full_messages
|
397
|
+
assert_not @a.save, @a.errors.full_messages.inspect
|
400
398
|
snd :name, '=', true
|
401
|
-
assert @a.save, @a.errors.full_messages
|
399
|
+
assert @a.save, @a.errors.full_messages.inspect
|
402
400
|
end
|
403
401
|
|
404
402
|
test 'validates_false' do
|
@@ -406,10 +404,11 @@ class HasManyBooleansTest < ActiveSupport::TestCase
|
|
406
404
|
|
407
405
|
snd :name, '=', true
|
408
406
|
snd :password, '=', true
|
409
|
-
assert_not @a.save, @a.errors.full_messages
|
407
|
+
assert_not @a.save, @a.errors.full_messages.inspect
|
410
408
|
snd :password, '=', false
|
411
|
-
assert @a.save, @a.errors.full_messages
|
409
|
+
assert @a.save, @a.errors.full_messages.inspect
|
412
410
|
end
|
413
411
|
|
414
412
|
end
|
415
413
|
|
414
|
+
# J-_-L
|
data/test/simple_bitset_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
gem 'activesupport', '>=3.0.0'
|
2
3
|
require 'active_support'
|
3
4
|
require 'active_support/test_case'
|
5
|
+
gem 'activerecord', ">=3.0.0"
|
6
|
+
require 'active_record'
|
7
|
+
require 'rails'
|
8
|
+
require 'logger'
|
4
9
|
|
5
10
|
# # #
|
6
11
|
# setup test environment
|
@@ -9,7 +14,7 @@ ENV['RAILS_ENV'] = 'test'
|
|
9
14
|
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
|
10
15
|
|
11
16
|
require 'test/unit'
|
12
|
-
require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
|
17
|
+
#require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
|
13
18
|
|
14
19
|
def load_schema
|
15
20
|
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_many_booleans
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 61
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
8
|
+
- 4
|
9
|
+
version: 0.9.4
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Jan Lelis
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date:
|
17
|
+
date: 2011-02-06 00:00:00 +01:00
|
19
18
|
default_executable:
|
20
19
|
dependencies: []
|
21
20
|
|
@@ -28,21 +27,24 @@ extensions: []
|
|
28
27
|
extra_rdoc_files:
|
29
28
|
- README.rdoc
|
30
29
|
files:
|
31
|
-
- MIT-LICENSE
|
32
|
-
- Rakefile
|
33
|
-
- README.rdoc
|
34
30
|
- install.rb
|
31
|
+
- Gemfile
|
32
|
+
- Rakefile
|
33
|
+
- CHANGELOG.rdoc
|
35
34
|
- uninstall.rb
|
36
|
-
-
|
35
|
+
- MIT-LICENSE
|
36
|
+
- Gemfile.lock
|
37
|
+
- README.rdoc
|
38
|
+
- lib/has_many_booleans/version.rb
|
37
39
|
- lib/has_many_booleans/simple_bitset.rb
|
40
|
+
- lib/has_many_booleans.rb
|
38
41
|
- rails/init.rb
|
42
|
+
- test/database.yml
|
39
43
|
- test/simple_bitset_test.rb
|
40
44
|
- test/debug.log
|
41
|
-
- test/test_helper.rb
|
42
|
-
- test/has_many_booleans_test.rb
|
43
45
|
- test/schema.rb
|
44
|
-
- test/
|
45
|
-
- test/
|
46
|
+
- test/has_many_booleans_test.rb
|
47
|
+
- test/test_helper.rb
|
46
48
|
has_rdoc: true
|
47
49
|
homepage: http://github.com/janlelis/has_many_booleans
|
48
50
|
licenses: []
|
@@ -57,7 +59,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
59
|
requirements:
|
58
60
|
- - ">="
|
59
61
|
- !ruby/object:Gem::Version
|
60
|
-
hash: 3
|
61
62
|
segments:
|
62
63
|
- 0
|
63
64
|
version: "0"
|
@@ -66,7 +67,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
67
|
requirements:
|
67
68
|
- - ">="
|
68
69
|
- !ruby/object:Gem::Version
|
69
|
-
hash: 3
|
70
70
|
segments:
|
71
71
|
- 0
|
72
72
|
version: "0"
|
Binary file
|