Re: [rspec-users] changes in rspec 2.4 break ci_reporter

2011-01-27 Thread David Chelimsky
On Jan 26, 2011, at 8:43 AM, vishnu wrote: > Hi > I use the ci_reporter gem for builds on my CI machine (hudson). > Prior to rspec 2.4, environment options would override commandline > options. So the gem used this to change the formatter and require its > files. > > In 2.4, that order has bee

[rspec-users] feedback on matcher

2011-01-27 Thread Michael Guterl
We have moved from Rails 2 to 3 and the changing Mailer syntax has caused us to rewrite some of our specs. In Rails 2: Implementation: Mailer.deliver_job_application(job.id, user.id) Spec: Mailer.should_receive(:deliver_job_application).with(@job.id, @user.id) --- In Rails 3: Implementati

Re: [rspec-users] feedback on matcher

2011-01-27 Thread David Chelimsky
On Jan 27, 2011, at 7:48 AM, Michael Guterl wrote: > We have moved from Rails 2 to 3 and the changing Mailer syntax has > caused us to rewrite some of our specs. > > In Rails 2: > > Implementation: > Mailer.deliver_job_application(job.id, user.id) > > Spec: > Mailer.should_receive(:deliver_j

Re: [rspec-users] feedback on matcher

2011-01-27 Thread Michael Guterl
On Thu, Jan 27, 2011 at 10:30 AM, David Chelimsky wrote: > > On Jan 27, 2011, at 7:48 AM, Michael Guterl wrote: > >> We have moved from Rails 2 to 3 and the changing Mailer syntax has >> caused us to rewrite some of our specs. >> >> In Rails 2: >> >> Implementation: >>  Mailer.deliver_job_applicat

Re: [rspec-users] feedback on matcher

2011-01-27 Thread Michael Guterl
On Thu, Jan 27, 2011 at 10:30 AM, David Chelimsky wrote: > > On Jan 27, 2011, at 7:48 AM, Michael Guterl wrote: > >> We have moved from Rails 2 to 3 and the changing Mailer syntax has >> caused us to rewrite some of our specs. >> >> In Rails 2: >> >> Implementation: >>  Mailer.deliver_job_applicat

Re: [rspec-users] feedback on matcher

2011-01-27 Thread Michael Guterl
On Thu, Jan 27, 2011 at 2:05 PM, Michael Guterl wrote: > On Thu, Jan 27, 2011 at 10:30 AM, David Chelimsky > wrote: >> >> On Jan 27, 2011, at 7:48 AM, Michael Guterl wrote: >> >>> We have moved from Rails 2 to 3 and the changing Mailer syntax has >>> caused us to rewrite some of our specs. >>> >

Re: [rspec-users] Fixtures not loading when running full test suite

2011-01-27 Thread Doug Bryant
I'm currently running into the same issue and can find very little about it on the interwebs - i.e. an individual test run with `script/spec` works fine but the same test without any code changes fails when run as part of the suite via `rake spec` This issue seemed to start out of the blue. Some

[rspec-users] rspec-rails 2 adding current account helper to all view specs

2011-01-27 Thread Rob Westgeest
Hi, in rspec-1 view specs i had the ability to say: login_as(some_role_or_account) which made some helper methods like current_account that where used in views and controllers return something valuable. Implementation was based on the fact that the controller in rspec-1 was ApplicationC

[rspec-users] Relish documentation for RSpec

2011-01-27 Thread James Almond
I was looking at the Relish documentation for RSpec today and noticed there are a few missing bits. For example, the expectation raise_error can take a block which the raised error gets passed to. This is not documented in the Relish features. I'd love to contribute to the Relish documentation for

Re: [rspec-users] Relish documentation for RSpec

2011-01-27 Thread David Chelimsky
On Jan 27, 2011, at 4:34 PM, James Almond wrote: > I was looking at the Relish documentation for RSpec today and noticed there > are a few missing bits. For example, the expectation raise_error can take a > block which the raised error gets passed to. This is not documented in the > Relish feat

[rspec-users] Difference between :each and :all

2011-01-27 Thread Brian Warner
I'm having a hard time grasping the difference between :each and :all. If I have a bunch of stuff inside a "before :each" block. Everytime I try to run an example that block of code will be run before the example. Now if I had the same code inside a "before :all" block. Everytime an example is ru

Re: [rspec-users] Difference between :each and :all

2011-01-27 Thread John Feminella
Here's an illustrative example that should clear things up: require 'spec_helper' describe "behavior of before-each and before-all" do before(:all) { puts "-- running :all" } before(:each) { puts "-- running :each" } describe "addition" do it "should add two and two" do (2 + 2).s

Re: [rspec-users] Difference between :each and :all

2011-01-27 Thread John Feminella
That's not quite right. :each runs before _each_ spec, while :all runs once, before _any_ spec. -- John Feminella Principal Consultant, BitsBuilder LI: http://www.linkedin.com/in/fjsquared SO: http://stackoverflow.com/users/75170/ On Thu, Jan 27, 2011 at 17:56, Brian Warner wrote: > I'm having

Re: [rspec-users] Difference between :each and :all

2011-01-27 Thread David Chelimsky
On Jan 27, 2011, at 5:11 PM, John Feminella wrote: > That's not quite right. :each runs before _each_ spec, while :all runs > once, before _any_ spec. Perhaps :any is a better name? We could add it as an alternative for the same as :all. WDYT? > -- > John Feminella > Principal Consultant, BitsB

Re: [rspec-users] Difference between :each and :all

2011-01-27 Thread Brian Warner
That does clear it. Thank you =] -- 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] feedback on matcher

2011-01-27 Thread Mike Mazur
Hi, On Thu, Jan 27, 2011 at 21:48, Michael Guterl wrote: > RSpec::Matchers.define :deliver do |message| >  chain :with do |*args| >    @with = args >  end > >  match do |mailer| >    mail = double >    mail.should_receive(:deliver) > >    mailer.should_receive(message).with(*@with).and_return(mai

Re: [rspec-users] Difference between :each and :all

2011-01-27 Thread John Feminella
> Perhaps :any is a better name? We could add it as an alternative for the same > as :all. WDYT? I think that's an interesting idea, David. I whipped up a quick pull request, which you can see here: https://github.com/rspec/rspec-core/pull/293 ~ jf -- John Feminella Principal Consultant, BitsBu

Re: [rspec-users] Difference between :each and :all

2011-01-27 Thread Rick DeNatale
On Thu, Jan 27, 2011 at 6:16 PM, David Chelimsky wrote: > On Jan 27, 2011, at 5:11 PM, John Feminella wrote: > >> That's not quite right. :each runs before _each_ spec, while :all runs >> once, before _any_ spec. > > Perhaps :any is a better name? We could add it as an alternative for the same >

Re: [rspec-users] Performance tests using Rspec

2011-01-27 Thread Josep M. Bach
A while ago, I was looking at Minitest's benchmarking capabilities (contained in a single file here) and I thought it would be great to have an equivalent in RSpec. They have methods to assert type of performance (lin

Re: [rspec-users] specing nested models

2011-01-27 Thread Cezar Halmagean
That worked great, thank you.___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Difference between :each and :all

2011-01-27 Thread Jon Homan
My understanding is that the before :each block runs before every example. While before :all blocks run once for the entire example group. Any side effects in the examples will be persist for objects if you use a before :all block. But if you were to use before :each, you guarantee the state befor

Re: [rspec-users] specing nested models

2011-01-27 Thread Nick
How about: it 'builds a comment in the post' do post = Post.new comments_assoc = mock comment = mock_model Comment post.stub(:comments).and_return comments_assoc comments_assoc.should_receive(:build).with(no_args).and_return comment # invoke something to trigger the action end _

[rspec-users] checking order of method calls on different mocks

2011-01-27 Thread Fregas
I have a spec where I need to check that the order of 2 method calls to 2 different mocks is correct: mock_customer.should_receive(:save).ordered mock_customer.should_recieve(:id).and_return(1).ordered mock_order.should_receive(:customer_id=).with(1).ordered however this does not work. I can set

[rspec-users] specing nested models

2011-01-27 Thread Cezar Halmagean
So I am trying to spec a nested model / form like say Post has_many Comments and in order to build a nested form I need to build a new comment in @posts.comments like so: @post = Post.new @post.comments.build Now, my question is: How do you go about correctly testing this ? Thanks

Re: [rspec-users] specing nested models

2011-01-27 Thread Nick
On Wednesday, January 26, 2011 10:34:14 AM UTC-5, Cezar Halmagean wrote: > > That worked great, thank you. You're welcome, mate! ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Difference between :each and :all

2011-01-27 Thread David Chelimsky
On Thu, Jan 27, 2011 at 8:53 PM, Rick DeNatale wrote: > On Thu, Jan 27, 2011 at 6:16 PM, David Chelimsky wrote: >> On Jan 27, 2011, at 5:11 PM, John Feminella wrote: >> >>> That's not quite right. :each runs before _each_ spec, while :all runs >>> once, before _any_ spec. >> >> Perhaps :any is a

Re: [rspec-users] Performance tests using Rspec

2011-01-27 Thread David Chelimsky
On Jan 26, 2011, at 4:06 AM, Josep M. Bach wrote: > A while ago, I was looking at Minitest's benchmarking capabilities (contained > in a single file here) and I thought it would be great to have an equivalent > in RSpec. They have methods to assert type of performance (linear, > exponential...)

Re: [rspec-users] Difference between :each and :all

2011-01-27 Thread John Feminella
Not to shoot my own patch in the foot, but my personal opinion is to have only one way to do it. I think whatever ambiguity there may be in before(:all) isn't adequately compensated by the additional confusion of having before(:any), which sounds like it would do something subtly different. -- John

Re: [rspec-users] checking order of method calls on different mocks

2011-01-27 Thread David Chelimsky
On Jan 26, 2011, at 10:07 AM, Fregas wrote: > I have a spec where I need to check that the order of 2 method calls > to 2 different mocks is correct: > > mock_customer.should_receive(:save).ordered > mock_customer.should_recieve(:id).and_return(1).ordered Don't think it's related, but receive is

Re: [rspec-users] Difference between :each and :all

2011-01-27 Thread Wincent Colaiuta
El 28/01/2011, a las 03:53, Rick DeNatale escribió: > On Thu, Jan 27, 2011 at 6:16 PM, David Chelimsky wrote: >> On Jan 27, 2011, at 5:11 PM, John Feminella wrote: >> >>> That's not quite right. :each runs before _each_ spec, while :all runs >>> once, before _any_ spec. >> >> Perhaps :any is a

Re: [rspec-users] Fixtures not loading when running full test suite

2011-01-27 Thread David Chelimsky
On Thu, Jan 27, 2011 at 2:05 PM, Doug Bryant wrote: > I'm currently running into the same issue and can find very little about it > on the interwebs - i.e. an individual test run with `script/spec` works fine > but the same test without any code changes fails when run as part of the > suite via `r