Re: [rspec-users] Question on SQL exceptions

2009-03-09 Thread Tim Glen
Just a stab in the dark, but I haven't seen any mention of calling save vs. save!. save just puts any errors in the model, save! will raise the exception if there are any errors. That may not be the case for ActiveRecord:StatementInvalid exception, but I thought i'd mention it anyway. I wond

Re: [rspec-users] Question on SQL exceptions

2009-03-09 Thread Tim Glen
ActiveRecord doesn't know anything about db constraint errors. If one is violated, the error propagates up in the form of an exception. I realize that, but the exception is of the ActiveRecord:StatementInvalid class, which I should be able to catch in the controller with a rescue clause.

Re: [rspec-users] validate_presence_of

2009-02-17 Thread Tim Glen
according to this post: http://blog.davidchelimsky.net/2009/1/13/rspec-1-1-12-is-released I should be able to write: describe User do it {should valdate_presence_of(:login)} end with rspec 1.1.12 But I got: NO NAME undefined method `valdate_presence_of' for # Hi Yi, I believe you're

Re: [rspec-users] Help with regexp in matcher

2009-01-12 Thread Tim Glen
This is giving me an error: When /?:(log|sign)?:(i|o)n success message/ do Then "welcome message" end I could be wrong, but I believe you're looking for this instead? When /(?:log|sign)(?:i|o)n success message/ do hope that helps, timg ___ rspec-u

Re: [rspec-users] Cucumber fat client

2008-12-09 Thread Tim Glen
I think it would be a great app to have, which would work well inside a web browser, rather than a fat client that customers and managers have to download...? +1, I think keeping it in the browser will work well for most situations. One option is to make it a flex app and could then be use

Re: [rspec-users] RSpec, Rails, ObjectDaddy and transactions

2008-09-26 Thread Tim Glen
Oh, and I do have this line in my spec_helper: config.use_transactional_fixtures = true I assume that only does anything to fixtures, specifically No. That tells rspec/ test::unit to start a transaction at the start of every test case, and issue a rollback when it's over. That + a transact

[rspec-users] RSpec, Rails, ObjectDaddy and transactions

2008-09-26 Thread Tim Glen
hey all, I've started playing around with object daddy and have a question? How do I ensure that anything created during a spec example gets rolled back before the next one? Without that ability, it starts messing with models that have unique columns on successive runs of my specs. Oh,

[rspec-users] cucumber cli getting called incorrectly?

2008-09-22 Thread Tim Glen
I'm running Rails 2.1.1 and the newest cucumber gem/plugin as of this morning. When I run scripts like `ruby script/generate` or any (I think) rake task (I tried 4 or 5), I get the following timg-2:1-3-development tim$ rake db:version (in /Users/tim/projects/dt/branches/1-3-development) Curren

Re: [rspec-users] Cucumber - stub! or mock?

2008-09-17 Thread Tim Glen
Why don't use just use a slug for these things? In other words - use a unique name for each record, since the numbers 10 and 11 don't mean much to anyone. Then, use a factory (like FixtureReplacement or Object Daddy) to generate the records in env.rb. Here's how you'd do that with Fixtur

Re: [rspec-users] Cucumber - stub! or mock?

2008-09-16 Thread Tim Glen
I've got some code that I (mostly) inherited. It essentially has a couple of AR class methods that look for a specific record by id: class Project < ActiveRecord::Base class << self def specific_project @another_specific_project ||= Project.find(10) if Project.exists?(10) end

[rspec-users] Cucumber - stub! or mock?

2008-09-15 Thread Tim Glen
Hey all, I've got some code that I (mostly) inherited. It essentially has a couple of AR class methods that look for a specific record by id: class Project < ActiveRecord::Base class << self def specific_project @another_specific_project ||= Project.find(10) if Project.exists?(1

Re: [rspec-users] Cucumber and fixtures/FixtureReplacement

2008-09-09 Thread Tim Glen
Did you see that my code uses extend? Yes - tried both in my flailing about :) If that still doesn't work, file a bug report. http://rspec.lighthouseapp.com/projects/16211-cucumber/overview It might be a FixtureReplacement bug, but I'll still look into it. Could it be that FixtureReplacemen

Re: [rspec-users] Cucumber and fixtures/FixtureReplacement

2008-09-09 Thread Tim Glen
Before do self.extend(FixtureReplacement) end I had previously tried this right in the steps file: Before do self.include(FixtureReplacement) end Actually - this turned out to almost the right thing. I just added this to my env.rb: `include FixtureReplacement` Wrapping it in the Before bl

Re: [rspec-users] Cucumber and fixtures/FixtureReplacement

2008-09-09 Thread Tim Glen
ion.rb:448:in `send!' /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/integration.rb:448:in `method_missing' ./features/steps/cart_steps.rb:8:in `Given /I am on the new project investment page/' features/cart.feature:36:in `Given that I am on

[rspec-users] Cucumber and fixtures/FixtureReplacement

2008-09-09 Thread Tim Glen
seem to make any difference. Then I tried adding "include FixtureReplacement" into my Steps Before block, but that doesn't work either. any thoughts? -- Tim Glen Rails 2.0.2 RSpec 1.1.4 ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Modules will no longer be automatically included in RSpec version 1.1.4

2008-05-26 Thread Tim Glen
On 23-May-08, at 6:23 PM, Pat Maddox wrote: RSpec currently includes the described module so that you can call methods directly. It will no longerdo that automatically, so you'll have to manually include the module if you want these direct calls. Rails helpers are defined in modules, so that's

Re: [rspec-users] Modules will no longer be automatically included in RSpec version 1.1.4

2008-05-26 Thread Tim Glen
So I find myself wondering - is this the case for just helper modules or all modules? For instance, I have a module which gets included into some controllers, but I'd like to spec against it directly so I don't have in those other controllers... I'm not sure how to set this up. What's the b

Re: [rspec-users] Testing Controllers with respond_to?

2008-03-25 Thread Tim Glen
t/csv', :disposition => 'attachment'}) do_get end Now my assumption is that your mime-type would need to be registered in rails for this to work (if you have need of one outside of the norm), which arguably has the added benefit of ensuring you added it into your envir

Re: [rspec-users] changes in rspec's trunk and autotest

2008-01-11 Thread Tim Glen
:52 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: >> On Jan 11, 2008 9:45 AM, Tim Glen <[EMAIL PROTECTED]> wrote: >>> since i'm on rspec trunk, I applied your patch and ran into a little >>> issue. All my specs still run but it seems to be looking at and

Re: [rspec-users] changes in rspec's trunk and autotest

2008-01-11 Thread Tim Glen
since i'm on rspec trunk, I applied your patch and ran into a little issue. All my specs still run but it seems to be looking at and "attempting" all of my hidden files and directories (and some other stuff too?): Dunno! Capfile Dunno! app/helpers/.svn/format Dunno! app/views/sales/.svn/text