spec/unit/form_builder_spec.rb in activeadmin-0.2.2 vs spec/unit/form_builder_spec.rb in activeadmin-0.3.0

- old
+ new

@@ -1,11 +1,11 @@ require 'spec_helper' describe ActiveAdmin::FormBuilder do - include Arbre::HTML - let(:assigns){ {} } + setup_arbre_context! + # Setup an ActionView::Base object which can be used for # generating the form for. let(:helpers) do view = action_view def view.posts_path @@ -26,10 +26,11 @@ view end def build_form(options = {}, &block) + options.merge!({:url => posts_path}) active_admin_form_for Post.new, options, &block end context "in general" do let :body do @@ -58,9 +59,26 @@ it "should generate buttons" do body.should have_tag("input", :attributes => { :type => "submit", :value => "Submit Me" }) body.should have_tag("input", :attributes => { :type => "submit", :value => "Another Button" }) + end + end + + context "when polymorphic relationship" do + + let(:body) do + comment = ActiveAdmin::Comment.new + + active_admin_form_for comment, :url => "admins/comments" do |f| + f.inputs :resource + end + + end + + it "should not generate any field" do + body.should have_tag("form", :attributes => { :method => 'post' }) + body.should_not have_tag("select") end end describe "passing in options" do let :body do