On Wed, Apr 27, 2011 at 2:55 PM, Sergio Ruiz <li...@ruby-forum.com> wrote:
> i am setting up a few objects that are interrelated for use in an rspec > test.. > > something like: > > describe Dimension do > > before(:each) do > text = "string here" > end > > it "should puts string" do > puts text > end > > end > > when i run this, i get an error: undefined local variable or method > `text' > > am doing something wrong? > Yeah, you have to use a class variable: before(:each) do @text = "string here" end it "should puts string" do puts @text end > > thanks! > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users