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] 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] 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] 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] 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] Accessing the model class from within an rspec-rails spec

2008-10-29 Thread Cameron Booth
s group know. Cheers! Cameron > Message: 6 > Date: Wed, 29 Oct 2008 01:40:08 -0400 > From: Scott Taylor <[EMAIL PROTECTED]> > Subject: Re: [rspec-users] Accessing the model class from within an >rspec-rails spec > To: rspec-users > Message-ID: <[EMAIL PROT

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] 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] 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] 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] Accessing the model class from within an rspec-rails spec

2008-10-28 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 stuff