Integration Testing Posting Problem

Hi! I am trying to get the hang of perform integration testing and I
have a slight problem with posting.

Basically, I can pull the id like so:

@nodename = Node.find_by_name(“servername”).id

Then able to get a valid 200 message with:

get “/nodes/#{@nodename.id}/edit”
assert_equal 200, status

But when I attempted to post:

post “/nodes/#{@nodename.id}/edit”, :node => {:datacenter =>“someplace”,
:name => “servername”,
:application => “appname” }

I either get a 404 message or 422 message (usually 404) after
executing assert_equal 200, status:

  1. Failure:
    test_edit_node(NodesTest) [/test/integration/nodes_test.rb:43]:
    <200> expected but was
    <404>

I thought it was a redirect problem, so I tried assert_redirected_to
“/nodes/#{@nodename.id}”. I get:

  1. Failure:
    test_edit_node(NodesTest) [/test/integration/nodes_test.rb:41]:
    Expected response to be a <:redirect>, but was <404>

I am missing something here. A pointer to the right direction would be
helpful at the moment.

Okay, let me fix something before I make a further fool of myself. This:

@nodename = Node.find_by_name(“servername”).id

Should be:

@nodename = Node.find_by_name(“servername”)

So that’s fixed and I can definitely say that works.

Posting problem still exists, though. :frowning:

On Tue, Aug 4, 2009 at 5:27 PM, rilindo foster[email protected] wrote:

assert_equal 200, status

  1. Failure:

I am missing something here. A pointer to the right direction would be
helpful at the moment.


Rilindo F.
AOL Instant Messenger: rilindo
Google Talk: [email protected]
Web S.: http://www.monzell.com
Primary: [email protected]
Secondary: [email protected]
"Rich bachelors should be heavily taxed. It is not fair that some men
should be happier than others. – Oscar Wilde