# Integration Testing Posting Problem

**URL:** <https://www.ruby-forum.com/t/integration-testing-posting-problem/173209>\
**Category:** Rails\
**Created:** [August 4, 2009, 11:28pm UTC](https://www.ruby-forum.com/t/integration-testing-posting-problem/173209 "2009-08-04T23:28:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rilindo\_foster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@rilindo\_foster](https://www.ruby-forum.com/u/rilindo_foster)\
**Post date:** [August 4, 2009, 11:28pm UTC](https://www.ruby-forum.com/t/integration-testing-posting-problem/173209/1 "2009-08-04T23:28:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rilindo\_foster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@rilindo\_foster](https://www.ruby-forum.com/u/rilindo_foster)\
**Post date:** [August 4, 2009, 11:35pm UTC](https://www.ruby-forum.com/t/integration-testing-posting-problem/173209/2 "2009-08-04T23:35:16Z")

</div>

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. ☹

On Tue, Aug 4, 2009 at 5:27 PM, rilindo foster[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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: removed\_email\_address@domain.invalid  
Web S.: [http://www.monzell.com](http://www.monzell.com)  
Primary: removed\_email\_address@domain.invalid  
Secondary: removed\_email\_address@domain.invalid  
"Rich bachelors should be heavily taxed. It is not fair that some men  
should be happier than others. – Oscar Wilde
