Re: [rspec-users] Need immeadiate help

2009-09-30 Thread Jarkko Laine
On 30.9.2009, at 14.37, Mithun Perera wrote: thanks Matt Any other tutorial because i go through it. but no idea. cheers, http://lmgtfy.com/?q=rspec+introduction+tutorial //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi

Re: [rspec-users] Merb

2008-10-21 Thread Jarkko Laine
. There's probably a lot of optimization left to do with the specs but I find the dispatch helpers pretty cool for building more specialized methods such as do_post. I hope the merb folks will keep us outside-(s)inners in mind and not scrap the API. Cheers, //jarkko -- Jarkko Laine http

Re: [rspec-users] Any good conferences this year about ruby/rspec/watir?

2008-10-16 Thread Jarkko Laine
://rapidstraining.fi/ ;-) //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic signature ___ rspec-users mailing list rspec-users@rubyforge.org

Re: [rspec-users] How to define request.domain in when testing

2008-09-24 Thread Jarkko Laine
environment: ActionController::Base.default_url_options.update :host = 'mysite.com' //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi ___ rspec-users mailing list rspec-users

Re: [rspec-users] How to define request.domain in when testing

2008-09-24 Thread Jarkko Laine
= development_url.com } Not sure if it works the same way with ActionController, though. You can of course set the request host by hand in a setup method: @request.host = host //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi

Re: [rspec-users] workflow: user = stories/features = spec = code = user

2008-09-19 Thread Jarkko Laine
of the TDD cycle here. It generally happens between every layer after the specs pass. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi ___ rspec-users mailing list rspec-users

Re: [rspec-users] Best practices for sharing state between story steps?

2008-09-09 Thread Jarkko Laine
beyond the point here... //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] webrat question, form without buttons

2008-09-03 Thread Jarkko Laine
-- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Does RSpec work nicely with UUID primary keys?

2008-07-05 Thread Jarkko Laine
that (especially if/when they mock the models) it won't trip the scaffolding specs per se. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic signature

Re: [rspec-users] Mocking Models in Controller Specs...

2008-05-27 Thread Jarkko Laine
/mailman/listinfo/rspec-users -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic signature ___ rspec-users mailing list rspec-users@rubyforge.org http

Re: [rspec-users] mock_model not stubbing model attribtues in view spec

2008-05-20 Thread Jarkko Laine
://www.patchspace.co.uk/ http://aviewfromafar.net/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi

Re: [rspec-users] Everyone Using Rspec Autotest?

2008-05-03 Thread Jarkko Laine
? I'm just using the one that comes with ZenTest. No need for anything else, just run 'autotest' in the root of your Rails app. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic

Re: [rspec-users] Rspecing this simple controller it is driving me mad...

2008-04-13 Thread Jarkko Laine
test that @comment.author.should be(@user) because you have stubbed author= and it doesn't really do anything. So you just have to rely on that it works (like you should since it's Rails code which you shouldn't really be testing). //jarkko -- Jarkko Laine http://jlaine.net http

Re: [rspec-users] how to stub the :current_user and any methods associated with it

2008-04-13 Thread Jarkko Laine
do it should show all the current entries for the user do get :index assigns[:entries].should == @entries end I don't see you logging in a user anywhere. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s

Re: [rspec-users] how to stub the :current_user and any methods associated with it

2008-04-11 Thread Jarkko Laine
PROTECTED]://rubyforge.org/mailman/listinfo/rspec-users ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http

Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-09 Thread Jarkko Laine
.. That's why you consider controller.send(current_user=,..) a bit hacky right? Yes. Just create a given that goes through the normal logging process. You can parameterize it so that you can reuse it with different roles. //jarkko -- Jarkko Laine http://jlaine.net http

Re: [rspec-users] how to mock/stub restful_authenticated and acl2-ized act

2008-04-08 Thread Jarkko Laine
/listinfo/rspec-users -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic signature ___ rspec-users mailing list rspec-users@rubyforge.org http

Re: [rspec-users] Rspecing this simple controller it is driving me mad...

2008-04-08 Thread Jarkko Laine
correctly tests the behaviour, whereas the latter checks the actual implementation, which in this case is superfluous. I hardly ever use should_receive with a setter method such as author=, but it might just be me. Cheers, //jarkko --- Jarkko Laine [EMAIL PROTECTED] ha scritto

Re: [rspec-users] Testing helper methods in rspec

2008-03-12 Thread Jarkko Laine
ApplicationHelper do describe keycase do describe when no dots do before(:each) do @value = IBM end it should convert to lowercase do keycase(@value).should == Ibm end end end end And so on. //jarkko -- Jarkko Laine http://jlaine.net http://odesign.fi

Re: [rspec-users] Story testing views in isolation

2008-03-11 Thread Jarkko Laine
. //jarkko -- Jarkko Laine http://jlaine.net http://odesign.fi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Webrat integration with Rspec and Rake tasks

2008-02-23 Thread Jarkko Laine
terminal for normal specs. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic signature ___ rspec-users mailing list rspec-users

Re: [rspec-users] spec_server requiring absolute paths (and autotest breaking)

2008-02-20 Thread Jarkko Laine
On 21.2.2008, at 4.14, Scott Taylor wrote: On Feb 20, 2008, at 1:52 AM, Jarkko Laine wrote: On 20.2.2008, at 6.55, Scott Taylor wrote: That said, now that autotest runs via drb, it's vastly (like 50%) slower than without it, That's the idea. Isn't the idea that specs run faster through

Re: [rspec-users] spec_server requiring absolute paths (and autotest breaking)

2008-02-19 Thread Jarkko Laine
: [Barney Hops doesn't have the required competency (MBA) to teach this class, Barney Hops doesn't have the required competency (MBA) to teach this class] Mock 'Enrollment' expected :on_waiting_list? with (any args) twice, but received it 3 times //jarkko -- Jarkko Laine http://jlaine.net http

[rspec-users] spec_server requiring absolute paths (and autotest breaking)

2008-02-19 Thread Jarkko Laine
. Cheers, //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic signature ___ rspec-users mailing list rspec-users@rubyforge.org http

Re: [rspec-users] spec_server requiring absolute paths (and autotest breaking)

2008-02-19 Thread Jarkko Laine
drb at all since it runs the same whether or not the spec_server is running. Yeah, I know that was the reason for the patch. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic

Re: [rspec-users] spec_server requiring absolute paths (and autotest breaking)

2008-02-19 Thread Jarkko Laine
:-) Cheers, //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic signature ___ rspec-users mailing list rspec-users@rubyforge.org http

Re: [rspec-users] Webrat integration with Rspec and Rake tasks

2008-02-19 Thread Jarkko Laine
some of the early posts about stories). //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic signature ___ rspec-users mailing list rspec

Re: [rspec-users] deep test with rspec?

2008-02-19 Thread Jarkko Laine
___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi smime.p7s Description: S/MIME cryptographic signature

Re: [rspec-users] Example controller spec no worky?

2008-02-13 Thread Jarkko Laine
On 13.2.2008, at 21.09, Brad Carson [EMAIL PROTECTED] wrote: Pat Maddox wrote: Try Event.stub!(:find).and_raise(RecordNotFound) To my credit, I did try that (though ActiveRecord::RecordNotFound, of course) but then I get: EventsController attempt to show non-existing event - should

Re: [rspec-users] Rspec accessing the wrong id?

2008-02-07 Thread Jarkko Laine
-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi ___ rspec-users mailing list rspec-users

Re: [rspec-users] Can you explain this code to me?

2008-02-07 Thread Jarkko Laine
@creating_user.should change(User, :count).by(1) end end Thanks for any pointers or clarifications! Same thing, just this time the function is first stored in an instance variable. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com

Re: [rspec-users] RESTful Routes

2008-02-04 Thread Jarkko Laine
that the route is working, it would imho belong to the controller specs, not to the stories. Cheers, //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi ___ rspec-users mailing list rspec-users

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Jarkko Laine
Often I also stub the errors method there because it's called pretty often in controllers and views. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi ___ rspec-users mailing list

Re: [rspec-users] Not seeing the failure

2008-01-23 Thread Jarkko Laine
(and it doesn't and shouldn't): You can do it like this: @coupon = mock_model(Coupon, :user= = nil, :user = @current_user, :save = true) Note both :user= and :user. In your pastie you only have :user Cheers, //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http

Re: [rspec-users] specs on private methods

2008-01-11 Thread Jarkko Laine
On Jan 11, 2008, at 5:54 PM, Ben Mabey [EMAIL PROTECTED] wrote: David Chelimsky wrote: In TDD there is a rule of thumb that says don't stub a method in the same class as the method you're testing. The risk is that as the real implementation of by_input_sets!() changes over time, it has

Re: [rspec-users] specs on private methods

2008-01-10 Thread Jarkko Laine
like it should be an instance method anymore. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman

Re: [rspec-users] params not available for controller specs?

2007-12-04 Thread Jarkko Laine
speccing the controller behaviour here, not business logic. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi ___ rspec-users mailing list rspec-users@rubyforge.org http

Re: [rspec-users] params not available for controller specs?

2007-12-04 Thread Jarkko Laine
broken spec is fixed, and the code works as expected. Tada! No need to stub String#split anywhere. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi ___ rspec-users mailing list

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Jarkko Laine
:index end It is then the responsibility of the articles association to scope the results. In the controller specs you just trust that it works. -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi

Re: [rspec-users] spec for model_id should eql

2007-12-03 Thread Jarkko Laine
On 3.12.2007, at 21.05, Nathan Sutton wrote: Department.stub!(:find_by_code).with(75).and_return(3) You can't use with() with stub! (only with should_receive), so just leave it away: Department.stub!(:find_by_code).and_return(3) //jarkko -- Jarkko Laine http://jlaine.net http

Re: [rspec-users] Need help mocking this out

2007-12-03 Thread Jarkko Laine
On 4.12.2007, at 8.40, Fischer, Daniel wrote: Sorry for so many messages, I hope I don't get in trouble for this. Maybe IRC would be better if there was a RSpec one. #rspec @freenode //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http

Re: [rspec-users] Stories and Pending Actions

2007-11-21 Thread Jarkko Laine
On 20.11.2007, at 10.08, Nathan Sutton wrote: Didn't have time tonight, stand-by for something tomorrow. Done: http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/132- plain-text-stories-should-support-given-and-given -- Jarkko Laine http://jlaine.net http://dotherightthing.com http

[rspec-users] Testing transactional updates in story runner

2007-11-21 Thread Jarkko Laine
? Cheers, //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] confirming that a model instance was correctly created from POST params

2007-11-20 Thread Jarkko Laine
than just the one, you start finding patterns there and you can easily refactor the stubbing into spec helpers so that you only need a line or two to create a comprehensive mock model in your specs. HTH, //jarkko P.S. in Ruby true and false are normally written in lower case. -- Jarkko Laine

Re: [rspec-users] How to represent Story of Life grid in Then clause

2007-11-20 Thread Jarkko Laine
/5645/ tickets/132-plain-text-stories-should-support-given-and-given). However, multiline parameters aren't supported in plain text story steps yet, either. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi

Re: [rspec-users] How to test views with Nested Resources and Partials

2007-11-20 Thread Jarkko Laine
) contract_line_item_path (and _url) expects two parameters, contract and line item (or their ids). The errors the routing code outputs are often pretty cryptic. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi

Re: [rspec-users] Spec slowdown

2007-11-14 Thread Jarkko Laine
On 13.11.2007, at 19.21, David Chelimsky wrote: On Nov 13, 2007 10:52 AM, Jarkko Laine [EMAIL PROTECTED] wrote: Is there something currently going on on the rspec trunk that causes a massive slowdown when running rake spec and autotest (without spec_server)? I updated to the latest trunk

[rspec-users] Spec slowdown

2007-11-13 Thread Jarkko Laine
thing is that if I run the rake spec tasks separately (controllers, models, views, helpers), they still take about 20 seconds in total: http://pastie.caboo.se/117362 //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi

Re: [rspec-users] Examples of writing controller specs that use authentication

2007-10-27 Thread Jarkko Laine
]) controller.send :current_user=, user end Then you can just say this in the specs: login_as(@user_mock_object) and the controller will behave accordingly (assuming you use restful_authentication/acts_as_authenticated). //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http

Re: [rspec-users] Story Runner, autoincrementing

2007-09-23 Thread Jarkko Laine
, :name = name, :description = Everything from the latest gossip to the coolest youtube videos.) forum end How do I stop the incrementing? -- -- Jarkko Laine http://jlaine.net http://odesign.fi ___ rspec-users mailing list rspec-users

Re: [rspec-users] Failing to raise an exception in a stub

2007-09-14 Thread Jarkko Laine
On 13.9.2007, at 23.29, aslak hellesoy wrote: On 9/13/07, Jarkko Laine [EMAIL PROTECTED] wrote: I've come across rather strange behaviour when trying to raise an exception in a stubbed method. I'm speccing the behaviour of a Rails create action, where I'm using save! to catch failed saves

Re: [rspec-users] Philosophical questions

2007-09-14 Thread Jarkko Laine
-to-end stuff. Even on an app running on Rails 1.2, the rspec trunk installed flawlessly with some minimal changes to the existing spec code. From what I learned, Story Runner is already highly usable even though it's not officially out. //jarkko -- Jarkko Laine http://jlaine.net http

Re: [rspec-users] Testing a nested controller

2007-09-14 Thread Jarkko Laine
to identify the controller. I think the former way is now considered best practice. If you want to test routes, do it separately. IIRC generating an rspec_scaffold will create you examples of how to do that. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http

[rspec-users] Failing to raise an exception in a stub

2007-09-13 Thread Jarkko Laine
shouldn't assume any args. Moreover, both cases work fine in the real app, so it seems to me something funky is happening when stubbing the method. Anyone else stumbled upon anything similar? Cheers, //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http

Re: [rspec-users] Authenticating before tests

2007-09-13 Thread Jarkko Laine
On 13.9.2007, at 19.52, sinclair bain wrote: Hi! Have you considered mocking / stubbing to test in isolation if that is appropriate ? Right, my example was also assuming that you are using mocks for users. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http