spec/unit/form_builder_spec.rb in activeadmin-1.0.0.pre2 vs spec/unit/form_builder_spec.rb in activeadmin-1.0.0.pre3
- old
+ new
@@ -561,11 +561,14 @@
end
describe "with allow destroy" do
context "with an existing post" do
let :body do
+ s = self
build_form({url: '/categories'}, Category.new) do |f|
- allow(f.object.posts.build).to receive(:new_record?).and_return(false)
+ s.instance_exec do
+ allow(f.object.posts.build).to receive(:new_record?).and_return(false)
+ end
f.has_many :posts, allow_destroy: true do |p|
p.input :title
end
end
end