Re: [rspec-users] Testing methods that yields a block

2010-10-12 Thread Myron Marston
> class Cat >   class << self >      def start >            id = get_uuid >            begin >               yield if block_given? >            ensure >                set_some_other_state >            end >      end >    end >    #... > end In spite of the fact that you have an #id= method, `id =

Re: [rspec-users] Testing methods that yields a block

2010-10-12 Thread Chris Flipse
On Thu, Oct 7, 2010 at 10:24 AM, ignacy.moryc wrote: > I want to test a class method that sets some state and then yields a > block. It looks something like that: > > class Cat > class << self > def start > id = get_uuid > begin > yield if block_given? >

Re: [rspec-users] Testing methods that yields a block

2010-10-11 Thread David Chelimsky
On Thu, Oct 7, 2010 at 9:24 AM, ignacy.moryc wrote: > I want to test a class method that sets some state and then yields a > block. It looks something like that: > > class Cat >  class << self >     def start >           id = get_uuid >           begin >              yield if block_given? >      

[rspec-users] Testing methods that yields a block

2010-10-11 Thread ignacy.moryc
I want to test a class method that sets some state and then yields a block. It looks something like that: class Cat class << self def start id = get_uuid begin yield if block_given? ensure set_some_other_state end