Methods not available

Hi all. Noticed that with rspec 1.x

methods at “higher levels” aren’t available in lower, ex:

context “a” do
def go
end

it “should pass” do
go
end

it “should pass again” do
context “a::b” do
go
end
end

end

This surprised me a bit, making re-use of outer methods unavailable.
Is it expected?

Thanks!
-r

On Jul 20, 2010, at 1:07 PM, rogerdpack wrote:

end

it “should pass again” do
context “a::b” do

You can’t wrap contexts inside examples.

This should work:

describe “a” do
def go; end
context “b” do
it “should access go” do
go
end
end
end

HTH,
David

it “should pass again” do
context “a::b” do

You can’t wrap contexts inside examples.

Cool thanks for the reply.
The confusing part is that it allowed me to have that context within
an example.

Maybe a more explicit failure for newbies when they do this would be
kind.
-r

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