Re: [rspec-users] specs on private methods

2008-01-08 Thread Francois Wurmus
obj.send(:method) will work for non-private methods and send! works for private methods. additionally there is send() without a receiving object. that is the only of those methods requiring two parameters. Chris Olsen schrieb: > Will obj.send(:method) work in 1.9 or is it saying that the send

Re: [rspec-users] specs on private methods

2008-01-08 Thread David Chelimsky
On Jan 8, 2008 1:25 PM, Matt Patterson <[EMAIL PROTECTED]> wrote: > On 8 Jan 2008, at 19:14, Daniel Tenner wrote: > > > > Might be a personal thing, but my approach is that I try to test the > > public behaviour of the object. Testing private methods is, imho, > > getting dangerously close to speci

Re: [rspec-users] specs on private methods

2008-01-08 Thread Francois Wurmus
The send call never expects an object reference as a parameter. Either it is called on an object or without an object context (i.e. kernel). In the first case the parameter should contain one of the receiving object's methods. In the second case the parameter is a kernel method. But... that's n

Re: [rspec-users] specs on private methods

2008-01-08 Thread David Chelimsky
On Jan 8, 2008 2:47 PM, Chris Olsen <[EMAIL PROTECTED]> wrote: > Will obj.send(:method) work in 1.9 or is it saying that the send call > requires 2 params, the method and the object reference? In 1.9 you can say obj.send!(:method) even if :method is private. obj.send(:method) will not work for pri

Re: [rspec-users] specs on private methods

2008-01-08 Thread Chris Olsen
Will obj.send(:method) work in 1.9 or is it saying that the send call requires 2 params, the method and the object reference? -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman

Re: [rspec-users] specs on private methods

2008-01-08 Thread Tim Harper
Well there we go, Ben's method still stands :) Tim On Jan 8, 2008, at 12:36 PM, Ben Mabey wrote: > Yes. http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l24 > > Tim Harper wrote: >> Doesn't 1.9 allow you to call obj.send!, which will allow you to >> access private methods? >> >> Tim >> >> On Ja

Re: [rspec-users] specs on private methods

2008-01-08 Thread Ben Mabey
Yes. http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l24 Tim Harper wrote: > Doesn't 1.9 allow you to call obj.send!, which will allow you to > access private methods? > > Tim > > On Jan 8, 2008, at 12:27 PM, Scott Taylor wrote: > > >> On Jan 8, 2008, at 2:20 PM, Ben Mabey wrote: >> >> >

Re: [rspec-users] specs on private methods

2008-01-08 Thread Tim Harper
Doesn't 1.9 allow you to call obj.send!, which will allow you to access private methods? Tim On Jan 8, 2008, at 12:27 PM, Scott Taylor wrote: > > On Jan 8, 2008, at 2:20 PM, Ben Mabey wrote: > >> Chris Olsen wrote: >>> How does a person test private methods? >>> >>> Is there a way to declare t

Re: [rspec-users] specs on private methods

2008-01-08 Thread Scott Taylor
On Jan 8, 2008, at 2:20 PM, Ben Mabey wrote: > Chris Olsen wrote: >> How does a person test private methods? >> >> Is there a way to declare them as private, but retain any tests that >> were written during the initial development? >> >> Thanks. >> > When I need to do this I just use the send met

Re: [rspec-users] specs on private methods

2008-01-08 Thread Matt Patterson
On 8 Jan 2008, at 19:14, Daniel Tenner wrote: > Might be a personal thing, but my approach is that I try to test the > public behaviour of the object. Testing private methods is, imho, > getting dangerously close to specifying how the object does its > business, rather than what it does. > If yo

Re: [rspec-users] specs on private methods

2008-01-08 Thread Ben Mabey
Chris Olsen wrote: > How does a person test private methods? > > Is there a way to declare them as private, but retain any tests that > were written during the initial development? > > Thanks. > When I need to do this I just use the send method. -Ben

Re: [rspec-users] specs on private methods

2008-01-08 Thread Daniel Tenner
Might be a personal thing, but my approach is that I try to test the public behaviour of the object. Testing private methods is, imho, getting dangerously close to specifying how the object does its business, rather than what it does. I would just spec the externally visible behaviour, where

Re: [rspec-users] specs on private methods

2008-01-08 Thread Matt Patterson
On 8 Jan 2008, at 18:39, Chris Olsen wrote: > How does a person test private methods? > > Is there a way to declare them as private, but retain any tests that > were written during the initial development? I'm rather liking Jay Field's approach (described at http:// blog.jayfields.com/2007/11/ru

Re: [rspec-users] Problems with rspec 1.1 required inside rake tasks

2008-01-08 Thread Matt Patterson
On 8 Jan 2008, at 17:01, Bryan Liles wrote: >> Is there a better way to require rspec (this worked fine in 1.0.8 and >> recent trunks), or should I be filing a bug? >> > I think it is some weird bug, and the solution that I am using until > it is resolved is to do this add this to my rake task. >

[rspec-users] specs on private methods

2008-01-08 Thread Chris Olsen
How does a person test private methods? Is there a way to declare them as private, but retain any tests that were written during the initial development? Thanks. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyfor

Re: [rspec-users] Problems with rspec 1.1 required inside rake tasks

2008-01-08 Thread Bryan Liles
On Jan 8, 2008, at 10:55 AM, Matt Patterson wrote: > > > When you invoke rake to do something, say check_manifest > > >> rake check_manifest >> > > You wind up with a Runtime error, as follows: > > >> /usr/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/runner/ >> options.rb:216:in `files_to_loa

[rspec-users] Problems with rspec 1.1 required inside rake tasks

2008-01-08 Thread Matt Patterson
This is interesting. The default rspec rake tasks generated by Hoe give you an rspec.rake file that looks like: > begin > require 'spec' > rescue LoadError > require 'rubygems' > require 'spec' > end > So far so good. When you invoke rake to do something, say check_manifest > rake ch