Re: [rspec-users] newbie first run question

2008-03-26 Thread Max Williams
I had a similar problem with rake: try ruby script/spec On 25/03/2008, Eric Harris-Braun <[EMAIL PROTECTED]> wrote: > > Hi folks, > > RSpec 1.1.3 is failing for me out of the box. I installed both rspec > and rspec_on_rails using svn following the instructions on the site. > Then I used the rsp

Re: [rspec-users] rspec groups?

2008-03-21 Thread Max Williams
> Are you sure you are running the outer-most group, and not an inner > group or example? I just tried this file as test.spec.rb: >describe "add_descendants_from_xml" do > it "should add descendants" do >true.should be_false > end > > describe "with attributes" do >

Re: [rspec-users] rspec groups?

2008-03-20 Thread Max Williams
Edvard Majakari wrote: > On Wed, Mar 19, 2008 at 1:12 AM, Ashley Moran > <[EMAIL PROTECTED]> wrote: > >> > sufficient to me, but of course, YNMDFTOM. > >> Please put me out of my misery and explain the acronym :D > > My bad. My favorite hobby is to invent new acronyms on the fly, of > which th

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] [Stories] Login and subdomain

2008-03-07 Thread Max Williams
I found it a little confusing to stub my authentication filters as well, but figured it out with a little help from the interwebs: in spec_helper i have this: describe "a controller requiring login", :shared => true do it "should have login_required set in the before filter" do contro

Re: [rspec-users] [Stories] Login and subdomain

2008-03-07 Thread Max Williams
Oh, sorry, and this line in your specs to actually mock the filter: mock_login_required :) On 07/03/2008, Max Williams <[EMAIL PROTECTED]> wrote: > > I found it a little confusing to stub my authentication filters as well, > but figured it out with a little help from the in

Re: [rspec-users] has_many_polymorphs is breaking my spec file

2008-03-05 Thread Max Williams
no, just the ruby forum. I'll try the rails list next. thanks On 05/03/2008, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On Wed, Mar 5, 2008 at 7:53 AM, Max Williams > > <[EMAIL PROTECTED]> wrote: > > > Hmm, the results are exactly the same, down to th

Re: [rspec-users] has_many_polymorphs is breaking my spec file

2008-03-05 Thread Max Williams
ests don't like. :( On 05/03/2008, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On Wed, Mar 5, 2008 at 4:40 AM, Max Williams > <[EMAIL PROTECTED]> wrote: > > Hey folks > > > > I have a bunch of classes that are polymorphs, with has_many_polymorph

[rspec-users] has_many_polymorphs is breaking my spec file

2008-03-05 Thread Max Williams
Hey folks I have a bunch of classes that are polymorphs, with has_many_polymorphs (they are all 'labellable', which is similar to being 'taggable' in the acts_as_taggable scheme). I have a couple of modules, LabellableInstanceMethods and LabellableClassMethods in a file called labellable_methods.

Re: [rspec-users] has_many_polymorphs is breaking my testing

2008-02-27 Thread Max Williams
Never mind, i'm an idiot, the problem was that i broke my Property class with the has_many_polymorphs declaration, so the spec couldn't load it. Sorry! On 27/02/2008, Max Williams <[EMAIL PROTECTED]> wrote: > > I have a class Property that was testing fine until i added

[rspec-users] has_many_polymorphs is breaking my testing

2008-02-27 Thread Max Williams
I have a class Property that was testing fine until i added the following to it: has_many_polymorphs :labelled, :from => [:instructional_objects, :lessons, :courses], :through => :labels, :dependent => :destroy (in other words, 'labels' is a join table through which various objects

Re: [rspec-users] Test data problem (in general and with acts_as_tree)

2008-02-26 Thread Max Williams
hehe, tbh even if the documentation had been there i probably wouldn't have read it :) thanks! On 26/02/2008, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On Tue, Feb 26, 2008 at 8:08 AM, Max Williams > > <[EMAIL PROTECTED]> wrote: > > > > >

Re: [rspec-users] Test data problem (in general and with acts_as_tree)

2008-02-26 Thread Max Williams
On 26/02/2008, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On Tue, Feb 26, 2008 at 7:39 AM, Max Williams > <[EMAIL PROTECTED]> wrote: > > > This does not happen for you implicitly when you use before(:all) > because there is no mechanism for running a group of

Re: [rspec-users] Test data problem (in general and with acts_as_tree)

2008-02-26 Thread Max Williams
I'm using before(:all) because i want to create a single 'family' of tree objects and then run tests against it. If i have all the object creation as a before(:each) then the database will be even more full of duplications, won't it? My problem, though, is that the data is left over from the last

[rspec-users] Test data problem (in general and with acts_as_tree)

2008-02-26 Thread Max Williams
Hi all I'm having problems with data in my specs - i'm probably just going about things the wrong way though. I'm testing a model (called Property) that uses acts_as_tree, and for now have just done some specs for the basic acts_as_tree functionality - just as a sanity check, i thought, but i'm g

Re: [rspec-users] Testing misc methods in ApplicationController

2008-02-22 Thread Max Williams
doh...dammit, i thought i'd tried that. I'm losing it... thanks! On 22/02/2008, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On Fri, Feb 22, 2008 at 7:26 AM, Max Williams > <[EMAIL PROTECTED]> wrote: > > I'm already successfully testing before_filter

[rspec-users] Testing misc methods in ApplicationController

2008-02-22 Thread Max Williams
I'm already successfully testing before_filters in application_controller courtesy of this blog post: http://www.movesonrails.com/articles/2008/01/23/spec-ing-your-application-controller However, i can;'t work out how to test the sort of method that is added to application_controller so that all c

Re: [rspec-users] Unwanted fixture data messing up my other tests

2008-02-21 Thread Max Williams
er?(allow_user_to_pass=true) controller.stub!(:admin_user?).and_return(allow_user_to_pass) end def mock_current_user(id = 1) @user = mock_model(User, :to_param => id.to_s, :id => 1) controller.stub!(:current_user).and_return(@user) end end <<<<<<<<&l

[rspec-users] Unwanted fixture data messing up my other tests

2008-02-21 Thread Max Williams
I have a fixture for one of my tables that i use in some model tests. The data in it is messing up some other tests for a different model, that doesn't ask for the fixture - isn't the fixture data supposed to be cleared out of the test db in between tests, and only be present if specifically asked

Re: [rspec-users] Problem with testing for an exception from a controller method

2008-02-18 Thread Max Williams
t; It depends on a few things. > > Max - what versions of rspec and rails are you using? > > > > > > > > On Feb 18, 2008 8:29 AM, Max Williams <[EMAIL PROTECTED]> > wrote: > > > > > > > > > > > > > > I have a User cont

Re: [rspec-users] Problem with testing for an exception from a controller method

2008-02-18 Thread Max Williams
great minds :) thanks guys! On 18/02/2008, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On Feb 18, 2008 8:43 AM, Max Williams <[EMAIL PROTECTED]> wrote: > > ah yes of course :) > > > > So, now, "should_not be_success" passes ok, but should i b

Re: [rspec-users] Problem with testing for an exception from a controller method

2008-02-18 Thread Max Williams
PROTECTED]> wrote: > > Won't the exception get turned into a http return code from the get? > > On Feb 18, 2008 8:29 AM, Max Williams <[EMAIL PROTECTED]> wrote: > > > I have a User controller where users aren't added with the usual > > new/create actions. I'

[rspec-users] Problem with testing for an exception from a controller method

2008-02-18 Thread Max Williams
I have a User controller where users aren't added with the usual new/create actions. I'm trying to set it so that it raises when 'new' is called but it doesn't seem to be working - here's the method, test and test result. Can anyone see why it's not working? #in controller def new raise "Us

Re: [rspec-users] params are making my "should redirect_to" test fail - why??

2008-02-14 Thread Max Williams
Done, thanks everyone. On 14/02/2008, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On Thu, Feb 14, 2008 at 10:16 AM, Max Williams > > <[EMAIL PROTECTED]> wrote: > > > I'm new to rspec (and coding in general) but would it break a lot of > > people'

Re: [rspec-users] params are making my "should redirect_to" test fail - why??

2008-02-14 Thread Max Williams
I'm new to rspec (and coding in general) but would it break a lot of people's tests if redirect_to was changed to do this by default? It's what i expected it to do, personally, that is to pass if the given :action and :controller match up. If i pass a url string, and it's missing the params, then

Re: [rspec-users] params are making my "should redirect_to" test fail - why??

2008-02-14 Thread Max Williams
perfect - that's the method i was looking for. Thanks! On 14/02/2008, Rick DeNatale <[EMAIL PROTECTED]> wrote: > > On 2/14/08, Max Williams <[EMAIL PROTECTED]> wrote: > > Hi David - thanks for replying. The literal doesn't work either, > because of >

Re: [rspec-users] params are making my "should redirect_to" test fail - why??

2008-02-14 Thread Max Williams
s private. thanks max On 13/02/2008, David Chelimsky <[EMAIL PROTECTED]> wrote: > > On Feb 13, 2008 12:26 PM, Max Williams <[EMAIL PROTECTED]> > wrote: > > > > I'm testing a controller action that redirects to a different > action/view, > > sending throu

Re: [rspec-users] How do I mock out the before :login_required method?

2008-02-13 Thread Max Williams
I'm having a similar problem - my application controller has the UserSystem module included, and that's where the login_required method lives. In a spec for another controller, which has before_filter :login_required, i'm trying to stub the login_required method to just return true, but i think m

[rspec-users] params are making my "should redirect_to" test fail - why??

2008-02-13 Thread Max Williams
I'm testing a controller action that redirects to a different action/view, sending through some params. In my test, i'm only specifying the controller and action that it should redirect to, but the additional params are making it fail! Here's my test: it "should redirect to batch_saved after