[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

why hash not being passed into method?

Pauli Price

10/27/2008 6:17:00 PM

A rails plugin I'm trying to use has the following pattern of failing
tests:


--- unit test file for editor

def setup
create_editor!(:role => 'author')
end



--- "test factory" method meant to simplify test writing

def create_editor!(attributes = {})
default_attributes = {
# :key => 'value'
}
Editor.create! default_attributes.merge(attributes)
end

Using ruby-debug I have confirmed that the value of attributes is nil
inside create_editor!

What's going on? I don't belief that the plugin creator would have
published it if most of the tests failed.

I can play with the code to figure out how to correctly pass the hash (
I'm a ruby nuby, so the solution is not immediately obvious ) but I'm
curious about why it stopped working.

Any thoughts?

Pauli
--
Posted via http://www.ruby-....

1 Answer

Xavier Shay

10/27/2008 10:00:00 PM

0

Pauli Price wrote:
> Using ruby-debug I have confirmed that the value of attributes is nil
> inside create_editor!
>
> What's going on? I don't belief that the plugin creator would have
> published it if most of the tests failed.

Nothing obvious jumps out, please provide more source code (some code we
can execute to see the problem for ourselves?)
--
Posted via http://www.ruby-....