Re: [rspec-users] DRYing up stories

2008-01-24 Thread Neil M. Young
some interesting viewpoints so far. How do people feel about something like this: Given every type of user When they visit account/manage Then only Admins and Managers should get access Given("every type of user") do @users = { :admin => new_admin, :manager => new_manager, :super

Re: [rspec-users] Changing rspec directory structure

2008-01-24 Thread Pat Maddox
On Jan 23, 2008 12:12 AM, Will Sargent <[EMAIL PROTECTED]> wrote: > Basically the Jay Fields style of testing -- I want the unit tests to > be run all the time on a continuous integration server, but the > integration/functional and system tests to be run only once a night. I would suggest letting

Re: [rspec-users] sharing specs in a subclass

2008-01-24 Thread Pat Maddox
On Jan 22, 2008 10:26 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Jan 23, 2008 12:04 AM, Scott Taylor <[EMAIL PROTECTED]> wrote: > > > > On Jan 23, 2008, at 12:02 AM, David Chelimsky wrote: > > > > > On Jan 22, 2008 10:49 PM, Jonathan Linowes > > > <[EMAIL PROTECTED]> wrote: > > >> Hi > > >

Re: [rspec-users] DRYing up stories

2008-01-24 Thread Kamal Fariz
> With 1.1.1 you can do this: > > Given "$n_users in the system" do |num_users| > case num_users > when "a user" ># one user case > when /(\d*) users/ ># multi user case using $1 > end > end > > With 1.1.2 you can do this: > > Given /(a|\d*) users? in the system/ do |num_users| > num_u

[rspec-users] Meridian case

2008-01-24 Thread Keith McDonnell
Hi there, I have a *really* weird issue with rspec on rails: Given a time meridian formatted using %p When I run `rake spec` the time meridian is converted to lower case: expected: "Today 08:00 PM", got: "Today 08:00 pm" Yet when I run `rake spec:models` and `spec -cfs app/models` the sp

Re: [rspec-users] DRYing up stories

2008-01-24 Thread David Chelimsky
On Jan 24, 2008 2:25 AM, Neil M. Young <[EMAIL PROTECTED]> wrote: > > some interesting viewpoints so far. How do people feel about something like > this: > > Given every type of user > When they visit account/manage > Then only Admins and Managers should get access > > Given("every type of user") d

Re: [rspec-users] DRYing up stories

2008-01-24 Thread David Chelimsky
On Jan 24, 2008 3:47 AM, Kamal Fariz <[EMAIL PROTECTED]> wrote: > > With 1.1.1 you can do this: > > > > Given "$n_users in the system" do |num_users| > > case num_users > > when "a user" > ># one user case > > when /(\d*) users/ > ># multi user case using $1 > > end > > end > > > > With

Re: [rspec-users] Meridian case

2008-01-24 Thread David Chelimsky
On Jan 24, 2008 5:40 AM, Keith McDonnell <[EMAIL PROTECTED]> wrote: > Hi there, > > I have a *really* weird issue with rspec on rails: > > Given a time meridian formatted using %p > > When I run `rake spec` the time meridian is converted to lower case: > > expected: "Today 08:00 PM", > got: "

[rspec-users] Constant definition matcher

2008-01-24 Thread Nicolas Jacobeus
Hello all, I need to specify that a class should define a constant. I couldn't find something such as "should define_const('MY_CONST')" in the RSpec documentation, even though there are similar matchers such as "should respond_to". I know I can write the matcher myself (that wouldn't be so d

Re: [rspec-users] Constant definition matcher

2008-01-24 Thread David Chelimsky
On Jan 24, 2008 8:56 AM, Nicolas Jacobeus <[EMAIL PROTECTED]> wrote: > Hello all, > > I need to specify that a class should define a constant. > > I couldn't find something such as "should define_const('MY_CONST')" in > the RSpec documentation, even though there are similar matchers such > as "shou

Re: [rspec-users] sharing specs in a subclass

2008-01-24 Thread Scott Taylor
On Jan 24, 2008, at 4:36 AM, Pat Maddox wrote: > > On Jan 22, 2008 10:26 PM, David Chelimsky <[EMAIL PROTECTED]> > wrote: >> On Jan 23, 2008 12:04 AM, Scott Taylor >> <[EMAIL PROTECTED]> wrote: >>> >>> On Jan 23, 2008, at 12:02 AM, David Chelimsky wrote: >>> On Jan 22, 2008 10:49 PM, Jona

Re: [rspec-users] DRYing up stories

2008-01-24 Thread Ben Mabey
I actually really like this idea. Very neat. Like David said the only problem might be being able to see where the failure occurred. I think that this problem could be solved or at least mitigated with some sort of custom matcher though (maybe even a simple one.) This solves the baseline cas

[rspec-users] Help to spec a rails helper method that uses content_for

2008-01-24 Thread Ben Aldred
Hi guys, I am a Rspec newbie and am having problems creating a spec for a RoR helper method. I have in fact already implemented the helper method and am trying to create retrospective specs. I know its the wrong way to do it but I am still learning Rspec. In my view I have a call to a helper met

[rspec-users] Meridian case

2008-01-24 Thread Keith McDonnell
Hi, Here's the spec: 'absolute_time_in_words should say 'Today 08:00 PM'' FAILED expected: "Today 08:00 PM", got: "Today 08:00 pm" (using ==) absolute_time_in_words(Time.now.utc.change({ :hour => 20, :minute => 0, :second => 0 }), TZInfo::Timezone.get('Europe/Dubl

[rspec-users] re -raise exceptions in stories?

2008-01-24 Thread Neil M. Young
I see that rails handles exceptions in stories by rendering public/500.html, whereas in controller specs exceptions are re-raised. Is it possible to have this same behaviour in stories so I can check the correct exceptions are being raised? -- View this message in context: http://www.nabble.com/

Re: [rspec-users] re -raise exceptions in stories?

2008-01-24 Thread Ben Mabey
Neil M. Young wrote: > I see that rails handles exceptions in stories by rendering public/500.html, > whereas in controller specs exceptions are re-raised. Is it possible to have > this same behaviour in stories so I can check the correct exceptions are > being raised? > I do this by putting the

Re: [rspec-users] Not seeing the failure

2008-01-24 Thread Pat Maddox
No, the mock is set up to return nil when user= is called. Then he writes an example to actually expect the call to user=. Pat On Jan 23, 2008 8:02 AM, Corey Haines <[EMAIL PROTECTED]> wrote: > I get the unexpected message :user= failure. > > When you set up the mock with the initial parameters,