module ThoughtBot::Shoulda::Controller::XML::ClassMethods

def make_create_xml_tests(res) # :nodoc:

:nodoc:
def make_create_xml_tests(res) # :nodoc:
  context "on POST to #{controller_name_from_class}#create as xml" do
    setup do
      request_xml
      parent_params = make_parent_params(res)
      @count = res.klass.count
      post :create, parent_params.merge(res.object => res.create.params)
    end
    if res.denied.actions.include?(:create)
      should_respond_with 401
      should_not_assign_to res.object

      should "not create new record" do
        assert_equal @count, res.klass.count
      end          
    else
      should_assign_to res.object
      should "not have errors on @#{res.object}" do
        assert_equal [], pretty_error_messages(assigns(res.object)), "@#{res.object} has errors:"            
      end
    end      
  end
end