Re: [rspec-users] How to spec accessing a constant

2010-02-18 Thread Marcelo de Moraes Serpa
Why don't you open the class, and set the constant like so: class TheClass CONSTANT = 'value_it_should_have_for_the_current_spec' end This worked for me. Marcelo. On Thu, Oct 16, 2008 at 7:24 PM, Nick Hoffman wrote: > On 2008-10-16, at 15:12, Craig Demyanovich wrote: > >> Cool. Having seen

Re: [rspec-users] How to spec accessing a constant

2008-10-16 Thread Nick Hoffman
On 2008-10-16, at 15:12, Craig Demyanovich wrote: Cool. Having seen something a little more concrete, I like your design decisions. In this case, I'd go with Scott's recommendation of hiding the constant behind a method. Regards, Craig Thanks for taking a look, Craig, and giving me your op

Re: [rspec-users] How to spec accessing a constant

2008-10-16 Thread Craig Demyanovich
Cool. Having seen something a little more concrete, I like your design decisions. In this case, I'd go with Scott's recommendation of hiding the constant behind a method. Regards, Craig ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyfo

Re: [rspec-users] How to spec accessing a constant

2008-10-16 Thread Nick Hoffman
On 2008-10-15, at 21:59, Craig Demyanovich wrote: Since class A is coupled to class B, the specs for A are also coupled to class B through class A. Thus, I wouldn't worry about the coupling. Why does a method of class A directly access a constant of class B? Does the constant belong in class

Re: [rspec-users] How to spec accessing a constant

2008-10-15 Thread Scott Taylor
On Oct 15, 2008, at 4:31 PM, Nick Hoffman wrote: Hi guys. One of my methods uses a constant in another method, like this: class A def something "foo: #{B::BAR}" end end When writing the spec for A#something , how would you mock or stub #{B::BAR}, and how would you set an expe

Re: [rspec-users] How to spec accessing a constant

2008-10-15 Thread Craig Demyanovich
On Wed, Oct 15, 2008 at 8:47 PM, Nick Hoffman <[EMAIL PROTECTED]> wrote: > On 2008-10-15, at 16:39, Craig Demyanovich wrote: > >> Probably, I would just check the outcome of the method instead of checking >> interaction with a constant. >> >> Craig >> > > So you guys wouldn't worry about the spec

Re: [rspec-users] How to spec accessing a constant

2008-10-15 Thread Nick Hoffman
On 2008-10-15, at 16:39, Craig Demyanovich wrote: Probably, I would just check the outcome of the method instead of checking interaction with a constant. Craig So you guys wouldn't worry about the spec for class A being coupled to this constant in class B? -Nick __

Re: [rspec-users] How to spec accessing a constant

2008-10-15 Thread Zach Dennis
On Wed, Oct 15, 2008 at 4:39 PM, Craig Demyanovich <[EMAIL PROTECTED]> wrote: > Probably, I would just check the outcome of the method instead of checking > interaction with a constant. > What he said, -- Zach Dennis http://www.continuousthinking.com http://www.mutuallyhuman.com

Re: [rspec-users] How to spec accessing a constant

2008-10-15 Thread Craig Demyanovich
Probably, I would just check the outcome of the method instead of checking interaction with a constant. Craig ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users