[rspec-users] response.should be_success -- what does this prove?

2009-06-05 Thread doug livesey
Hi -- if my controller action already ensures that the correct template is being rendered, what use is speccing that it should also be successful? I do it, but just because I saw someone else do it ages ago. Is there a point? Cheers, Doug. ___ rspec-us

Re: [rspec-users] [rspec] How to pass route parameters to post method?

2009-06-05 Thread Evgeny Bogdanov
Hello Mike, Thank you for your hint. Obviously, it worked! Laughing at myself now: how post method was supposed to know what I mean by :viewtype if don't specify it :) Best, Evgeny On Jun 4, 10:14 pm, Mike Sassak wrote: > Hi Evgeny, > > You didn't include the error message in your email, so thi

Re: [rspec-users] response.should be_success -- what does this prove?

2009-06-05 Thread Matt Wynne
On 5 Jun 2009, at 13:36, doug livesey wrote: Hi -- if my controller action already ensures that the correct template is being rendered, what use is speccing that it should also be successful? I do it, but just because I saw someone else do it ages ago. Is there a point? It checks that the

[rspec-users] Example group parallel execution

2009-06-05 Thread Joe Ocampo
So I am working on a project right now where we are combining Selenium and RSpec. It was working really well until we implemented the grid and started to do parallel execution on the specs to help speed things up. We are rolling are own framework as DeepTest did not really provide the facilities w

Re: [rspec-users] Example group parallel execution

2009-06-05 Thread David Chelimsky
On Fri, Jun 5, 2009 at 9:44 AM, Joe Ocampo wrote: > So I am working on a project right now where we are combining Selenium and > RSpec.  It was working really well until we implemented the grid and started > to do parallel execution on the specs to help speed things up. We are > rolling are own fr

Re: [rspec-users] Example group parallel execution

2009-06-05 Thread Joe Ocampo
Thanks David! I will be sure to let you know our progress. Joe Ocampo agilejoe.lostechies.com On Fri, Jun 5, 2009 at 10:07 AM, David Chelimsky wrote: > On Fri, Jun 5, 2009 at 9:44 AM, Joe Ocampo wrote: > > So I am working on a project right now where we are combining Selenium > and > > RSpec.

[rspec-users] Driving Out A View - Layouts and Sessions?

2009-06-05 Thread Lee
I am driving out a view and I want to test that a link is displayed. The link_to code for the link is included in the layout for the view rather than the view template itself. Here's my example: it "should display a link to create a new zone" do render "contexts/index.html.erb", :layout =>

[rspec-users] Driving Out A View - Am I specifying too much?

2009-06-05 Thread Lee
I am driving out a view that renders a list of items with which a logged in member is associated. Against each item, one or more links may be rendered according to the member's role with respect to the item (item owner, item administrator, regular user etc). Each link represents a type of function

Re: [rspec-users] Driving Out A View - Am I specifying too much?

2009-06-05 Thread Stephen Eley
On Fri, Jun 5, 2009 at 11:54 AM, Lee wrote: > > When specifying the view, should I include examples to specify which > links should appear against an item for each potential role of a > member? Or is this going too far? It depends. If you're doing full BDD on your view, using RSpec as a design to

Re: [rspec-users] Driving Out A View - Layouts and Sessions?

2009-06-05 Thread Stephen Eley
On Fri, Jun 5, 2009 at 11:40 AM, Lee wrote: > > Firstly, my experiments suggest that the layout is only rendered if > the :layout attribute is included in the call to render. Is my > understanding correct? Yes, and it's the way things should be. I suggest writing a separate spec for the layout, a

Re: [rspec-users] Driving Out A View - Am I specifying too much?

2009-06-05 Thread Zach Dennis
On Fri, Jun 5, 2009 at 11:54 AM, Lee wrote: > I am driving out a view that renders a list of items with which a > logged in member is associated. > > Against each item, one or more links may be rendered according to the > member's role with respect to the item (item owner, item > administrator, reg

Re: [rspec-users] response.should be_success -- what does this prove?

2009-06-05 Thread Fernando Perez
> It's useful when you're doing TDD as it's the simplest thing to expect > a controller to do. If you break something it's also quite a nice > first-failure to have. Hmm, I'm not sure about that. If the view fails to render, then Rails returns the error page, i.e: response.should be_success is tot

Re: [rspec-users] Mocking find_by_sql

2009-06-05 Thread Fernando Perez
Damn I can't mock will_paginate's paginate method either!!! -- 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] Driving Out A View - Am I specifying too much?

2009-06-05 Thread Charlie Bowman
I never spec my views. I also never put conditional logic in the views. If you have links that should show up sometimes and not others why not just move that logic into a helper or other associated class and test the method? On Fri, Jun 5, 2009 at 10:04 AM, Zach Dennis wrote: > On Fri, Jun 5,

[rspec-users] Given/When/Then blocks on Cucumber

2009-06-05 Thread Maurício Linhares
Hello guys, I've been looking at Pyccuracy and found the "Given/Then/When" blocks to be very interesting and easier to understand and write, specially when writting scenarios with more than one of those. An example can be found here: http://www.pyccuracy.org/getting_started_3.html Here's how they

Re: [rspec-users] Given/When/Then blocks on Cucumber

2009-06-05 Thread Ben Mabey
Maurício Linhares wrote: Hello guys, I've been looking at Pyccuracy and found the "Given/Then/When" blocks to be very interesting and easier to understand and write, specially when writting scenarios with more than one of those. An example can be found here: http://www.pyccuracy.org/getting_star

[rspec-users] Mocking find_by_sql

2009-06-05 Thread Fernando Perez
Hi, I cannot manage to mock a call to find_by_sql. Which class is actually getting called? It is not the model, and I tried ActiveRecord which didn't work either. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforg

Re: [rspec-users] Given/When/Then blocks on Cucumber

2009-06-05 Thread Ben Mabey
Maurício Linhares wrote: Hello guys, I've been looking at Pyccuracy and found the "Given/Then/When" blocks to be very interesting and easier to understand and write, specially when writting scenarios with more than one of those. An example can be found here: http://www.pyccuracy.org/getting_star

Re: [rspec-users] Mocking find_by_sql

2009-06-05 Thread David Chelimsky
On Fri, Jun 5, 2009 at 3:33 PM, Fernando Perez wrote: > Damn I can't mock will_paginate's paginate method either!!! Same deal as your other post about find_by_sql. Set the message expectation on the method on the class: Post.should_receive(:paginate) > -- > Posted via http://www.ruby-forum.com/

Re: [rspec-users] Mocking find_by_sql

2009-06-05 Thread David Chelimsky
On Fri, Jun 5, 2009 at 3:29 PM, Fernando Perez wrote: > Hi, I cannot manage to mock a call to find_by_sql. Which class is > actually getting called? It is not the model, and I tried ActiveRecord > which didn't work either. It's the model's class: class Foo < AR::Base; end describe Foo do it "

Re: [rspec-users] Given/When/Then blocks on Cucumber

2009-06-05 Thread Joseph Wilk
Maurício Linhares wrote: Hello guys, I've been looking at Pyccuracy and found the "Given/Then/When" blocks to be very interesting and easier to understand and write, specially when writting scenarios with more than one of those. An example can be found here: http://www.pyccuracy.org/getting_star

[rspec-users] Testing my rails authentication controller

2009-06-05 Thread Wayne Andersen
I have a simple controller: class AccessController < ApplicationController def login if request.post? employee = Employee.authenticate(params[:name], params[:password]) if employee session[:employee_id] = employee.id redirect_to(:controller => "timesheets

Re: [rspec-users] Driving Out A View - Am I specifying too much?

2009-06-05 Thread Stephen Eley
On Fri, Jun 5, 2009 at 4:53 PM, Charlie Bowman wrote: > I never spec my views.  I also never put conditional logic in the views.  If > you have links that should show up sometimes and not others why not just > move that logic into a helper or other associated class and test the method? Good point.

Re: [rspec-users] Cucumber vs Rails Fixtures

2009-06-05 Thread Wolfram Arnold
The method I posted last week only works for Cucumber prior to 0.2.3.2. For 0.2.3.2 and later, you cannot pass a block to the World more than once, and thus the new way would be (in env.rb): module FixtureAccess def self.included(base) (class << base; self; end).class_eval do @@fixt

[rspec-users] Problems upgrading to Rails-2.3.2/Rspec 1.2.6

2009-06-05 Thread Lenny Marks
jruby-1.3.0 rspec/rspec-rails 1.2.6 I just ran into the 'Missing template' thing from the ticket below as well. Is it really that uncommon for a controller action to redirect or explicitly render a different template? Is it still considered 'invalid'? Seems silly to have to create a bunch o

Re: [rspec-users] Cucumber vs Rails Fixtures

2009-06-05 Thread Wolfram Arnold
This still wasn't fully working; I posted too soon. See here for the final and working version: http://wiki.github.com/aslakhellesoy/cucumber/fixtures -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org htt

Re: [rspec-users] Cucumber vs Rails Fixtures

2009-06-05 Thread Yi
I do this: Fixtures.reset_cache fixtures_folder = File.join(RAILS_ROOT, 'test', 'fixtures') fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') } fixture_class_names = {} # or whatever needed Fixtures.create_fixtures(fixtures_folder, fixtures, fixture_class_names)

Re: [rspec-users] Testing my rails authentication controller

2009-06-05 Thread David Chelimsky
On Fri, Jun 5, 2009 at 3:10 PM, Wayne Andersen wrote: > I have a simple controller: > > class AccessController < ApplicationController >   def login >     if request.post? >   employee = Employee.authenticate(params[:name], params[:password]) >   if employee >     session[:employee_id]

Re: [rspec-users] Missing template in helper specs with a render

2009-06-05 Thread David Chelimsky
On Thu, Jun 4, 2009 at 8:41 PM, Charlie Bowman wrote: > I have a helper method that does a "render :partial".  The method works fine > within the app (Rails 2.3.2).  In rspec (1.2.6) I get an error ("Missing > template /comments/_comment.erb in view path" > It seems that rspec when running helper

Re: [rspec-users] Problems upgrading to Rails-2.3.2/Rspec 1.2.6

2009-06-05 Thread David Chelimsky
On Fri, Jun 5, 2009 at 5:10 PM, Lenny Marks wrote: > jruby-1.3.0 > rspec/rspec-rails 1.2.6 > > I just ran into the 'Missing template' thing from the ticket below as well. > Is it really that uncommon for a controller action to redirect or explicitly > render a different template? Is it still consi

Re: [rspec-users] Driving Out A View - Layouts and Sessions?

2009-06-05 Thread Lee
Thanks Steve. As suggested I started to wrtite a separate spec for the layout: require File.expand_path(File.dirname(__FILE__) + '/../../ spec_helper') describe "layouts/contexts.html.erb" do it "should display a link to create a new zone" do render "layouts/contexts.html.erb" end end

Re: [rspec-users] Driving Out A View - Am I specifying too much?

2009-06-05 Thread Lee
Thank you everyone for your helpful insights. I had already gone down the route suggested by Zach but it was nevertheless very re-assuring to have my approach validated as I am a newbie to RSpec. I did however consolidate my expectations e.g.: context "when the member is a privileged member of