On Sat, Mar 17, 2012 at 7:52 PM, Justin Ko wrote:
>
> On Mar 17, 2012, at 3:51 PM, Myron Marston wrote:
>
>> I've been thinking about this a bit ever since Zach Dennis brought up
>> the issue on another rspec-expectations ticket [1]. I've come up with
>> a proof-of-concept matcher that works prett
On Mar 17, 2012, at 3:51 PM, Myron Marston wrote:
> I've been thinking about this a bit ever since Zach Dennis brought up
> the issue on another rspec-expectations ticket [1]. I've come up with
> a proof-of-concept matcher that works pretty well, I think [2].
> Here's how you use it:
>
> expect
I've been thinking about this a bit ever since Zach Dennis brought up
the issue on another rspec-expectations ticket [1]. I've come up with
a proof-of-concept matcher that works pretty well, I think [2].
Here's how you use it:
expect { |b| 3.tap(&b) }.to yield_value(3)
The argument passed to the
&:self won't work because self isn't an instance method on the object, eg.
some_object.self won't work either.
If you wan't something cleaner couldn't you use this method in spec_helper.rb ?
def block_yield(object, method)
object.send(method) { yield if block_given? }
end
Then:
block_yield(t
On 7 Mar 2012, at 18:26, Zach Dennis wrote:
> Matt,
>
> I have typically done what you are already doing, but I am also
> interested in the answer you seek. Another idea might be something
> like since #do-stuff would need to be invoked with a block:
>
> expect(thing, :do_stuff).to_yield val
On Wed, Mar 7, 2012 at 2:32 PM, Matt Wynne wrote:
>
> On 7 Mar 2012, at 18:16, David Chelimsky wrote:
>
> On Wed, Mar 7, 2012 at 11:56 AM, Matt Wynne wrote:
>
>
> On 7 Mar 2012, at 11:39, Morten Møller Riis wrote:
>
>
> On Mar 7, 2012, at 8:22 AM, Matt Wynne wrote:
>
>
>
> Hi all,
>
>
> I'm spec'
On 7 Mar 2012, at 18:16, David Chelimsky wrote:
> On Wed, Mar 7, 2012 at 11:56 AM, Matt Wynne wrote:
>>
>> On 7 Mar 2012, at 11:39, Morten Møller Riis wrote:
>>
>> On Mar 7, 2012, at 8:22 AM, Matt Wynne wrote:
>>
>>
>> Hi all,
>>
>> I'm spec'ing a method that yields a value. Right now, I sp
Matt,
I have typically done what you are already doing, but I am also
interested in the answer you seek. Another idea might be something
like since #do-stuff would need to be invoked with a block:
expect(thing, :do_stuff).to_yield val
Zach
On Wed, Mar 7, 2012 at 12:56 PM, Matt Wynne wrote:
On Wed, Mar 7, 2012 at 11:56 AM, Matt Wynne wrote:
>
> On 7 Mar 2012, at 11:39, Morten Møller Riis wrote:
>
> On Mar 7, 2012, at 8:22 AM, Matt Wynne wrote:
>
>
> Hi all,
>
> I'm spec'ing a method that yields a value. Right now, I spec it like this:
>
> result = nil
> thing.do_stuff { |valu
On Wed, Mar 7, 2012 at 11:53 AM, Matt Wynne wrote:
>
> On 7 Mar 2012, at 15:12, Ken Chien wrote:
>
> Hi Matt,
> On Wed, Mar 7, 2012 at 2:22 AM, Matt Wynne wrote:
>>
>> Hi all,
>>
>> I'm spec'ing a method that yields a value. Right now, I spec it like this:
>>
>> result = nil
>> thing.do_s
On 7 Mar 2012, at 15:12, Ken Chien wrote:
> Hi Matt,
> On Wed, Mar 7, 2012 at 2:22 AM, Matt Wynne wrote:
> Hi all,
>
> I'm spec'ing a method that yields a value. Right now, I spec it like this:
>
> result = nil
> thing.do_stuff { |value| result = value }
> result.should == expecte
On 7 Mar 2012, at 11:39, Morten Møller Riis wrote:
> On Mar 7, 2012, at 8:22 AM, Matt Wynne wrote:
>
>> Hi all,
>>
>> I'm spec'ing a method that yields a value. Right now, I spec it like this:
>>
>> result = nil
>> thing.do_stuff { |value| result = value }
>> result.should == expec
Hi Matt,
On Wed, Mar 7, 2012 at 2:22 AM, Matt Wynne wrote:
> Hi all,
>
> I'm spec'ing a method that yields a value. Right now, I spec it like this:
>
> result = nil
> thing.do_stuff { |value| result = value }
> result.should == expected
>
> This feels like too much ceremony. What I wa
How about this?
thing.do_stuff(&:to_s).should == expected
Best regards
Morten Møller Riis
On Mar 7, 2012, at 8:22 AM, Matt Wynne wrote:
> Hi all,
>
> I'm spec'ing a method that yields a value. Right now, I spec it like this:
>
> result = nil
> thing.do_stuff { |value| result = valu
Hi all,
I'm spec'ing a method that yields a value. Right now, I spec it like this:
result = nil
thing.do_stuff { |value| result = value }
result.should == expected
This feels like too much ceremony. What I want to do is something more this:
thing.do_stuff.should yield_value(expec
15 matches
Mail list logo