[Rspec-users] RSpec style in Scriptaculous' unittest.js

Jason Anderson thenewjhp at gmail.com
Mon Sep 4 04:47:11 EDT 2006


All,

I can't help noticing a bit of code that I keep repeating.

I find myself writing things like:

specify "should be empty" do
  @stack.should_be_empty
end

Instead, suppose rspec captured and stored the result of setup() and
used that value automatically if specify() is called without a block?
Here's how it might look, using the example from the rspec page:

context "BDD framework" do

 setup do
   BddFramework.new  # value stored by rspec
 end

 specify "should be adopted quickly"
 specify "should be intuitive"

end

Lovely, no?


Best,

Jason Anderson
thenewjhp at gmail.com


More information about the Rspec-users mailing list