Re: [rspec-users] [rails] strange regex validation failure

2009-11-21 Thread Craig Demyanovich
Hi Andy, Nothing jumps out at me at the moment. If you think there might be a difference between dev and test, you could launch script/console with the test env. and try it again on the console. $ script/console test Regards, Craig -- Craig Demyanovich Mutually Human Software http

Re: [rspec-users] testing named_scope

2010-01-18 Thread Craig Demyanovich
On Mon, Jan 18, 2010 at 5:17 AM, David Chelimsky wrote: > On Mon, Jan 18, 2010 at 4:01 AM, Pat Maddox > wrote: > ... > > class User < ActiveRecord::Base > > named_scope :admins, :conditions => {:admin => true} > > end > > > > describe User, "admins" do > > it "should include users with admin

Re: [rspec-users] [Rspec-Rails] before(:all) doesn't rollback

2010-07-20 Thread Craig Demyanovich
More info here . Note the warning at the bottom of the page. Regards, Craig ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] [rails] shoud I test validate_presentence_of series?

2010-07-21 Thread Craig Demyanovich
I like covering validation with RSpec instead of only relying on it being covered at a higher level. I like to check for error(s) on each attribute to be sure that the model is not invalid for some other reason. Here's how I do it: describe Forum, 'being valid' do it "requires a name" do fo

Re: [rspec-users] rspec2 not working with shoulda

2010-08-11 Thread Craig Demyanovich
On Wed, Aug 11, 2010 at 10:38 AM, David Chelimsky wrote: > > Also - the subject line is backwards - it shoulda been "shoulda not working > with rspec-2" ;) It's been a long time since I tried shoulda, but I used to like to give the advice, "you shoulda used RSpec instead." ;-) Hope you get ever

Re: [rspec-users] rspec2 not working with shoulda

2010-08-11 Thread Craig Demyanovich
On Wed, Aug 11, 2010 at 12:53 PM, Nadal wrote: > I posted a question on shoulda forum. It is under moderation so I > don't have a link yet. > > To the people who do not use shoulda: How would you write a test for > above case. I assume it would require set up a subject, set nil value, > and then

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

2010-08-24 Thread Craig Demyanovich
On Tue, Aug 24, 2010 at 5:19 AM, Alex Pressberg wrote: > Yes! We do use render in helpers to a great extent and are bitten by the > "missing template in view path" error too. Any workarounds? Can the view > path be easily fixed for helper specs in Rspec 1.3? > Does Rspec 2 already support this? >

Re: [rspec-users] Trying to spec all models

2010-09-16 Thread Craig Demyanovich
On Thu, Sep 16, 2010 at 9:24 PM, Ed Howland wrote: > Phillip, any updates on your efforts? > > I am keenly interested in a Cucumber tags like facility for RSpec Though I haven't been closely following RSpec 2, I think it's going to have tags much like Cucumber. Regards, Craig _

Re: [rspec-users] having some issues with factory_girl and bundler...

2010-09-27 Thread Craig Demyanovich
On Mon, Sep 27, 2010 at 5:05 PM, Justin Ko wrote: > > > On Sep 27, 4:11 pm, Carmen Díaz Echauri wrote: > > Hi All > > > > Need some brilliants minds here :) > > > > I'm using Rails 2.3.8 & ruby 1.8 (I know, I know... ) > > I've move my gems from .gems to Bundler, but I'm having some issues with

Re: [rspec-users] Validations aren't being performed when running 'rspec spec'

2011-02-24 Thread Craig Demyanovich
On Wed, Feb 23, 2011 at 10:29 AM, Tom Milewski wrote: > Model: > > validates_presence_of :name, :location, :email... > > Test: > > it "should ensure that name is present" do > Factory.build(:public_agent, :name => nil).should > have(1).error_on(:name) > end > > All of these tests do not retu

Re: [rspec-users] Validations aren't being performed when running 'rspec spec'

2011-02-24 Thread Craig Demyanovich
On Thu, Feb 24, 2011 at 2:07 PM, Tom Milewski wrote: > Thanks for the replies. > > Here's the error I'm seeing when running all specs (.build > and .create): > > Agent while creating should ensure that name is present > Failure/Error: Factory(:public_agent, :name => nil).should > have(1).erro

Re: [rspec-users] Rspec2 for rails 2.3.8?

2011-02-25 Thread Craig Demyanovich
On Fri, Feb 25, 2011 at 4:30 PM, Radhesh Kamath wrote: > Which version of rspec-rails should I use for Rails 2.3.8? rspec-rails 1.3.3 is currently the latest release for Rails 2.3.x. Regards, Craig ___ rspec-users mailing list rspec-users@rubyforge.or

Re: [rspec-users] Simple Association Redirect on delete

2011-02-28 Thread Craig Demyanovich
On Sun, Feb 27, 2011 at 10:57 PM, Charley wrote: ... > it "redirects to the bugs list" do > Bug.stub(:find) { mock_bug } > delete :destroy, :id => "1" > response.should redirect_to(bugs_url) > end > > This fails for obvious reasons. A bug belongs to a project so the > redirect should go to the

Re: [rspec-users] [ANN] Welcome Chad, Pat, Justin, and Myron!

2011-03-01 Thread Craig Demyanovich
Welcome, everyone! Thanks for helping to provide all of us with high-quality, useful tools that help us do what we love. Regards, Craig ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] How to test modules and custom validators

2011-08-04 Thread Craig Demyanovich
I recently wrote this spec for a custom validator. I hope you find it useful. Feedback welcome. Craig ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Problems mocking controller helpers with the last version.

2008-09-29 Thread Craig Demyanovich
I can't tell from your post whether you meant to type an instance or local variable when noting that you "could check the role of the user in the view with current_user.role," since you mentioned an instance variable earlier. assigns[:current_user] = ... sets up an instance variable, @current_user

Re: [rspec-users] Rspec: gem vs. plugin?

2008-10-08 Thread Craig Demyanovich
On Wed, Oct 8, 2008 at 3:09 PM, Pat Maddox <[EMAIL PROTECTED]> wrote: > To OP: you said that "rake spec" doesn't do anything...did you run > "script/generate rspec" to get the rspec rake tasks? The OP wrote, "rake rspec." Either that was a typo or he needs to run "rake spec" instead. Regards, C

Re: [rspec-users] How to spec accessing a constant

2008-10-15 Thread Craig Demyanovich
Probably, I would just check the outcome of the method instead of checking interaction with a constant. Craig ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] How to spec accessing a constant

2008-10-15 Thread Craig Demyanovich
On Wed, Oct 15, 2008 at 8:47 PM, Nick Hoffman <[EMAIL PROTECTED]> wrote: > On 2008-10-15, at 16:39, Craig Demyanovich wrote: > >> Probably, I would just check the outcome of the method instead of checking >> interaction with a constant. >> >> Craig >> >

Re: [rspec-users] How to spec accessing a constant

2008-10-16 Thread Craig Demyanovich
Cool. Having seen something a little more concrete, I like your design decisions. In this case, I'd go with Scott's recommendation of hiding the constant behind a method. Regards, Craig ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyfo

Re: [rspec-users] Specing protected methods

2008-10-23 Thread Craig Demyanovich
On Thu, Oct 23, 2008 at 7:49 AM, Bastien <[EMAIL PROTECTED]> wrote: > I m already specing the "generate_reports" methods with a mock on > "sub_total", but I would also like to spec that method. I've put this > method into protected because it doesn't make sens to call it from > outside this class.

Re: [rspec-users] How to spec a Rails helper method

2008-11-24 Thread Craig Demyanovich
Have a look at the change to no longer implicitly include modules: http://blog.davidchelimsky.net/articles/2008/05/29/rspec-waving-bye-bye-to-implicit-module-inclusion Regards, Craig ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforg

Re: [rspec-users] any eta on the rspec book?

2009-01-08 Thread Craig Demyanovich
Information on the book is always available here: http://pragprog.com/titles/achbd/the-rspec-book Currently, the ETA is April 2009. I'm sure that the authors will let us know if anything changes. Regards, Craig ___ rspec-users mailing list rspec-users@

Re: [rspec-users] specifying an HTTP status code

2007-12-02 Thread Craig Demyanovich
On Dec 1, 2007 5:19 PM, Scott Taylor <[EMAIL PROTECTED]> wrote: > > On Dec 1, 2007, at 5:10 PM, Jarkko Laine wrote: > > > On 1.12.2007, at 23.27, Scott Taylor wrote: > >> it "should return an HTTP status code of 404" do > >>get :view > >>response.headers["Status"].should == "404 Not Found

Re: [rspec-users] [rspec-devel] rspec_on_rails (trunk - r3070) works with Rails 2.0.1

2007-12-09 Thread Craig Demyanovich
On Dec 8, 2007 11:47 PM, James Deville <[EMAIL PROTECTED]> wrote: > I figured most of it out. The Spec::Rails stuff was something in the code > which has been fixed by revision 3099. The test methods partially make > sense. Since the test/unit code has been integrated, methods with test in > them

Re: [rspec-users] template.expect_render 'failure'

2008-02-08 Thread Craig Demyanovich
On Feb 8, 2008 10:23 AM, Kevin Barnes <[EMAIL PROTECTED]> wrote: > I'm at a loss at how to continue debugging the issue. Any suggestions? I threw this line in one of my view specs template.expect_render(:partial => "fail") and it failed as it should. If you can, please share your view spec.

Re: [rspec-users] Newbie: lambda do...end.should change(Model, :count).by(1). Doesn't work

2008-05-10 Thread Craig Demyanovich
A syntax note from the RSpec docs: "blocks passed to should change and should_not change must use the {} form (do/end is not supported)." http://rspec.info/rdoc/classes/Spec/Matchers.html#M000386 Regards, Craig ___ rspec-users mailing list rspec-users@r

Re: [rspec-users] Cookies - how to set in controller specs?

2008-07-02 Thread Craig Demyanovich
My pair and I struggled with this a little bit last week. We decided to just use a hash to represent cookies in specs, since that's how we're interacting with it. You can see the specs that we wrote here: http://pastie.org/226443 . Regards, Craig ___ rsp

Re: [rspec-users] Cookies - how to set in controller specs?

2008-07-02 Thread Craig Demyanovich
> I'm thinking of replacing the existing cookies() method (in the example) > with one that returns a CookieJarProxy that will allow you to do any of the > following: > > cookies['cookie_key'] = 'cookie value' > cookies[:cookie_key] = 'cookie value' > > cookies['cookie_key'].should == 'cookie value'

Re: [rspec-users] Not sure why this controller spec isn't working

2008-07-07 Thread Craig Demyanovich
I'm assuming RSpec 1.1.3+, but here's how I might write this example: describe NotesController do it "renders 'notes/new' when an empty note is submitted" do Note.stub!(:new).and_return(stub("note")) organization = stub_model(Organization, :notes => stub("notes", :<< => false)) assig

Re: [rspec-users] find_all_by returning nil

2008-08-11 Thread Craig Demyanovich
Looks like this line Product.stub(!find_all_by_category_id).with(anything()).and_return([product]) might be the culprit. It should be stub!(find... instead of stub(!find Regards, Craig ___ rspec-users mailing list rspec-users@rubyforge.org http://r