snusnu-dm-accepts_nested_attributes 0.10.0 → 0.11.0
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/CHANGELOG +513 -0
- data/Manifest.txt +1 -2
- data/README.textile +20 -186
- data/TODO +3 -5
- data/lib/dm-accepts_nested_attributes.rb +0 -2
- data/lib/dm-accepts_nested_attributes/model.rb +46 -18
- data/lib/dm-accepts_nested_attributes/resource.rb +115 -39
- data/lib/dm-accepts_nested_attributes/transactional_save.rb +12 -1
- data/lib/dm-accepts_nested_attributes/version.rb +1 -1
- data/spec/fixtures/person.rb +15 -3
- data/spec/fixtures/profile.rb +2 -0
- data/spec/fixtures/project.rb +10 -4
- data/spec/lib/constraint_support.rb +11 -0
- data/spec/shared/belongs_to_spec.rb +18 -3
- data/spec/shared/has_1_spec.rb +41 -20
- data/spec/shared/has_n_spec.rb +32 -24
- data/spec/shared/has_n_through_spec.rb +45 -28
- data/spec/spec_helper.rb +3 -21
- metadata +5 -5
- data/lib/dm-accepts_nested_attributes/save.rb +0 -13
- data/spec/lib/rspec_tmbundle_support.rb +0 -35
data/spec/spec_helper.rb
CHANGED
@@ -8,6 +8,7 @@ require Pathname(__FILE__).dirname.parent.expand_path + 'lib/dm-accepts_nested_a
|
|
8
8
|
# must be required after the plugin, since
|
9
9
|
# dm-validations seems to need dm-core
|
10
10
|
require 'dm-validations'
|
11
|
+
require 'dm-constraints'
|
11
12
|
|
12
13
|
ENV["SQLITE3_SPEC_URI"] ||= 'sqlite3::memory:'
|
13
14
|
ENV["MYSQL_SPEC_URI"] ||= 'mysql://localhost/dm-accepts_nested_attributes_test'
|
@@ -28,30 +29,11 @@ def setup_adapter(name, default_uri = nil)
|
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
-
# support for nice html output in rspec tmbundle
|
33
|
-
# -----------------------------------------------
|
34
|
-
|
35
|
-
USE_TEXTMATE_RSPEC_BUNDLE = true # set to false if not using textmate
|
36
|
-
|
37
|
-
if USE_TEXTMATE_RSPEC_BUNDLE
|
38
|
-
|
39
|
-
require Pathname(__FILE__).dirname.expand_path + 'lib/rspec_tmbundle_support'
|
40
|
-
|
41
|
-
# use the tmbundle logger
|
42
|
-
RSpecTmBundleHelpers::TextmateRspecLogger.new(STDOUT, :off)
|
43
|
-
|
44
|
-
|
45
|
-
class Object
|
46
|
-
include RSpecTmBundleHelpers
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
ENV['ADAPTER'] ||= 'sqlite3'
|
32
|
+
ENV['ADAPTER'] ||= 'mysql'
|
52
33
|
setup_adapter(:default)
|
53
34
|
|
54
35
|
spec_dir = Pathname(__FILE__).dirname.to_s
|
36
|
+
Dir[ spec_dir + "/lib/**/*.rb" ].each { |rb| require(rb) }
|
55
37
|
Dir[ spec_dir + "/fixtures/**/*.rb" ].each { |rb| require(rb) }
|
56
38
|
Dir[ spec_dir + "/shared/**/*.rb" ].each { |rb| require(rb) }
|
57
39
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snusnu-dm-accepts_nested_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Martin Gamsj\xC3\xA4ger"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-25 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -55,12 +55,11 @@ files:
|
|
55
55
|
- lib/dm-accepts_nested_attributes/error_collecting.rb
|
56
56
|
- lib/dm-accepts_nested_attributes/model.rb
|
57
57
|
- lib/dm-accepts_nested_attributes/resource.rb
|
58
|
-
- lib/dm-accepts_nested_attributes/save.rb
|
59
58
|
- lib/dm-accepts_nested_attributes/transactional_save.rb
|
60
59
|
- lib/dm-accepts_nested_attributes/version.rb
|
61
60
|
- spec/spec.opts
|
62
61
|
- spec/spec_helper.rb
|
63
|
-
- spec/lib/
|
62
|
+
- spec/lib/constraint_support.rb
|
64
63
|
- spec/fixtures/person.rb
|
65
64
|
- spec/fixtures/profile.rb
|
66
65
|
- spec/fixtures/project.rb
|
@@ -82,6 +81,7 @@ files:
|
|
82
81
|
- tasks/spec.rb
|
83
82
|
has_rdoc: false
|
84
83
|
homepage: http://github.com/snusnu/dm-accepts_nested_attributes/tree/master
|
84
|
+
licenses:
|
85
85
|
post_install_message:
|
86
86
|
rdoc_options:
|
87
87
|
- --main
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
requirements: []
|
104
104
|
|
105
105
|
rubyforge_project: dm-accepts_nested_attributes
|
106
|
-
rubygems_version: 1.
|
106
|
+
rubygems_version: 1.3.5
|
107
107
|
signing_key:
|
108
108
|
specification_version: 3
|
109
109
|
summary: A DataMapper plugin that adds the possibility to perform nested model attribute assignment
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# -----------------------------------------------
|
2
|
-
# support for nice html output in rspec tmbundle
|
3
|
-
# -----------------------------------------------
|
4
|
-
|
5
|
-
module RSpecTmBundleHelpers
|
6
|
-
|
7
|
-
class TextmateRspecLogger < Extlib::Logger
|
8
|
-
def prep_msg(message, level)
|
9
|
-
"#{super}<br />"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def with_dm_logger(level = :debug)
|
14
|
-
DataMapper.logger.level = level
|
15
|
-
yield
|
16
|
-
ensure
|
17
|
-
DataMapper.logger.level = :off
|
18
|
-
end
|
19
|
-
|
20
|
-
def print_call_stack(from = 2, to = nil, html = true)
|
21
|
-
(from..(to ? to : caller.length)).each do |idx|
|
22
|
-
p "[#{idx}]: #{caller[idx]}#{html ? '<br />' : ''}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def puth(html = nil)
|
27
|
-
print "#{h(html)}<br />"
|
28
|
-
end
|
29
|
-
|
30
|
-
ESCAPE_TABLE = { '&'=>'&', '<'=>'<', '>'=>'>', '"'=>'"', "'"=>''', }
|
31
|
-
def h(value)
|
32
|
-
value.to_s.gsub(/[&<>"]/) {|s| ESCAPE_TABLE[s] }
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|