[rspec-users] mocking does not work

2008-10-29 Thread Leon Du
The spec it "should expose a newly created logo as @logo" do Logo.should_receive(:new).with({'these' => 'params'}).and_return(mock_logo(:save =>

Re: [rspec-users] Mocks and Refactoring - doing it wrong?

2008-10-29 Thread Scott Taylor
On Oct 30, 2008, at 2:17 AM, David Chelimsky wrote: On Thu, Oct 30, 2008 at 1:14 AM, Scott Taylor <[EMAIL PROTECTED]> wrote: On Oct 30, 2008, at 2:01 AM, Sebastian W. wrote: Hi Scott, Cool - I see what you're saying here. The only thing that I'm a bit confused still is that it seems like, a

Re: [rspec-users] Mocks and Refactoring - doing it wrong?

2008-10-29 Thread Scott Taylor
On Oct 30, 2008, at 2:17 AM, David Chelimsky wrote: On Thu, Oct 30, 2008 at 1:14 AM, Scott Taylor <[EMAIL PROTECTED]> wrote: On Oct 30, 2008, at 2:01 AM, Sebastian W. wrote: Hi Scott, Cool - I see what you're saying here. The only thing that I'm a bit confused still is that it seems like, a

Re: [rspec-users] Mocks and Refactoring - doing it wrong?

2008-10-29 Thread Sebastian W.
> Why don't we have a partial mock which will raise an error (or at > least a warning) when stubbing an object who's class doesn't > respond_to? the method given? I feel like this sort of simple > dependency has been brought up 1000 times on the list before, but > never been explicitly stated. >

Re: [rspec-users] Mocks and Refactoring - doing it wrong?

2008-10-29 Thread Scott Taylor
On Oct 30, 2008, at 2:14 AM, Scott Taylor wrote: On Oct 30, 2008, at 2:01 AM, Sebastian W. wrote: Hi Scott, Cool - I see what you're saying here. The only thing that I'm a bit confused still is that it seems like, at least if your system is starting to get larger, you'd really *want* your fa

Re: [rspec-users] Mocks and Refactoring - doing it wrong?

2008-10-29 Thread David Chelimsky
On Thu, Oct 30, 2008 at 1:14 AM, Scott Taylor <[EMAIL PROTECTED]> wrote: > > On Oct 30, 2008, at 2:01 AM, Sebastian W. wrote: > >> Hi Scott, >> Cool - I see what you're saying here. The only thing that I'm a bit >> confused still is that it seems like, at least if your system is >> starting to get

Re: [rspec-users] Mocks and Refactoring - doing it wrong?

2008-10-29 Thread Scott Taylor
On Oct 30, 2008, at 2:01 AM, Sebastian W. wrote: Hi Scott, Cool - I see what you're saying here. The only thing that I'm a bit confused still is that it seems like, at least if your system is starting to get larger, you'd really *want* your fast unit test to help you catch API changes like t

Re: [rspec-users] Mocks and Refactoring - doing it wrong?

2008-10-29 Thread Sebastian W.
Hi Scott, Cool - I see what you're saying here. The only thing that I'm a bit confused still is that it seems like, at least if your system is starting to get larger, you'd really *want* your fast unit test to help you catch API changes like this to help you make updates faster. Having to run a

Re: [rspec-users] Render_template return true when only part of template name match. Bug?

2008-10-29 Thread David Chelimsky
On Thu, Oct 30, 2008 at 12:37 AM, Alex Rudyk <[EMAIL PROTECTED]> wrote: > I have this code > > response.should render_template(:my_messages) > > It returns true also if :messages template rendered. I am confused, is this > a bug or expected behavior? Docs say use strings: http://rspec.rubyforge.o

[rspec-users] Render_template return true when only part of template name match. Bug?

2008-10-29 Thread Alex Rudyk
I have this code response.should render_template(:my_messages) It returns true also if :messages template rendered. I am confused, is this a bug or expected behavior? Alex ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/

Re: [rspec-users] Mocks and Refactoring - doing it wrong?

2008-10-29 Thread Scott Taylor
On Oct 30, 2008, at 1:02 AM, Sebastian W. wrote: Hello RSpec folks, I've only been introduced to the world of mock objects since Wednesday of last week, so go easy on me if I come off as ignorant. :P So, I'm a big fan of testing, especially since it has really helped to do refactoring in the p

[rspec-users] Mocks and Refactoring - doing it wrong?

2008-10-29 Thread Sebastian W.
Hello RSpec folks, I've only been introduced to the world of mock objects since Wednesday of last week, so go easy on me if I come off as ignorant. :P So, I'm a big fan of testing, especially since it has really helped to do refactoring in the past. But, I'm running into an issue that I'm hoping c

Re: [rspec-users] Including spec/rails/mocks into other classes

2008-10-29 Thread Scott Taylor
On Oct 29, 2008, at 11:27 AM, Cameron Booth wrote: Hi all, So my potentially crazy but I think good idea right now is to take the factory_girl gem and adapt it to generate stubbed models instead of actual ActiveRecord objects that get saved to the DB. My main reasoning there is that I li

Re: [rspec-users] Cucumber step FIT-like tables

2008-10-29 Thread aidy lewis
Hi Alsak, 2008/10/27 Aslak Hellesøy <[EMAIL PROTECTED]>: > What version/revision? I am on 0.1.7; I guess I need to upgrade. If this is the case, will I need to use the Trunk or is there a gem? Thanks Aidy ___ rspec-users mailing list rspec-users@rubyf

Re: [rspec-users] Working outside-in with Cucumber and RSpec

2008-10-29 Thread Zach Dennis
On Wed, Oct 29, 2008 at 6:02 PM, aslak hellesoy <[EMAIL PROTECTED]>wrote: > On Wed, Oct 29, 2008 at 10:32 PM, David Chelimsky <[EMAIL PROTECTED]> > wrote: > > On Tue, Oct 28, 2008 at 2:32 AM, Ashley Moran > > <[EMAIL PROTECTED]> wrote: > >> > >> On Oct 27, 2008, at 5:20 pm, Pat Maddox wrote: > >>

Re: [rspec-users] Should acceptance tests be run against a production environment?

2008-10-29 Thread Stephen Eley
On Wed, Oct 29, 2008 at 4:04 PM, DyingToLearn <[EMAIL PROTECTED]> wrote: > > What about the idea of running it on machines that are as close to > production as possible? So if my production machine is a SliceHost VPS > with 256MB RAM, Nginx, and 3 Mongrels, then I should be running these > tests on

Re: [rspec-users] RDoc down

2008-10-29 Thread David Chelimsky
On Tue, Oct 28, 2008 at 1:03 PM, Ashley Moran <[EMAIL PROTECTED]> wrote: > Hi > > I get a 404 here following the expectations page[1] to the RDoc[2]. Don't > know who maintains this - is it a known problem? It is now :) If you go to http://rspec.info, you'll see links to the rdoc where it has mo

Re: [rspec-users] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread David Chelimsky
On Tue, Oct 28, 2008 at 8:40 AM, Cameron Booth <[EMAIL PROTECTED]> wrote: > Hi again, > > I think I may have partly found my own answer. > > Looking at this gist http://gist.github.com/14050 by Andy Freeman, it seems > to do much of what I'm looking for right now (thanks, awesome!!). > > But playin

[rspec-users] spec'ing the :conditions argument of a find

2008-10-29 Thread Rémi Gagnon
Let's see, I want to spec the :conditions args to make sure the right args is passed to the query. Product.find(:all, :conditions => ["inte_no = ? and vaat_id_type_statut_pcpa = ?", inte_no, 7], :limit => 2, :order => "trns_dt_appl_prod desc") Product.should_receive(:find).with

[rspec-users] RDoc down

2008-10-29 Thread Ashley Moran
Hi I get a 404 here following the expectations page[1] to the RDoc[2]. Don't know who maintains this - is it a known problem? Ashley [1] http://rspec.info/documentation/expectations.html [2] http://rspec.info/rdoc/index.html -- http://www.patchspace.co.uk/ http://aviewfromafar.net/ __

[rspec-users] [Cucumber]: require features from mutliple folders

2008-10-29 Thread aidy lewis
Hi, I have different projects with features related to those projects in different folders /project_1 /project_2 /steps The steps cover both projects How do I get Cucumber to require all features within both the projects folders and include the common steps? Thanks Aidy ___

Re: [rspec-users] Gems installation

2008-10-29 Thread Hans de Graaff
On Mon, 2008-10-27 at 15:54 +0100, Juanma Cervera wrote: > I have a problem trying to use cucumber with webrat. > I thought I could use the gems versions of rspec, rspec-rails, cucumber > and webrat, in fact I think that I could manage to do it two weeks ago, > but now that I updated the versions

Re: [rspec-users] Working outside-in with Cucumber and RSpec

2008-10-29 Thread Zach Dennis
I forgot to add that until there is a new way to handle the role that controllers currently are responsible for, I would probably teach someone how to write good controllers and controller examples. I would also allow them to experience the pain that comes with trying to write bloated controller ac

Re: [rspec-users] -l command line option broken?

2008-10-29 Thread Lenny Marks
On Oct 28, 2008, at 5:46 PM, Lenny Marks wrote: I'm not familiar enough with the rspec code to get to the bottom of this, but I did enough drilling to find its related to the new backtrace based strategy for Spec::Runner::SpecParser#spec_name_for (file, line_number). Putting a print sta

Re: [rspec-users] Should acceptance tests be run against a production environment?

2008-10-29 Thread Stephen Eley
On Tue, Oct 28, 2008 at 1:08 PM, Pat Maddox <[EMAIL PROTECTED]> wrote: > When you do end-to-end acceptance testing with Selenium, I think it > should be run against a production environment. Not THE production > environment, mind you, but simply a new Rails app running with > RAILS_ENV=production.

[rspec-users] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread Cameron Booth
Hi everybody, New to the list, so apologies if this has been answered elsewhere, but I didn't find it. I'm trying to build up a plugin of useful rspec macros for rails development, eg. things like: it_should_return_success it_should_redirect_to { some_url } I'm basing my ideas off of some

Re: [rspec-users] Gems installation

2008-10-29 Thread aslak hellesoy
On Mon, Oct 27, 2008 at 3:54 PM, Juanma Cervera <[EMAIL PROTECTED]> wrote: > Hello. > > I have a problem trying to use cucumber with webrat. > I thought I could use the gems versions of rspec, rspec-rails, cucumber > and webrat, in fact I think that I could manage to do it two weeks ago, > but now

Re: [rspec-users] Working outside-in with Cucumber and RSpec

2008-10-29 Thread Pat Maddox
"David Chelimsky" <[EMAIL PROTECTED]> writes: >> What's the consensus here then, controller specs yay or nay? >> >> 1 nay from Pat > > I think the nay from Pat was conditional, as it should be. > > I think the answer is: if you have to ask, then you should use them :) > Otherwise, don't use them w

Re: [rspec-users] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread Pat Maddox
Nick Hoffman <[EMAIL PROTECTED]> writes: > On 2008-10-28, at 09:09, Cameron Booth wrote: >> describe User do >> it_should_validate_presence_of :name >> end >> >> I can get it working if I pass in User as an argument: >> >> describe User do >> it_should_validate_presence_of User, :name >> end >

Re: [rspec-users] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread Cameron Booth
Hi again, I think I may have partly found my own answer. Looking at this gist http://gist.github.com/14050 by Andy Freeman, it seems to do much of what I'm looking for right now (thanks, awesome!!). But playing around with it a bit, calling self.described_type which I thought would return the cl

Re: [rspec-users] Should acceptance tests be run against a production environment?

2008-10-29 Thread Ashley Moran
On Oct 28, 2008, at 5:08 pm, Pat Maddox wrote: When you do end-to-end acceptance testing with Selenium, I think it should be run against a production environment. Not THE production environment, mind you, but simply a new Rails app running with RAILS_ENV=production. Also, transactional fixtur

Re: [rspec-users] Including spec/rails/mocks into other classes

2008-10-29 Thread Ben Mabey
Cameron Booth wrote: Hi all, So my potentially crazy but I think good idea right now is to take the factory_girl gem and adapt it to generate stubbed models instead of actual ActiveRecord objects that get saved to the DB. My main reasoning there is that I like the syntax they've set up and so

Re: [rspec-users] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread Scott Taylor
On Oct 28, 2008, at 9:09 AM, Cameron Booth wrote: Hi everybody, New to the list, so apologies if this has been answered elsewhere, but I didn't find it. I'm trying to build up a plugin of useful rspec macros for rails development, eg. things like: it_should_return_success it_should_redir

Re: [rspec-users] Dreading Controller Specs

2008-10-29 Thread Pat Maddox
Jonathan Linowes <[EMAIL PROTECTED]> writes: > On Oct 22, 2008, at 4:32 PM, Pat Maddox wrote: > >> I think any app with a rich domain model benefits from a service layer >> that uses that model. When building Rails apps, stuff is relatively >> simple and the controllers *are* the service layer.

Re: [rspec-users] -l command line option broken?

2008-10-29 Thread David Chelimsky
On Tue, Oct 28, 2008 at 2:31 PM, Lenny Marks <[EMAIL PROTECTED]> wrote: > Ooops. I meant the -l option not -n. > > It seems that '-l' command line option for rspec stopped working as of rspec > 1.1.3. I think this may be related to why I can't get NetBeans to run > focussed specs anymore. Does this

Re: [rspec-users] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread Mike Gunderloy
Part of the testing harness on one of our projects: module Spec::Example::ExampleGroupMethods def model self.described_type.to_s.underscore end def should_require(*attrs) raise "should require needs at least one attribute" if attrs.empty? model = model() attrs.each do |attr

Re: [rspec-users] Working outside-in with Cucumber and RSpec

2008-10-29 Thread Stephen Eley
On Wed, Oct 29, 2008 at 5:32 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > > I think the answer is: if you have to ask, then you should use them :) > Otherwise, don't use them when you feel confident that you don't need > them. Or use them, but don't knock yourself out trying to keep them perfe

Re: [rspec-users] Should acceptance tests be run against a production environment?

2008-10-29 Thread Yi Wen
I agree. I have seen way too many times selenium tests are OK but bugs appear in production. Not only should we run selenium tests against production environment, but also they should be run on a production like environment, such as, same OS, same setting (behind Apache, or whatever HTTP servers, e

Re: [rspec-users] -l command line option broken?

2008-10-29 Thread Mark Wilden
On Tue, Oct 28, 2008 at 1:54 PM, Mark Wilden <[EMAIL PROTECTED]> wrote: > On Tue, Oct 28, 2008 at 12:31 PM, Lenny Marks <[EMAIL PROTECTED]> wrote: > >> Ooops. I meant the -l option not -n. >> >> It seems that '-l' command line option for rspec stopped working as of >> rspec 1.1.3. > > > It's been

Re: [rspec-users] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread Cameron Booth
Hi everybody, David and Pat, thanks for the tip on using "described_type" to access the model class. I actually figured that one out like 10 minutes after sending the email. 2 learnings there, first, sometimes explaining the problem helps solve the problem, and second, maybe I should sit on those

[rspec-users] -n command line option broken?

2008-10-29 Thread Lenny Marks
It seems that '-n' command line option for rspec stopped working as of rspec 1.1.3. I think this may be related to why I can't get NetBeans to run focussed specs anymore. Does this work for others? I'm using jruby but I don't think that's the issue. http://ruby.netbeans.org/issues/show_bug.

Re: [rspec-users] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread Zach Dennis
On Wed, Oct 29, 2008 at 12:01 PM, Nick Hoffman <[EMAIL PROTECTED]> wrote: > On 2008-10-28, at 09:09, Cameron Booth wrote: > >> describe User do >> it_should_validate_presence_of :name >> end >> >> I can get it working if I pass in User as an argument: >> >> describe User do >> it_should_validate

Re: [rspec-users] Working outside-in with Cucumber and RSpec

2008-10-29 Thread aslak hellesoy
On Wed, Oct 29, 2008 at 10:32 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Tue, Oct 28, 2008 at 2:32 AM, Ashley Moran > <[EMAIL PROTECTED]> wrote: >> >> On Oct 27, 2008, at 5:20 pm, Pat Maddox wrote: >> >>> When it comes to controllers specs, mocks provide the most value by >>> isolating fro

Re: [rspec-users] Should acceptance tests be run against a production environment?

2008-10-29 Thread Mark Wilden
One thing that bothers me about a 'staging' or 'production_test' environment is simply the value of Rails.env. That should really == 'production', it seems to me, but that's not always practical. ///ark ___ rspec-users mailing list rspec-users@rubyforge.

Re: [rspec-users] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread David Chelimsky
On Tue, Oct 28, 2008 at 8:09 AM, Cameron Booth <[EMAIL PROTECTED]> wrote: > Hi everybody, > > New to the list, so apologies if this has been answered elsewhere, but I > didn't find it. I'm trying to build up a plugin of useful rspec macros for > rails development, eg. things like: > > it_should_ret

Re: [rspec-users] Should acceptance tests be run against a production environment?

2008-10-29 Thread DyingToLearn
aslak hellesoy wrote: > I recommend running against a production-LIKE environment. In Rails > you can create a production_test environment that you make as close to > your production environment as possible, for example by running > against a production_test database that contains a dump of your >

Re: [rspec-users] -l command line option broken?

2008-10-29 Thread Mark Wilden
On Tue, Oct 28, 2008 at 12:31 PM, Lenny Marks <[EMAIL PROTECTED]> wrote: > Ooops. I meant the -l option not -n. > > It seems that '-l' command line option for rspec stopped working as of > rspec 1.1.3. It's been working for me. I wrote a Vim script that runs the current spec (in whatever window

Re: [rspec-users] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread Pat Maddox
"Cameron Booth" <[EMAIL PROTECTED]> writes: > Is there a way to access the class itself that I'm missing? described_type Pat ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Cucumber step FIT-like tables

2008-10-29 Thread Chris Flipse
On Mon, Oct 27, 2008 at 2:33 PM, aidy lewis <[EMAIL PROTECTED]>wrote: > Hi, > > I am having a problem with my Cucumber step FIT-like tables. > > This is my scenario > > Scenario: Filter by new files added >Given a database update that creates an ExpiryDate that is within 30 > days >And a

Re: [rspec-users] Working outside-in with Cucumber and RSpec

2008-10-29 Thread Zach Dennis
Controllers are such a funny thing. Right now they are necessary evil. Once you start feeling pain with controllers you start changing your thinking. Somehow everyone who starts learning Rails ends up with bloated controllers even if they've read all of the posts and articles on "skinny controllers

Re: [rspec-users] Should acceptance tests be run against a production environment?

2008-10-29 Thread Joseph Wilk
Pat Maddox wrote: When you do end-to-end acceptance testing with Selenium, I think it should be run against a production environment. Not THE production environment, mind you, but simply a new Rails app running with RAILS_ENV=production. Also, transactional fixtures should be turned off. This

Re: [rspec-users] Working outside-in with Cucumber and RSpec

2008-10-29 Thread David Chelimsky
On Tue, Oct 28, 2008 at 2:32 AM, Ashley Moran <[EMAIL PROTECTED]> wrote: > > On Oct 27, 2008, at 5:20 pm, Pat Maddox wrote: > >> When it comes to controllers specs, mocks provide the most value by >> isolating from the model and db - the specs run faster, and you don't >> have to worry about model

Re: [rspec-users] Working outside-in with Cucumber and RSpec

2008-10-29 Thread Ashley Moran
On Oct 27, 2008, at 5:20 pm, Pat Maddox wrote: When it comes to controllers specs, mocks provide the most value by isolating from the model and db - the specs run faster, and you don't have to worry about model validations. But if you minimize controller logic, you can write acceptance tests t

Re: [rspec-users] -l command line option broken?

2008-10-29 Thread Lenny Marks
On Oct 28, 2008, at 5:46 PM, Lenny Marks wrote: I'm not familiar enough with the rspec code to get to the bottom of this, but I did enough drilling to find its related to the new backtrace based strategy for Spec::Runner::SpecParser#spec_name_for (file, line_number). Putting a print stat

Re: [rspec-users] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread Nick Hoffman
On 2008-10-28, at 09:09, Cameron Booth wrote: describe User do it_should_validate_presence_of :name end I can get it working if I pass in User as an argument: describe User do it_should_validate_presence_of User, :name end Hi Cameron. I haven't played with RSpec's internals at all, but

[rspec-users] Including spec/rails/mocks into other classes

2008-10-29 Thread Cameron Booth
Hi all, So my potentially crazy but I think good idea right now is to take the factory_girl gem and adapt it to generate stubbed models instead of actual ActiveRecord objects that get saved to the DB. My main reasoning there is that I like the syntax they've set up and some of the tools under the

Re: [rspec-users] Should acceptance tests be run against a production environment?

2008-10-29 Thread aslak hellesoy
On Tue, Oct 28, 2008 at 6:08 PM, Pat Maddox <[EMAIL PROTECTED]> wrote: > When you do end-to-end acceptance testing with Selenium, I think it > should be run against a production environment. Not THE production > environment, mind you, but simply a new Rails app running with > RAILS_ENV=production.

Re: [rspec-users] Should acceptance tests be run against a production environment?

2008-10-29 Thread David Chelimsky
On Tue, Oct 28, 2008 at 12:08 PM, Pat Maddox <[EMAIL PROTECTED]> wrote: > When you do end-to-end acceptance testing with Selenium, I think it > should be run against a production environment. Not THE production > environment, mind you, but simply a new Rails app running with > RAILS_ENV=production