Showing posts with label integration testing. Show all posts
Showing posts with label integration testing. Show all posts

Wednesday, December 31

Quick Fix: YAML syntax & Fixtures issue

Today I got a mail from one of my juniors who was struck with some strange problem.  
While he started playing with built in unit tests in one of his rails project, he got an error

Errno::ENOENT: No such file or directory - ramesh

  I was bit confused with this error and asked him to send me a screen shot of the error so that I can understand it better.  And here he sent the following snapshot,

Well when I got this it was very clear that the problem was with fixtures.  So I peeked into his fixtures, which is like this:


having looked into the fixture,  it was pretty clear that this is about right syntax.  And this was the quick fix which worked out:


Quickly revising back about YAML & Syntax while defining hierarchical elements would give you clear view of this quick fix.

  Anyways, it was the mistake in the indentation while defining the YAML :)

Wednesday, November 12

Integration Testing: xml_http_request

I was referring to Agile Web Development with Rails book to implement the Integration testing. And as per the book it

xml_http_request "/store/add_to_cart" , :id => ruby_book.id

and strangely I was getting syntax error. Seems the book did miss out another parameter which would define the method type. Referring to online documentation, made things clear.

xml_http_request(request_method, path, parameters = nil, headers = nil)

Performs an XMLHttpRequest request with the given parameters, mirroring a request from the Prototype library.

The request_method is :get, :post, :put, :delete or :head; the parameters are nil, a hash, or a url-encoded or multipart string; the headers are a hash. Keys are automatically upcased and prefixed with ‘HTTP_’ if not already.