[rspec-users] bypass_rescue and its inverse

2009-03-19 Thread Matt Patterson
Hey, I've just started using rspec-rails 1.2 and the bypass rescue declaration is wonderful - by default I tend to write controller which raise exceptions (in exceptional circumstances), along with before- filters as guard clauses, so being able to switch off rescue from (which I properly

Re: [rspec-users] Basic help

2009-03-19 Thread jazzez ravi
Zach Dennis wrote: > On Thu, Mar 19, 2009 at 5:28 AM, jazzez ravi > wrote: >> �before(:each) do >> class Bowling >> >> require 'spec' --> �No Error But also no output mentioned as per that >> website. >> >> Please anyone help to continue that program. > > Try to put this at the top: > > require

Re: [rspec-users] RSpec style and truthiness

2009-03-19 Thread David Chelimsky
On Thu, Mar 19, 2009 at 10:20 PM, Stephen Eley wrote: > 2009/3/19 Rick DeNatale : >> Even 'should be' is a bit grating.  I'm tempted to write a pair of matchers >> like be_truthy and be_falsy, but I was wondering what other RSpec users have >> to say. > what_follows.should be_brilliant > should

Re: [rspec-users] Basic help

2009-03-19 Thread jazzez ravi
David Chelimsky wrote: > On Thu, Mar 19, 2009 at 4:28 AM, jazzez ravi > wrote: >> �before(:each) do >> class Bowling >> >>>ruby bowling_spec.rb --format specdoc > > Use the spec command (that's what's there on http://rspec.info): > > spec bowling_spec.rb --format specdoc > > Cheers, > David H

Re: [rspec-users] [cucumber] getting scenario name in hook

2009-03-19 Thread Nigel Thorne
Where in the scenario object is the name stored? Cheers. Nigel walketim wrote: > > That did the trick. Thanks Aslak! Took a little while to figure out > where it was in the Scenario object but it was pretty straight forward > from there. > > T > > On Wed, Mar 11, 2009 at 10:21 AM, aslak he

Re: [rspec-users] RSpec style and truthiness

2009-03-19 Thread Stephen Eley
2009/3/19 Rick DeNatale : > Even 'should be' is a bit grating.  I'm tempted to write a pair of matchers > like be_truthy and be_falsy, but I was wondering what other RSpec users have > to say. should be || should_not be: that is the expectation: Whether 'tis nobler in the parser to interpret The o

Re: [rspec-users] RSpec style and truthiness

2009-03-19 Thread Pat Maddox
I hate should/should_not be and so if I really *have* to do it then I just throw a !! in the method and get back a real boolean. Not ideal, but it works. HOWEVER Predicate matchers *do* accept args, and in the specific example you gave, the have matcher comes to the rescue. Check out these exam

Re: [rspec-users] RSpec style and truthiness

2009-03-19 Thread David Chelimsky
2009/3/19 Rick DeNatale : > I like to avoid over-constraining specifications, so for example of methods > which return 'boolean' values, I prefer to test either truthiness (anything > but false or nil), or falsiness (either false or nil). > This isn't an issue true predicate methods which are of th

[rspec-users] RSpec style and truthiness

2009-03-19 Thread Rick DeNatale
I like to avoid over-constraining specifications, so for example of methods which return 'boolean' values, I prefer to test either truthiness (anything but false or nil), or falsiness (either false or nil). This isn't an issue true predicate methods which are of the right form to use be_whatever (a

Re: [rspec-users] [Cucumber 0.2] Failure to use should

2009-03-19 Thread Yi
I thought be_something is actually handled by rspec class Be. be_blank essentially asks the object blank? predicate. Not that there is a "be_blank" method declared anywhere. Anyway, require 'spec/expectations' doesn't solve the problem. I will look into this. Thanks Yi On Thu, Mar 19, 2009 at 10

Re: [rspec-users] ANN Cucumber 0.2.0

2009-03-19 Thread Ashley Moran
On 18 Mar 2009, at 19:16, aslak hellesoy wrote: I'm happy to announce the release of Cucumber 0.2.0. Thanks! I just can't exaggerate how much of a difference Cucumber (and RSpec) makes to me. -- http://www.patchspace.co.uk/ http://www.linkedin.com/in/ashleymoran http://aviewfromafar.net

Re: [rspec-users] [Cucumber] Feature vs. Scenario

2009-03-19 Thread Andrew Premdas
I think writing features is a new art form and as such we just don't know answers to questions like this yet. After a while we might be able to move towards a consensus given certain criteria, and people might be able to come up with rules of thumb that help (i.e. if its got more than 7 scenarios c

Re: [rspec-users] [Cucumber] Feature vs. Scenario

2009-03-19 Thread Mark Wilden
On Thu, Mar 19, 2009 at 9:44 AM, Lenny Marks wrote: > These scenarios are each distinct things so to me are 'features' in a way > but they may also be trivial to implement, so using any kind of  'a feature > should generally take n days/weeks to implement' guideline would make that > smell. I do

Re: [rspec-users] ANN Cucumber 0.2.0

2009-03-19 Thread Emmanuel Pinault
On Mar 19, 2009, at 9:59 AM, aslak hellesoy wrote Thanks ! I started to digg last night into it. Saw one thing wrong in the HTML reported where the Span gets escaped ;) Yep I have noticed that too - would be great if you could figure out how to not have it escaped! Not sure it is the be

Re: [rspec-users] ANN Cucumber 0.2.0

2009-03-19 Thread Emmanuel Pinault
On Mar 19, 2009, at 9:59 AM, aslak hellesoy wrote: Thanks ! I started to digg last night into it. Saw one thing wrong in the HTML reported where the Span gets escaped ;) Yep I have noticed that too - would be great if you could figure out how to not have it escaped! Working on it and

[rspec-users] [Cucumber] Feature vs. Scenario

2009-03-19 Thread Lenny Marks
I'm curious what other people's thoughts are about when to use Features vs. Scenarios and how much it matters. I'm getting the sense that the line is a thin one, and has more to do with complexity/time to develop than anything else. I had originally enforced a fairly rigid definition of 'Sc

Re: [rspec-users] Mocking base class methods

2009-03-19 Thread Jeroen van Dijk
Hi all, I'm having the same problem as Tobi and I wanted to try Tobi mock solution but unfortunately it does not work for me. Here is a trivial example I want to test: module ActiveRecord class Base def self.count_by_params(params = {}, options = {}) scoped_by_params(params).co

Re: [rspec-users] ANN Cucumber 0.2.0

2009-03-19 Thread aslak hellesoy
2009/3/19 Emmanuel Pinault > > On Mar 18, 2009, at 11:22 PM, aslak hellesoy wrote: > > > > On Wed, Mar 18, 2009 at 4:08 PM, Emmanuel Pinault wrote: > >> Great! Is there section for the new hook on reporting? I used the old >> reporting to customized some of our HTML reports and wonder if you hav

Re: [rspec-users] ANN Cucumber 0.2.0

2009-03-19 Thread Emmanuel Pinault
On Mar 18, 2009, at 11:22 PM, aslak hellesoy wrote: On Wed, Mar 18, 2009 at 4:08 PM, Emmanuel Pinault wrote: Great! Is there section for the new hook on reporting? I used the old reporting to customized some of our HTML reports and wonder if you have the new hooks documented somewhere

[rspec-users] [ANN] celerity 0.0.6 Released

2009-03-19 Thread jari.bakken
celerity version 0.0.6 has been released! * http://github.com/jarib/celerity/tree * http://celerity.rubyforge.org Celerity is a JRuby wrapper around HtmlUnit - a headless Java browser with JavaScript support. It provides a simple API for programmatic navigation through web applications. Celerit

Re: [rspec-users] [rspec] Stubbing partials in view specs / Test Spy

2009-03-19 Thread Scott Taylor
On Mar 19, 2009, at 10:30 AM, David Chelimsky wrote: On Mar 19, 2009, at 7:59 AM, Evgeny Bogdanov > wrote: just upgraded to 1.2.0 the following code works now: template.stub!(:render).with(hash_including(:partial => "children/ child")) template.should_receive(:render).with(hash_including

Re: [rspec-users] [Cucumber 0.2] Failure to use should

2009-03-19 Thread Pat Maddox
Right, you need to add require 'spec/expectations' because Cucumber doesn't know about RSpec's matchers by default. Pat 2009/3/19 Yi : > This is my env.rb > > # Sets up the Rails environment for Cucumber > ENV["RAILS_ENV"] ||= "test" > require File.expand_path(File.dirname(__FILE__) + > '/../../

Re: [rspec-users] [Cucumber 0.2] Failure to use should

2009-03-19 Thread Yi
This is my env.rb # Sets up the Rails environment for Cucumber ENV["RAILS_ENV"] ||= "test" require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') require 'cucumber/rails/world' require 'cucumber/formatters/unicode' # Comment out this line if you don't want Cucumber Unicode

Re: [rspec-users] [Cucumber 0.2] Failure to use should

2009-03-19 Thread aslak hellesoy
2009/3/19 Yi > I have a step definition like this: > > Then "the account should be created" do > account = Account.find_by_name("my shiny new account") > p account.class > account.should_not be_blank > end > > When running this step, I got the error message: > > Account(id: integer, name: s

Re: [rspec-users] [rspec] Stubbing partials in view specs

2009-03-19 Thread Nick Hoffman
> Basically, there are two situation. > 1) I want to check if a function was called and I want to execute the > function code I don't think that's possible. Setting a method expectation (Eg: template.should_receive(:render)) automatically stubs #render. > 2) I want to check if a function was call

Re: [rspec-users] [rspec] Stubbing partials in view specs

2009-03-19 Thread David Chelimsky
On Mar 19, 2009, at 7:59 AM, Evgeny Bogdanov wrote: just upgraded to 1.2.0 the following code works now: template.stub!(:render).with(hash_including(:partial => "children/ child")) template.should_receive(:render).with(hash_including(:partial => "children/child")) The only question th

[rspec-users] [Cucumber 0.2] Failure to use should

2009-03-19 Thread Yi
I have a step definition like this: Then "the account should be created" do account = Account.find_by_name("my shiny new account") p account.class account.should_not be_blank end When running this step, I got the error message: Account(id: integer, name: string, state: string, next_renewal

Re: [rspec-users] [rspec] Stubbing partials in view specs

2009-03-19 Thread Evgeny Bogdanov
just upgraded to 1.2.0 the following code works now: template.stub!(:render).with(hash_including(:partial => "children/ child")) template.should_receive(:render).with(hash_including(:partial => "children/child")) The only question that is left for me is about Nick's words: "If you set a m

Re: [rspec-users] Basic help

2009-03-19 Thread Zach Dennis
On Thu, Mar 19, 2009 at 5:28 AM, jazzez ravi wrote: > Hi All, > > 1. Just now I installed rspec1.2.0 and dependencies > > 2. Tried the 2 programs mentioned in http://rspec.info/. > > # bowling_spec.rb > require 'bowling' > > describe Bowling do >  before(:each) do >   �...@bowling = Bowling.new >

Re: [rspec-users] what's the meaning of to_param?

2009-03-19 Thread Zach Dennis
On Thu, Mar 19, 2009 at 9:15 AM, Zach Dennis wrote: > On Thu, Mar 19, 2009 at 8:46 AM, Zhenning Guan wrote: >> usually, I just use this way. >> >> = >> @weather = mock_model(Weather) >> = >> >> but recently I saw this. so what's the :to_param and :save options >> meaning? >> >> == >>

Re: [rspec-users] what's the meaning of to_param?

2009-03-19 Thread Zach Dennis
On Thu, Mar 19, 2009 at 8:46 AM, Zhenning Guan wrote: > usually, I just use this way. > > = > @weather = mock_model(Weather) > = > > but recently I saw this. so what's the :to_param and :save options > meaning? > > == > @weather = mock_model(Weather, :to_param => "1", :save => true) >

[rspec-users] what's the meaning of to_param?

2009-03-19 Thread Zhenning Guan
usually, I just use this way. = @weather = mock_model(Weather) = but recently I saw this. so what's the :to_param and :save options meaning? == @weather = mock_model(Weather, :to_param => "1", :save => true) == -- Posted via http://www.ruby-forum.com/. __

Re: [rspec-users] Basic help

2009-03-19 Thread David Chelimsky
On Thu, Mar 19, 2009 at 4:28 AM, jazzez ravi wrote: > Hi All, > > 1. Just now I installed rspec1.2.0 and dependencies > > 2. Tried the 2 programs mentioned in http://rspec.info/. > > # bowling_spec.rb > require 'bowling' > > describe Bowling do >  before(:each) do >   �...@bowling = Bowling.new >

[rspec-users] Basic help

2009-03-19 Thread jazzez ravi
Hi All, 1. Just now I installed rspec1.2.0 and dependencies 2. Tried the 2 programs mentioned in http://rspec.info/. # bowling_spec.rb require 'bowling' describe Bowling do before(:each) do @bowling = Bowling.new end it "should score 0 for gutter game" do 20.times { @bowling.hit(

Re: [rspec-users] ANN Cucumber 0.2.0

2009-03-19 Thread aslak hellesoy
On Wed, Mar 18, 2009 at 4:08 PM, Emmanuel Pinault wrote: > Great! Is there section for the new hook on reporting? I used the old > reporting to customized some of our HTML reports and wonder if you have the > new hooks documented somewhere? > The public API for formatters is all the methods in