spec/unit/form_builder_spec.rb in activeadmin-1.0.0 vs spec/unit/form_builder_spec.rb in activeadmin-1.1.0
- old
+ new
@@ -99,13 +99,13 @@
f.action :submit, label: "Another Button"
end
end
end
- it "should generate a text input" do
- expect(body).to have_selector("input[type=text][name='post[title]']")
- end
+ it "should generate a text input" do
+ expect(body).to have_selector("input[type=text][name='post[title]']")
+ end
it "should generate a textarea" do
expect(body).to have_selector("textarea[name='post[body]']")
end
it "should only generate the form once" do
expect(body).to have_selector("form", count: 1)
@@ -635,21 +635,21 @@
it "should have a check box with 'Remove' as its label" do
expect(body).to have_selector("label[for=category_posts_attributes_#{child_num}__destroy]", text: "Delete")
end
it "should wrap the destroy field in an li with class 'has_many_delete'" do
- expect(body).to have_selector(".has_many_container > fieldset > ol > li.has_many_delete > input", count: 1)
+ expect(body).to have_selector(".has_many_container > fieldset > ol > li.has_many_delete > input", count: 1, visible: false)
end
end
shared_examples_for "has many with allow_destroy = false" do |child_num|
it "should render the nested form" do
expect(body).to have_selector("input[name='category[posts_attributes][#{child_num}][title]']")
end
it "should not have a boolean field for _destroy" do
- expect(body).not_to have_selector("input[name='category[posts_attributes][#{child_num}][_destroy]']")
+ expect(body).not_to have_selector("input[name='category[posts_attributes][#{child_num}][_destroy]']", visible: :all)
end
it "should not have a check box with 'Remove' as its label" do
expect(body).not_to have_selector("label[for=category_posts_attributes_#{child_num}__destroy]", text: "Remove")
end
@@ -941,18 +941,18 @@
"f.input :title; nil" => "post_title",
"f.input :title; []" => "post_title",
"[:title].each{ |r| f.input r }" => "post_title",
"[:title].map { |r| f.input r }" => "post_title",
}.each do |source, selector|
- it "should properly buffer `#{source}`" do
- body = build_form do |f|
- f.inputs do
- eval source
- eval source
- end
- end
- expect(body).to have_selector("[id=#{selector}]", count: 2)
- end
+ it "should properly buffer `#{source}`" do
+ body = build_form do |f|
+ f.inputs do
+ eval source
+ eval source
+ end
+ end
+ expect(body).to have_selector("[id=#{selector}]", count: 2, visible: :all)
+ end
end
describe "datepicker input" do
context 'with default options' do
let :body do