spec/acceptance_spec.rb in freeform-1.0.6 vs spec/acceptance_spec.rb in freeform-1.0.8
- old
+ new
@@ -45,13 +45,13 @@
$VERBOSE = v
klass
end
let(:form) do
- f = form_class.new( :company => Company.new )
- f.build_task
- f
+ form_class.new( :company => Company.new ).tap do |f|
+ f.build_task
+ end
end
describe "form initialization", :initialization => true do
it "initializes with Company model" do
form.company.should be_a(Company)
@@ -376,11 +376,11 @@
it "should raise error on 'save!'" do
expect{ form.save! }.to raise_error(FreeForm::FormInvalid)
end
end
- context "with invalid attributes, and marked for destruction nested model", :failing => true do
+ context "with invalid attributes, and marked for destruction nested model" do
let(:attributes) do {
:company_name => "dummycorp",
:project_name => "",
"due_date(1i)" => "2014",
"due_date(2i)" => "10",
@@ -416,11 +416,11 @@
it "should have the second form still set to _destroy" do
form.tasks.second.should be_marked_for_destruction
end
end
-# it "should have valid company and project after save", :failing_1 => true do
+# it "should have valid company and project after save", :failing => true do
# form.save
# # form.tasks.first.task.destroy
# form.company.should be_valid
# form.project.valid?
# puts "Errors = #{form.project.errors.inspect}"
@@ -459,26 +459,30 @@
before(:each) do
form.fill(attributes)
end
it { is pending }
-# it "should return true on 'save'" do
-# form.save.should be_true
-# end
-# it "should have valid company and project after save", :failing_1 => true do
+# it "should have valid company and project after save", :failing => true do
# form.save
-# # form.tasks.first.task.destroy
+# # form.tasks.last.task.destroy
+# # form.valid?
# form.company.should be_valid
# form.project.valid?
-# puts "Errors = #{form.project.errors.inspect}"
+# # puts "Errors = #{form.project.errors.inspect}"
+
+# # form.project.tasks.each do |task|
+# # puts "Task = #{task.inspect}"
+# # puts "Valid = #{task.valid?}"
+# # puts "Errors = #{task.errors.inspect}"
+# # end
# form.project.should be_valid
# end
-# it "should not raise error on 'save!'" do
-# expect{ form.save! }.to_not raise_error
-# end
- end
+# # it "should not raise error on 'save!'" do
+# # expect{ form.save! }.to_not raise_error
+# # end
+ end
context "with valid attributes" do
let(:attributes) do {
:company_name => "dummycorp",
:project_name => "railsapp",