Introducing the "it" keyword

On May 25, 2:40 am, Brad P. [email protected] wrote:

end

it “should score 0 for gutter game” do
20.times { @bowling.hit(0) }
@bowling.score.should == 0
end
end


Brad P.http://xtargets.com

When I first heard about the change from context/specify to describe/
it, I thought it was completely bone-headed. A quick glance at an
example changed my mind, but I still don’t feel good about ‘it’.
Considering the number of specifications that will start with
‘should’, why not use — oh I don’t know, ‘should’?

describe Bowling do
before(:each) do
@bowling = Bowling.new
end

should “score 0 for gutter game” do
20.times { @bowling.hit(0) }
@bowling.score.should == 0
end
end

On 4 Jun 2007, at 15:50, Robert K. wrote:

puts length
end

same as

“foo”.instance_eval do
puts length
end

I must admit that until this thread it had never occurred to me to
use instance_eval for this, even though it’s bloody obvious the
moment you see it written down. I’ll probably roll it into a
framework I’m currently working on and see how it compares to its VB
prototype: it is the one statement I miss from that particular
language as it saves so much unnecessary typing and some runtime
overhead (classic VB’s object model being built on top of COM, the
cost of runtime method lookup on deeply nested objects can be
prohibitive on older hardware).

PS: Thanks for teaching me another British(?) English idiom -
hadn’t known “by dint of” so far. :slight_smile:

Seems like a fair exchange for the new Ruby idiom :slight_smile:

Ellie

Eleanor McHugh
Games With Brains

raise ArgumentError unless @reality.responds_to? :reason

On 5/25/07, Brad P. [email protected] wrote:

Hasn’t ‘it’ effectively been reserved as a keyword by the RSpec team

That shouldn’t be a reason to prevent the addition of a keyword, if
it’s suitable.

-austin, still not convinced that RSpec is useful