freeform 1.0.6 → 1.0.8

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODlhMjM1OTg3MTFhNzFjMGIxNGYzN2EyM2YyYjUwMWM2MTc3YzlkMg==
4
+ M2UxYmY1NDkyMjcyYTBkZmZkMDU1ZjdlM2Y3M2U0ODMxOGZlNzhhYg==
5
5
  data.tar.gz: !binary |-
6
- YzZmYjY2MDU5NzVkMWViODZmNzI4YTFmYzZmYjMxOTMwMDU2NDE5NA==
6
+ NDY2MTIwYWVmMWJmZjQyNGYyZDVjNmFlN2M0MDlkZjRjMDhjY2Q0Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzM3ZTk4ZTFiZGU2MzNiNGZiZjA1NmQ4YTQ3OTVhNzNiNTkyNWEzMTc2ZTkx
10
- ZjE2MTI0N2ZkOWY5NzFjODdkMjdmYzlmOTkyYWVjZTk3YzhjNjg2ZmJmZDAy
11
- MDM5NDA2Yzk2MDlhZjQ1ZjAwZjU4YjIxNTIxMmY2OTUzZDJmMDI=
9
+ NDZlYjQ4OTZhOWRiOWZlZTkyMGI2MzgyYWY5OGNhYjBmOTk0OTdkYWEzM2Nj
10
+ MzE4ZDJiNjIwYzU1MjY5YWZiN2U1ZTE3ZTM5ZGUyMWM4ZWQwYWE3NjI2NTkw
11
+ MTY1MmMyZWRkZGUwOWI4NGVkNmRkMDg1NTg5YmM1OWMxZmRmMjk=
12
12
  data.tar.gz: !binary |-
13
- MmMyMWVkMTUwYjEzOWI3OGZlMzI0N2JlNmU1OWJiNjFmZTYyMDljMGE4ZTI5
14
- NzU0YTUzOTE0ODFkMWE5NmE5MDlkYWI3ODVhYTQ0NmJjNDZhMjJjZWU1YTdk
15
- YzQwMGI1YjBmMWYxNmE3MTI5Y2NiODU5ZmI1ZjQ4YmFmZjRmMTQ=
13
+ NzY5MjlkOTg0NDY4N2MyNWRiOGQ0OTIzYmE1MjRiNWQ2ZDg4YmY4YzkwM2Q5
14
+ M2E1MDFlMjIxOWE4NTRmNGNmYWU0ZWZhOTAyMzQ2ZGQzOWUyNjc1MTUwNDll
15
+ ZGQxOTg3NWNmMzgyZjU3NjM5ZGNlYWUwYTAyNWY4YTBhZjIwNzQ=
data/Gemfile.lock CHANGED
@@ -1,22 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- freeform (1.0.4)
4
+ freeform (1.0.6)
5
5
  activemodel
6
6
  formtastic
7
- nested_form (~> 0.3.2)
8
- rails (~> 3.2.0)
7
+ rails (~> 3.2.0, >= 3.2.0)
9
8
  simple_form
10
9
 
11
10
  GEM
12
11
  remote: https://rubygems.org/
13
12
  specs:
14
- actionmailer (3.2.16)
15
- actionpack (= 3.2.16)
13
+ actionmailer (3.2.17)
14
+ actionpack (= 3.2.17)
16
15
  mail (~> 2.5.4)
17
- actionpack (3.2.16)
18
- activemodel (= 3.2.16)
19
- activesupport (= 3.2.16)
16
+ actionpack (3.2.17)
17
+ activemodel (= 3.2.17)
18
+ activesupport (= 3.2.17)
20
19
  builder (~> 3.0.0)
21
20
  erubis (~> 2.7.0)
22
21
  journey (~> 1.0.4)
@@ -24,18 +23,18 @@ GEM
24
23
  rack-cache (~> 1.2)
25
24
  rack-test (~> 0.6.1)
26
25
  sprockets (~> 2.2.1)
27
- activemodel (3.2.16)
28
- activesupport (= 3.2.16)
26
+ activemodel (3.2.17)
27
+ activesupport (= 3.2.17)
29
28
  builder (~> 3.0.0)
30
- activerecord (3.2.16)
31
- activemodel (= 3.2.16)
32
- activesupport (= 3.2.16)
29
+ activerecord (3.2.17)
30
+ activemodel (= 3.2.17)
31
+ activesupport (= 3.2.17)
33
32
  arel (~> 3.0.2)
34
33
  tzinfo (~> 0.3.29)
35
- activeresource (3.2.16)
36
- activemodel (= 3.2.16)
37
- activesupport (= 3.2.16)
38
- activesupport (3.2.16)
34
+ activeresource (3.2.17)
35
+ activemodel (= 3.2.17)
36
+ activesupport (= 3.2.17)
37
+ activesupport (3.2.17)
39
38
  i18n (~> 0.6, >= 0.6.4)
40
39
  multi_json (~> 1.0)
41
40
  arel (3.0.3)
@@ -47,7 +46,7 @@ GEM
47
46
  rack-test (>= 0.5.4)
48
47
  selenium-webdriver (~> 2.0)
49
48
  xpath (~> 0.1.4)
50
- childprocess (0.3.9)
49
+ childprocess (0.5.1)
51
50
  ffi (~> 1.0, >= 1.0.11)
52
51
  diff-lcs (1.2.5)
53
52
  erubis (2.7.0)
@@ -61,14 +60,13 @@ GEM
61
60
  mail (2.5.4)
62
61
  mime-types (~> 1.16)
63
62
  treetop (~> 1.4.8)
64
- metaclass (0.0.1)
63
+ metaclass (0.0.4)
65
64
  mime-types (1.25.1)
66
65
  mini_portile (0.5.2)
67
- mocha (0.14.0)
66
+ mocha (1.0.0)
68
67
  metaclass (~> 0.0.1)
69
- multi_json (1.8.2)
70
- nested_form (0.3.2)
71
- nokogiri (1.6.0)
68
+ multi_json (1.9.0)
69
+ nokogiri (1.6.1)
72
70
  mini_portile (~> 0.5.0)
73
71
  polyglot (0.3.4)
74
72
  rack (1.4.5)
@@ -78,42 +76,43 @@ GEM
78
76
  rack
79
77
  rack-test (0.6.2)
80
78
  rack (>= 1.0)
81
- rails (3.2.16)
82
- actionmailer (= 3.2.16)
83
- actionpack (= 3.2.16)
84
- activerecord (= 3.2.16)
85
- activeresource (= 3.2.16)
86
- activesupport (= 3.2.16)
79
+ rails (3.2.17)
80
+ actionmailer (= 3.2.17)
81
+ actionpack (= 3.2.17)
82
+ activerecord (= 3.2.17)
83
+ activeresource (= 3.2.17)
84
+ activesupport (= 3.2.17)
87
85
  bundler (~> 1.0)
88
- railties (= 3.2.16)
89
- railties (3.2.16)
90
- actionpack (= 3.2.16)
91
- activesupport (= 3.2.16)
86
+ railties (= 3.2.17)
87
+ railties (3.2.17)
88
+ actionpack (= 3.2.17)
89
+ activesupport (= 3.2.17)
92
90
  rack-ssl (~> 1.3.2)
93
91
  rake (>= 0.8.7)
94
92
  rdoc (~> 3.4)
95
93
  thor (>= 0.14.6, < 2.0)
96
- rake (10.1.0)
94
+ rake (10.1.1)
97
95
  rdoc (3.12.2)
98
96
  json (~> 1.4)
99
97
  rspec (2.14.1)
100
98
  rspec-core (~> 2.14.0)
101
99
  rspec-expectations (~> 2.14.0)
102
100
  rspec-mocks (~> 2.14.0)
103
- rspec-core (2.14.7)
104
- rspec-expectations (2.14.4)
101
+ rspec-core (2.14.8)
102
+ rspec-expectations (2.14.5)
105
103
  diff-lcs (>= 1.1.3, < 2.0)
106
- rspec-mocks (2.14.4)
107
- rspec-rails (2.14.0)
104
+ rspec-mocks (2.14.6)
105
+ rspec-rails (2.14.1)
108
106
  actionpack (>= 3.0)
107
+ activemodel (>= 3.0)
109
108
  activesupport (>= 3.0)
110
109
  railties (>= 3.0)
111
110
  rspec-core (~> 2.14.0)
112
111
  rspec-expectations (~> 2.14.0)
113
112
  rspec-mocks (~> 2.14.0)
114
113
  rubyzip (1.1.0)
115
- selenium-webdriver (2.38.0)
116
- childprocess (>= 0.2.5)
114
+ selenium-webdriver (2.40.0)
115
+ childprocess (>= 0.5.0)
117
116
  multi_json (~> 1.0)
118
117
  rubyzip (~> 1.0)
119
118
  websocket (~> 1.0.4)
@@ -125,13 +124,13 @@ GEM
125
124
  multi_json (~> 1.0)
126
125
  rack (~> 1.0)
127
126
  tilt (~> 1.1, != 1.3.0)
128
- sqlite3 (1.3.8)
127
+ sqlite3 (1.3.9)
129
128
  thor (0.18.1)
130
129
  tilt (1.4.1)
131
130
  treetop (1.4.15)
132
131
  polyglot
133
132
  polyglot (>= 0.3.1)
134
- tzinfo (0.3.38)
133
+ tzinfo (0.3.39)
135
134
  websocket (1.0.7)
136
135
  xpath (0.1.4)
137
136
  nokogiri (~> 1.3)
data/Rakefile CHANGED
@@ -14,9 +14,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
-
18
-
19
-
20
17
  Bundler::GemHelper.install_tasks
21
18
 
22
19
  require 'rake/testtask'
data/freeform.gemspec CHANGED
@@ -21,8 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "activemodel"
22
22
  spec.add_dependency "simple_form"
23
23
  spec.add_dependency "formtastic"
24
- spec.add_dependency "nested_form", "~> 0.3.2"
25
- spec.add_dependency "rails", "~> 3.2.0"
24
+ spec.add_dependency "rails", "~> 3.2.0", ">= 3.2.0"
26
25
  spec.add_development_dependency "bundler", "~> 1.3"
27
26
  spec.add_development_dependency "rake"
28
27
  spec.add_development_dependency "sqlite3"
data/lib/freeform/form.rb CHANGED
@@ -29,25 +29,6 @@ module FreeForm
29
29
  initialize_child_models
30
30
  end
31
31
 
32
- # def save
33
- # return false unless valid?
34
-
35
- # self.class.models.each do |form_model|
36
- # model = send(form_model)
37
- # model.is_a?(Array) ? model.each { |m| m.save } : save_or_destroy(model)
38
- # end
39
- # end
40
-
41
- # def save!
42
- # raise FreeForm::FormInvalid, "form invalid." unless valid?
43
-
44
- # self.class.models.each do |form_model|
45
- # model = send(form_model)
46
- # model.is_a?(Array) ? model.each { |m| m.save! } : save_or_destroy!(model)
47
- # end
48
- # end
49
-
50
-
51
32
  def save
52
33
  return false unless valid? || marked_for_destruction?
53
34
 
@@ -83,6 +64,65 @@ module FreeForm
83
64
  end
84
65
  end
85
66
 
67
+ # def destroy_all_marked_for_destruction
68
+ # self.class.models.each do |form_model|
69
+ # model = send(form_model)
70
+ # # This is for nested form models.
71
+ # if model.is_a?(Array)
72
+ # model.each { |m| m.destroy_all_marked_for_destruction }
73
+ # end
74
+ # end
75
+
76
+ # # Destroy objects
77
+ # self.class.models.each do |form_model|
78
+ # model = send(form_model)
79
+ # unless model.is_a?(Array)
80
+ # if marked_for_destruction?
81
+ # model.destroy
82
+ # end
83
+ # end
84
+ # end
85
+ # end
86
+
87
+ # def save
88
+ # return false unless valid? || marked_for_destruction?
89
+
90
+ # # NEW LOGIC!! Destroy all forms from the bottom up, then save all from the top down!
91
+ # destroy_all_marked_for_destruction
92
+
93
+
94
+ # # Save parent form objects first
95
+ # self.class.models.each do |form_model|
96
+ # model = send(form_model)
97
+ # # This is for nested form models.
98
+ # unless model.is_a?(Array)
99
+ # unless marked_for_destruction?
100
+ # # puts "Saving #{model.inspect}"
101
+ # model.save
102
+ # # puts "Errors = #{model.errors.inspect}"
103
+ # end
104
+ # end
105
+ # end
106
+
107
+ # # Save then call save on nested models
108
+ # self.class.models.each do |form_model|
109
+ # model = send(form_model)
110
+ # # This is for nested form models.
111
+ # if model.is_a?(Array)
112
+ # model.each { |m| m.save }
113
+ # end
114
+ # end
115
+ # end
116
+
117
+ # def save!
118
+ # raise FreeForm::FormInvalid, "form invalid." unless valid?
119
+
120
+ # self.class.models.each do |form_model|
121
+ # model = send(form_model)
122
+ # model.is_a?(Array) ? model.each { |m| m.save! } : save_or_destroy!(model)
123
+ # end
124
+ # end
125
+
86
126
  private
87
127
  def initialize_child_models
88
128
  self.class.child_models.each do |c|
@@ -1,3 +1,3 @@
1
1
  module Freeform
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.8"
3
3
  end
@@ -47,9 +47,9 @@ describe FreeForm::Form do
47
47
  end
48
48
 
49
49
  let(:form) do
50
- f = form_class.new( :company => Company.new )
51
- f.build_task
52
- f
50
+ form_class.new( :company => Company.new ).tap do |f|
51
+ f.build_task
52
+ end
53
53
  end
54
54
 
55
55
  describe "form initialization", :initialization => true do
@@ -378,7 +378,7 @@ describe FreeForm::Form do
378
378
  end
379
379
  end
380
380
 
381
- context "with invalid attributes, and marked for destruction nested model", :failing => true do
381
+ context "with invalid attributes, and marked for destruction nested model" do
382
382
  let(:attributes) do {
383
383
  :company_name => "dummycorp",
384
384
  :project_name => "",
@@ -418,7 +418,7 @@ describe FreeForm::Form do
418
418
  end
419
419
  end
420
420
 
421
- # it "should have valid company and project after save", :failing_1 => true do
421
+ # it "should have valid company and project after save", :failing => true do
422
422
  # form.save
423
423
  # # form.tasks.first.task.destroy
424
424
  # form.company.should be_valid
@@ -461,23 +461,27 @@ describe FreeForm::Form do
461
461
  end
462
462
 
463
463
  it { is pending }
464
- # it "should return true on 'save'" do
465
- # form.save.should be_true
466
- # end
467
464
 
468
- # it "should have valid company and project after save", :failing_1 => true do
465
+ # it "should have valid company and project after save", :failing => true do
469
466
  # form.save
470
- # # form.tasks.first.task.destroy
467
+ # # form.tasks.last.task.destroy
468
+ # # form.valid?
471
469
  # form.company.should be_valid
472
470
  # form.project.valid?
473
- # puts "Errors = #{form.project.errors.inspect}"
471
+ # # puts "Errors = #{form.project.errors.inspect}"
472
+
473
+ # # form.project.tasks.each do |task|
474
+ # # puts "Task = #{task.inspect}"
475
+ # # puts "Valid = #{task.valid?}"
476
+ # # puts "Errors = #{task.errors.inspect}"
477
+ # # end
474
478
  # form.project.should be_valid
475
479
  # end
476
480
 
477
- # it "should not raise error on 'save!'" do
478
- # expect{ form.save! }.to_not raise_error
479
- # end
480
- end
481
+ # # it "should not raise error on 'save!'" do
482
+ # # expect{ form.save! }.to_not raise_error
483
+ # # end
484
+ end
481
485
 
482
486
  context "with valid attributes" do
483
487
  let(:attributes) do {
Binary file