Re: [rspec-users] rescue

2008-03-18 Thread Jonathan Linowes
yep, that did it :) thx On Mar 18, 2008, at 11:50 PM, Zach Dennis wrote: > On Tue, Mar 18, 2008 at 11:13 PM, linojon <[EMAIL PROTECTED]> wrote: >> Hi, whats the correct way to spec a rescue? This will raise it but >> doesnt >> test my code's response >> >> >> >> # controller >> >> def edit >

Re: [rspec-users] svn externals and git submodules

2008-03-18 Thread Dominic Sisneros
rails/plugin is git aware already in trunk for cloning a git repository. However, you can only clone from the git repository root (the directory which contains the .git directory). You can't clone from a subdirectory. That's why the project needs to be split to install both rspec and rspec_on_rail

Re: [rspec-users] Am I off track on my testing?

2008-03-18 Thread Ben Mabey
Zach Dennis wrote: > On Sat, Mar 15, 2008 at 5:43 PM, Ben Mabey <[EMAIL PROTECTED]> wrote: > >> Zach Dennis wrote: >> > Can someone change this implementation and still have your tests pass, >> > but have the implementation be broken? If they can then yes it is >> > worth the 40 lines. >> >

Re: [rspec-users] rescue

2008-03-18 Thread Zach Dennis
On Tue, Mar 18, 2008 at 11:13 PM, linojon <[EMAIL PROTECTED]> wrote: > Hi, whats the correct way to spec a rescue? This will raise it but doesnt > test my code's response > > > > # controller > > def edit > @foo = Foo.find(params[:id]) > rescue > flash[:notice] = "Unknown foo #{params[:

Re: [rspec-users] "Why not MockEverthing" or why use fixtures for all tests?

2008-03-18 Thread Zach Dennis
Hello, On Tue, Mar 18, 2008 at 4:15 AM, David Schmidt <[EMAIL PROTECTED]> wrote: > Hello fellow RSpec users. > > Before you all start warming up your flame throwers please let me explain my > Subject line. > > I've been working over 4 months on a large Rails project with a few other > developers.

Re: [rspec-users] svn externals and git submodules

2008-03-18 Thread Luis Lavena
On Tue, Mar 18, 2008 at 10:41 PM, Dominic Sisneros <[EMAIL PROTECTED]> wrote: > This is a request to split up the repository into at least two repositories > > rspec > rspec_core (loaded as svn_external or git submodule) > rspec_on_rails (loaded as svn_external or git submodule) > > We coul

[rspec-users] rescue

2008-03-18 Thread linojon
Hi, whats the correct way to spec a rescue? This will raise it but doesnt test my code's response # controller def edit @foo = Foo.find(params[:id]) rescue flash[:notice] = "Unknown foo #{params[:id]}" redirect_to foos_path end # spec it "should flash error if not found

Re: [rspec-users] svn externals and git submodules

2008-03-18 Thread David Chelimsky
On Tue, Mar 18, 2008 at 8:41 PM, Dominic Sisneros <[EMAIL PROTECTED]> wrote: > This is a request to split up the repository into at least two repositories I forwarded this to http://rspec.lighthouseapp.com/projects/5645/tickets/347. Please make future feature requests there instead of this mailing

[rspec-users] svn externals and git submodules

2008-03-18 Thread Dominic Sisneros
This is a request to split up the repository into at least two repositories rspec rspec_core (loaded as svn_external or git submodule) rspec_on_rails (loaded as svn_external or git submodule) We could load the plugins the same way as before ruby script/plugin install http://rspec.rubyforg

Re: [rspec-users] Problem with mocking a simple has_many relationship

2008-03-18 Thread Nikos Dimitrakopoulos
Ok, last one - for your interest validates_length_of can be used for this purpose. There is an open bug/patch on the rails trac regarding the :within parameter but the :minimum works fine for me. As for the example the method called on @item.images is #size and not #count so -> @item.images.sho

Re: [rspec-users] Problem with mocking a simple has_many relationship

2008-03-18 Thread Nikos Dimitrakopoulos
James Deville wrote: > Doh! I can't believe that I missed that. > > You can also use if self.images.size.zero? > > Just a little more readable. > > James Deville You were writing while i was writing :D nice one, i didn't know the #zero? - way more readable :) -- Posted via http://www.ruby-for

Re: [rspec-users] Problem with mocking a simple has_many relationship

2008-03-18 Thread Nikos Dimitrakopoulos
Ok, i'm really stupid... i was taking a break (i've been on the pc for several hours) and the problem came to me before reading your posts :D Obviously the "if self.images.count" was wyyy too stupid! added the necessary == 0 and everything is fine... Thanks a lot anyway :) -- Posted via htt

Re: [rspec-users] Problem with mocking a simple has_many relationship

2008-03-18 Thread James Deville
Doh! I can't believe that I missed that. You can also use if self.images.size.zero? Just a little more readable. James Deville On Mar 18, 2008, at 4:38 PM, Rafael Mueller wrote: Hi Nikos, On Tue, Mar 18, 2008 at 8:26 PM, Nikos Dimitrakopoulos <[EMAIL PROTECTED] > wrote: the model: class

Re: [rspec-users] Problem with mocking a simple has_many relationship

2008-03-18 Thread James Deville
On Mar 18, 2008, at 4:26 PM, Nikos Dimitrakopoulos wrote: > Hi there all. Sorry if the question sounds silly but i'm rather new at > the 'mocking' stuff... So here is my problem (code helps more than > talking): > > the model: > > class Item < ActiveRecord::Base > ... > has_many :images, :depend

Re: [rspec-users] Problem with mocking a simple has_many relationship

2008-03-18 Thread Rafael Mueller
Hi Nikos, On Tue, Mar 18, 2008 at 8:26 PM, Nikos Dimitrakopoulos <[EMAIL PROTECTED]> wrote: > > the model: > class Item < ActiveRecord::Base > has_many :images, :dependent => :destroy > protected > def validate > errors.add(:images, "cannot be empty") if self.images.count > end > end se

[rspec-users] Problem with mocking a simple has_many relationship

2008-03-18 Thread Nikos Dimitrakopoulos
Hi there all. Sorry if the question sounds silly but i'm rather new at the 'mocking' stuff... So here is my problem (code helps more than talking): the model: class Item < ActiveRecord::Base ... has_many :images, :dependent => :destroy ... protected def validate errors.add(:image

Re: [rspec-users] rspec groups?

2008-03-18 Thread Ashley Moran
On 10 Mar 2008, at 12:42, Edvard Majakari wrote: > Being able to choose which > contexts/describes or individual specs will be run has been more than > sufficient to me, but of course, YNMDFTOM. Hi Edvard Sorry for the delayed reaction, but was just catching up on old posts and saw this. I

Re: [rspec-users] should have_tag outside Rails

2008-03-18 Thread Ashley Moran
On 18 Mar 2008, at 19:38, Kyle Hargraves wrote: > config.load_paths += Dir[File.join('vendor', 'gems', '*', > 'lib')].map do |libdir| >File.expand_path(libdir) > end > > This'll let it be loaded as a gem and you can put this in spec_helper: > > require 'rspec_hpricot_matchers' >

Re: [rspec-users] "Why not MockEverthing" or why use fixtures for all tests?

2008-03-18 Thread James Deville
On Mar 18, 2008, at 6:36 AM, Alan Larkin wrote: > David Schmidt wrote: >> Hello fellow RSpec users. >> >> Before you all start warming up your flame throwers please let me >> explain my Subject line. >> >> I've been working over 4 months on a large Rails project with a few >> other developers. Te

Re: [rspec-users] should have_tag outside Rails

2008-03-18 Thread Kyle Hargraves
On Tue, Mar 18, 2008 at 9:04 AM, Ashley Moran <[EMAIL PROTECTED]> wrote: > On 17/03/2008, Kyle Hargraves <[EMAIL PROTECTED]> wrote: > > > We discussed this in a ticket on lighthouse, and I ended up writing a > > workalike that's sitting atop hpricot. It's not quite identical, but > > generally clos

Re: [rspec-users] Branching scenarios, GivenScenario and database

2008-03-18 Thread Rick DeNatale
On 3/17/08, Rick DeNatale <[EMAIL PROTECTED]> wrote: > [quite a lot] Okay, I've got it working now. The problem seems to be wrapped up in the use of transactional fixtures to load the db, and the fact that fixture teardown actually happens in the SETUP phase, in other words when you declare a fix

Re: [rspec-users] should have_tag outside Rails

2008-03-18 Thread Ashley Moran
On 17/03/2008, Kyle Hargraves <[EMAIL PROTECTED]> wrote: > > We discussed this in a ticket on lighthouse, and I ended up writing a > workalike that's sitting atop hpricot. It's not quite identical, but > generally close enough and so far does everything I've needed: > > http://github.com/pd/rspec_h

Re: [rspec-users] rspec groups?

2008-03-18 Thread Max Williams
James Deville wrote: > Using the -e option from the command line, you can also specify a > string which is to be run, this is a way to run only one describe > block, or one it block. The rake task method suggested by Edvard is > the other option I'm having problems with the -e option - it doesn't

Re: [rspec-users] "Why not MockEverthing" or why use fixtures for all tests?

2008-03-18 Thread Alan Larkin
David Schmidt wrote: > Hello fellow RSpec users. > > Before you all start warming up your flame throwers please let me > explain my Subject line. > > I've been working over 4 months on a large Rails project with a few > other developers. Test coverage was spotty at best, though they *were* >

Re: [rspec-users] should have_tag outside Rails

2008-03-18 Thread Ashley Moran
On 17/03/2008, Zach Dennis <[EMAIL PROTECTED]> wrote: > > http://git.or.cz/course/svn.html > > and also search google for "git for svn users" > > Zach Ta - I ended up doing a git clone into our SVN repo. Not sure if that's a good idea but seems to work... Ashley ___

Re: [rspec-users] "Why not MockEverthing" or why use fixtures for all tests?

2008-03-18 Thread David Chelimsky
On Tue, Mar 18, 2008 at 5:04 AM, Chris Parsons <[EMAIL PROTECTED]> wrote: > Hi David > > > On 18 Mar 2008, at 08:15, David Schmidt wrote: > > > Here is his email to me, less his signature as I don't want to make > > this personal. I'd like to see what the RSpec user community has to > > say in

Re: [rspec-users] "Why not MockEverthing" or why use fixtures for all tests?

2008-03-18 Thread Chris Parsons
Hi David On 18 Mar 2008, at 08:15, David Schmidt wrote: > Here is his email to me, less his signature as I don't want to make > this personal. I'd like to see what the RSpec user community has to > say in response to his comments, below: [snip email] For me, it basically boils down to: use

[rspec-users] "Why not MockEverthing" or why use fixtures for all tests?

2008-03-18 Thread David Schmidt
Hello fellow RSpec users. Before you all start warming up your flame throwers please let me explain my Subject line. I've been working over 4 months on a large Rails project with a few other developers. Test coverage was spotty at best, though they *were* RSpec tests. One of the other d