why hash not being passed into method?

P

Pauli Price

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
 
X

Xavier Shay

Pauli said:
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?)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top