Re: [rspec-users] before(:each) <- need some clarification

2011-04-28 Thread Matthew Van Horn
On Apr 27, 2011, at 3:55 PM, Sergio Ruiz 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

Re: [rspec-users] before(:each) <- need some clarification

2011-04-28 Thread Sergio Ruiz
wow! thanks so much for the great info! this is exactly what i needed! thanks again! -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] before(:each) <- need some clarification

2011-04-27 Thread Rodrigo Rosenfeld Rosas
Wow! I guess this thread beated the record for simultaneous answers! :D Best regards! Rodrigo. Em 27-04-2011 16:55, Sergio Ruiz escreveu: 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 he

Re: [rspec-users] before(:each) <- need some clarification

2011-04-27 Thread Matt Wynne
Hi, On 27 Apr 2011, at 20:55, Sergio Ruiz 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" This defines a local variable 'text' which lives for the duration of th

Re: [rspec-users] before(:each) <- need some clarification

2011-04-27 Thread Jon Homan
Sergio, I believe you need to make text an instance variable: @text = "string here" Or you could use a let block: let(:text) do "string "here" end Then you could continue to reference the text variable as you do now. Jon Homan On Wed, Apr 27, 2011 at 2:55 PM, Sergio Ruiz

Re: [rspec-users] before(:each) <- need some clarification

2011-04-27 Thread David Kahn
On Wed, Apr 27, 2011 at 2:55 PM, Sergio Ruiz 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 > > whe

Re: [rspec-users] before(:each) <- need some clarification

2011-04-27 Thread David Chelimsky
On Apr 27, 2011, at 3:55 PM, Sergio Ruiz 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

Re: [rspec-users] before(:each) <- need some clarification

2011-04-27 Thread Srushti Ambekallu
On 28/04/11 1:25 AM, Sergio Ruiz 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

Re: [rspec-users] before(:each) <- need some clarification

2011-04-27 Thread Bouke Woudstra
Your variable "text" doesn't exist outside the before(:each) loop. Replacing text with @text should fix your problem. -- Bouke 2011/4/27 Sergio Ruiz > i am setting up a few objects that are interrelated for use in an rspec > test.. > > something like: > > describe Dimension do > > before(:each)