Why does nesting this spec fail?

Hi,

This fails:

describe UsersController::QuickSearch do
controller_name “users”

describe “created with search text” do
before(:each) do
@quick_search =
UsersController::QuickSearch.new(“quick_search[search_text]” =>
“search_text”)
end

it "should turn search text into a search on the first name, 

surname,
username and secondary email" do
@quick_search.to_conditions.should == {
:conditions => “…”
}
end
end
end

with this error:

ArgumentError in ‘UsersController::QuickSearch created with search text
should turn search text into a search on the first name, surname,
username
and secondary email’
wrong number of arguments (0 for 1)
script/spec:4:

But if I comment out the nested describe

describe “created with search text” do

before(:each) do
@quick_search = …

it works fine.

Anyone got any ideas? I must be doing something stupid, I’ve got a
nearly
identical one immediately below.

Thanks
Ashley

On 27/03/2008, Ashley M. [email protected] wrote:

I must be doing something stupid, I’ve got a nearly identical one
immediately below.

I lied, it was not identical, but when I nest another one where I have
to
specify the controller it warns me. Adding this to the NESTED describe
block fixes it:
controller_name “users”

Don’t know why it gives such a mysterious error instead of “You have to
declare the controller name in controller specs.” though.

Known bug, or in need of a LH ticket? Desirable behaviour would seem to
be
that inner blocks inherit the controller.

Ashley

On Thu, Mar 27, 2008 at 9:35 AM, Ashley M.
[email protected] wrote:

block fixes it:
controller_name “users”

Don’t know why it gives such a mysterious error instead of “You have to
declare the controller name in controller specs.” though.

Known bug, or in need of a LH ticket? Desirable behaviour would seem to be
that inner blocks inherit the controller.

This is fixed in trunk.

Pat

On 27/03/2008, Pat M. [email protected] wrote:

This is fixed in trunk.

Ok cool, as it happens I just updated to trunk to get the nested shared
example groups.

Ta

Ashley

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs