Re: [rspec-users] RSpec and Watir, easy script structure question

2010-03-02 Thread Adam Reed
Thanks David. I have the basic format working in other scripts, so that's a good sign. Another user pointed me to this example, which is why I was exploring a different format: > ["Los Angeles", "Austin"].each do |location| > it "should show #{location}" do > @browser.div(:id, /exampl

Re: [rspec-users] RSpec and Watir, easy script structure question

2010-03-02 Thread David Chelimsky
On Tue, Mar 2, 2010 at 11:24 AM, Adam R wrote: > > Howdy!  I'm relatively new to RSpec, but I've worked with Watir and Ruby for > about 5 years now.  My company is redesigning a web app from the ground up, > so I'm taking the opportunity to leverage RSpec instead of Test/Unit. > > I've run into a

Re: [rspec-users] Integration testing without cucumber

2010-03-02 Thread David Chelimsky
On Tue, Mar 2, 2010 at 11:53 AM, drewB wrote: > Looks like I spoke too soon.  I made a mistake when testing your > suggest.  When I add that I still get the same failure. I just did the following using rails 2.3.5, rspec 1.3.2 and rspec-rails 1.3.0: $ rails foo $ cd foo $ script/generate rspec $

Re: [rspec-users] requiring "test_notifier/rspec" in spec,opts

2010-03-02 Thread drewB
If I add to spec.opts '--require test_notifier/rspec' (quotes are removed) it is finding it but I am encountering the same error as if I didn't require the file early enough in spec_helper: /usr/local/lib/site_ruby/1.8/rubygems.rb:270:in `activate': You have a nil object when you didn't expect it!

Re: [rspec-users] RSpec framework question

2010-03-02 Thread Matt Wynne
On 2 Mar 2010, at 21:05, Adam R wrote: An update for this issue. This script works, but only if I explicitly define the array that I'm iterating over (][countryname, url]].each do, rather than @countries.each do). Can someone help me understand why my array here (@countries) is not reco

Re: [rspec-users] requiring "test_notifier/rspec" in spec,opts

2010-03-02 Thread drewB
I may not have been clear. When I said if I add it to the top of my spec.opts file, I meant adding, '--require "test_notifier/rspec"'. Nevertheless, I tried you suggestion (a very good one). Unfortunately, it seems that it must be required before "require File.expand_path(File.join(File.dirname(_

Re: [rspec-users] RSpec framework question

2010-03-02 Thread Adam R
An update for this issue. This script works, but only if I explicitly define the array that I'm iterating over (][countryname, url]].each do, rather than @countries.each do). Can someone help me understand why my array here (@countries) is not recognized? I tried to instantiate it as a global v

Re: [rspec-users] stub and should_receive

2010-03-02 Thread Phillip Koebbe
Nevermind. If I would have waited five more minutes before clicking "Send", I would have seen my error. Blech. Phillip Koebbe wrote: What is the expected behavior when a model has both stub and should_receive defined for the same method? I have a helper method which creates an admin "logged

[rspec-users] stub and should_receive

2010-03-02 Thread Phillip Koebbe
What is the expected behavior when a model has both stub and should_receive defined for the same method? I have a helper method which creates an admin "logged in": def stub_user(is_administrator) user = stub_model(User) user.stub(:is_administrator).and_return(is_administrator) User.

Re: [rspec-users] requiring "test_notifier/rspec" in spec,opts

2010-03-02 Thread David Chelimsky
On Tue, Mar 2, 2010 at 1:22 PM, drewB wrote: > There is a nice little gem that gives you desktop notifications of > your spec commands called test_noitifer (http://github.com/fnando/ > test_notifier).  I can get it to work by including require > "test_notifier/rspec" toward the top of my spec_help

[rspec-users] requiring "test_notifier/rspec" in spec,opts

2010-03-02 Thread drewB
There is a nice little gem that gives you desktop notifications of your spec commands called test_noitifer (http://github.com/fnando/ test_notifier). I can get it to work by including require "test_notifier/rspec" toward the top of my spec_helper, or by manually including it in the command line li

[rspec-users] RSpec and Watir, easy script structure question

2010-03-02 Thread Adam R
Howdy! I'm relatively new to RSpec, but I've worked with Watir and Ruby for about 5 years now. My company is redesigning a web app from the ground up, so I'm taking the opportunity to leverage RSpec instead of Test/Unit. I've run into a problem with RSpec organization that I just can't sort out

Re: [rspec-users] Integration testing without cucumber

2010-03-02 Thread drewB
Looks like I spoke too soon. I made a mistake when testing your suggest. When I add that I still get the same failure. On Mar 1, 4:06 pm, drewB wrote: > That fixed it! Thanks! > > Any idea why that was needed for integration specs and not MVCs? > > On Mar 1, 3:04 pm, David Chelimsky wrote: > >

Re: [rspec-users] RSpec-2 and The RSpec Book

2010-03-02 Thread David Chelimsky
On Tue, Mar 2, 2010 at 9:51 AM, Rick DeNatale wrote: > On Tue, Mar 2, 2010 at 9:51 AM, David Chelimsky wrote: >> Hey all, >> >> I'm happy to announce that The RSpec Book will be updated for RSpec-2 >> and Rails-3 before its final release. This, of course, means that the >> print schedule will get

Re: [rspec-users] RSpec-2 and The RSpec Book

2010-03-02 Thread Rick DeNatale
On Tue, Mar 2, 2010 at 9:51 AM, David Chelimsky wrote: > Hey all, > > I'm happy to announce that The RSpec Book will be updated for RSpec-2 > and Rails-3 before its final release. This, of course, means that the > print schedule will get pushed back, but we'll have a couple of more > beta releases

Re: [rspec-users] RSpec-2 and The RSpec Book

2010-03-02 Thread Tom Stuart
On 2 Mar 2010, at 14:51, David Chelimsky wrote: > I'm happy to announce that The RSpec Book will be updated for RSpec-2 > and Rails-3 before its final release. Wow, this is great news. Thanks, David! I'm sure it'll be well worth the wait; having the beta book available in the meantime gives RSpec

[rspec-users] RSpec-2 and The RSpec Book

2010-03-02 Thread David Chelimsky
Hey all, I'm happy to announce that The RSpec Book will be updated for RSpec-2 and Rails-3 before its final release. This, of course, means that the print schedule will get pushed back, but we'll have a couple of more beta releases of the book before we go to print. I don't know the exact schedule

Re: [rspec-users] Configuring RSpec 2

2010-03-02 Thread David Chelimsky
On Tue, Mar 2, 2010 at 7:42 AM, Kristian Mandrup wrote: > # spec_helper.rb > > $LOAD_PATH.unshift(File.dirname(__FILE__)) > $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) > require '... > require 'rspec' > require 'rspec/autorun' > > # doesn't work: just remove it and it works.

[rspec-users] Configuring RSpec 2

2010-03-02 Thread Kristian Mandrup
# spec_helper.rb $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require '... require 'rspec' require 'rspec/autorun' # doesn't work: just remove it and it works. # But how would you configure the RSpec Runner in RSpec 2 then? Rspec::R

Re: [rspec-users] how to mock a Net::Http object?

2010-03-02 Thread aslak hellesoy
On Tue, Mar 2, 2010 at 9:39 AM, Zhenning Guan wrote: > one_data = Net::HTTP.post_form(URI.parse(country_site), {'country' => > "american"}) > two_data = Net::HTTP.post_form(URI.parse(visit_site), {'country' => > "english"}) > > I have a code similar like above code in my application, so how to mo

[rspec-users] how to mock a Net::Http object?

2010-03-02 Thread Zhenning Guan
one_data = Net::HTTP.post_form(URI.parse(country_site), {'country' => "american"}) two_data = Net::HTTP.post_form(URI.parse(visit_site), {'country' => "english"}) I have a code similar like above code in my application, so how to mock a a object like above? if only post_from once, I just need to s