Re: [rspec-users] Can someone clarify this RSpec block?

2012-02-24 Thread Matthew Van Horn
Each "it" runs in isolation. The flow is, all the "before" blocks run in order from outer to inner, before each "it" block. You can think of each "it" expectation as sending you to the start, to test another isolated expectation about the process. This is good, because a failure in one part of t

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] Mocking/Stubbing behavior question

2011-04-27 Thread Matthew Van Horn
On Apr 27, 2011, at 6:40 AM, David Chelimsky wrote: > > On Apr 26, 2011, at 5:39 PM, Matthew Van Horn wrote: > >> >> On Apr 26, 2011, at 4:02 PM, Rodrigo Rosenfeld Rosas wrote: >> >>> Ok, now I understand what is your issue. >>> >>

Re: [rspec-users] Mocking/Stubbing behavior question

2011-04-26 Thread Matthew Van Horn
On Apr 26, 2011, at 4:02 PM, Rodrigo Rosenfeld Rosas wrote: > Ok, now I understand what is your issue. > class Foo end class Bar def self.my_foo @my_foo ||= Foo.new end def self.perform my_foo.do_something end end

Re: [rspec-users] Mocking/Stubbing behavior question

2011-04-26 Thread Matthew Van Horn
On Apr 25, 2011, at 11:30 PM, Rodrigo Rosenfeld Rosas wrote: > Em 25-04-2011 14:58, Matthew Van Horn escreveu: >> >> >> On Apr 25, 2011, at 1:36 PM, Matthew Van Horn wrote: >> >>> I've run into some strange behavior in porting my specs from rspec t

Re: [rspec-users] Mocking/Stubbing behavior question

2011-04-25 Thread Matthew Van Horn
On Apr 25, 2011, at 1:36 PM, Matthew Van Horn wrote: > I've run into some strange behavior in porting my specs from rspec to rspec2. > I am wondering if I am doing something wrong, or if I've misunderstood > something, or if this is some kind of bug. > > Look at

[rspec-users] Mocking/Stubbing behavior question

2011-04-25 Thread Matthew Van Horn
I've run into some strange behavior in porting my specs from rspec to rspec2. I am wondering if I am doing something wrong, or if I've misunderstood something, or if this is some kind of bug. Look at the specs below: a Both examples will pass if run singly. The second one will fail if I run both

Re: [rspec-users] Trying to fix NullDB for Rails3/RSpec2.5.1

2011-04-23 Thread Matthew Van Horn
On Apr 23, 2011, at 11:45 AM, David Chelimsky wrote: > On Apr 23, 2011, at 10:26 AM, Matthew Van Horn wrote: > >> On Apr 23, 2011, at 10:40 AM, Matthew Van Horn wrote: >> >>> def self.nullify_contextually?(other) >>> rspec_root = defined?(RSpe

Re: [rspec-users] Trying to fix NullDB for Rails3/RSpec2.5.1

2011-04-23 Thread Matthew Van Horn
On Apr 23, 2011, at 10:40 AM, Matthew Van Horn wrote: > def self.nullify_contextually?(other) > rspec_root = defined?(RSpec) ? RSpec : Spec > if defined? rspec_root::Rails::RailsExampleGroup > other.ancestors.include?(rspec_root::Rails::RailsExampleGroup

[rspec-users] Trying to fix NullDB for Rails3/RSpec2.5.1

2011-04-23 Thread Matthew Van Horn
I'm in the midst of upgrading an app from Rails 2.3 to Rails 3, and as part of the process, from RSpec to RSpec2. One thing that seems to have broken for me is the use of NullDB to nullify the database contextually for a single spec. I think I've narrowed it down to this method in NullDB which a

Re: [rspec-users] "contain" not defined in view spec

2010-10-19 Thread Matthew Van Horn
I also ran into this today. Not sure where the "contain" matcher is, looked in rspec-rails and rspec-expectations, but came up empty. (Rails 3.0.0 / Rspec 2.0.0) -- matt On Oct 18, 2010, at 5:53 PM, Stephen Veit wrote: On Oct 18, 3:41 pm, David Chelimsky wrote: On Oct 18, 2010, at 3:27 PM,

Re: [rspec-users] testing against a live environment

2010-04-28 Thread Matthew Van Horn
I've been using rspec with webrat, for exactly this sort of thing, as detailed here: http://blog.veez.us/2009/09/11/integration-testing-without-cucumber On Apr 27, 2010, at 5:36 AM, Martin DeMello wrote: I have a series of tests I want to automate, which involve running shell scripts in a "l

[rspec-users] rspec and resque - tips?

2010-04-01 Thread Matthew Van Horn
I've just gotten started refactoring my app to use Resque/Redis to do things like email and order capture asynchronously. I'm wondering if anyone has any tips on how to test my job classes, and how to run integration tests for this kind of thing. BTW - we're a very small group, and the tests

Re: [rspec-users] Cucumber rake/webrat issue.

2009-05-19 Thread Matthew Van Horn
On May 18, 2009, at 3:08 PM, Ben Mabey wrote: Matthew Van Horn wrote: I'm probably missing something really obvious, but I just upgraded cucumber, rspec/rails, and webrat on a project, and for some reason, cucumber is not seeing any of the webrat steps (or bmabey's email s

Re: [rspec-users] Cucumber rake/webrat issue.

2009-05-18 Thread Matthew Van Horn
On May 18, 2009, at 2:49 PM, Matthew Van Horn wrote: I'm probably missing something really obvious, but I just upgraded cucumber, rspec/rails, and webrat on a project, and for some reason, cucumber is not seeing any of the webrat steps (or bmabey's email steps) when running from

[rspec-users] Cucumber rake/webrat issue.

2009-05-18 Thread Matthew Van Horn
I'm probably missing something really obvious, but I just upgraded cucumber, rspec/rails, and webrat on a project, and for some reason, cucumber is not seeing any of the webrat steps (or bmabey's email steps) when running from rake. It seems ok when running using the cucumber binary. The

[rspec-users] cucumber segfaults

2009-05-06 Thread Matthew Van Horn
Just started getting this, every time I run rake features: myapp/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/ rack/lint.rb:16: [BUG] Segmentation fault ruby 1.8.6 (2008-03-03) [i686-darwin9.2.2] after updating from cucumber 0.3.0 to 0.3.2 I'm now getting the segfault here:

Re: [rspec-users] cucumber - when to stub/mock

2009-05-05 Thread Matthew Van Horn
plementation or the Geolp one. Pat On Sunday, May 3, 2009, Matthew Van Horn wrote: I'm just curious about this, since my solution involved stubbing a call to GeoIp. Is there a good rule of thumb for when you make exceptions to the 'no stubbing' philosophy of Cucumber? My s

Re: [rspec-users] cucumber - when to stub/mock

2009-05-04 Thread Matthew Van Horn
I followed Bryan's pattern here, and let RSpec reset everything. http://www.brynary.com/2009/2/3/cucumber-step-definition-tip-stubbing-time On May 4, 2009, at 3:13 AM, aslak hellesoy wrote: One thing to be aware of when stubbing: There is no cleanup/revert logic yet in Cucumber. This means

Re: [rspec-users] [cucumber] Assertions about current location in Then steps

2009-05-03 Thread Matthew Van Horn
I have this in my webrat_steps.rb already: Then /^I should be on (.+)$/ do |page_name| URI.parse(current_url).path.should == path_to(page_name) end (I think it came that way) -- Matt On May 3, 2009, at 8:37 PM, Mark Wilden wrote: On Sun, May 3, 2009 at 11:28 AM, Tim Fischbach wrote: is

[rspec-users] cucumber - when to stub/mock

2009-05-03 Thread Matthew Van Horn
I'm just curious about this, since my solution involved stubbing a call to GeoIp. Is there a good rule of thumb for when you make exceptions to the 'no stubbing' philosophy of Cucumber? My step was: "Given I am accessing the site from Japan," but I can think of other situations - mostly w