[rspec-users] Merb

David Chelimsky dchelimsky at gmail.com
Sun Oct 19 16:43:03 EDT 2008


On Sun, Oct 19, 2008 at 2:36 PM, Ashley Moran
<ashley.moran at patchspace.co.uk> wrote:
> Hi
>
> Two questions:
>
> Anyone using Merb here, and writing specs for it?  (I've just started
> tonight, so I'm figuring stuff out as I go along.)
>
> And WDYAT of their spec extensions[1]?  Specifically their "given"
>
>  given "a item exists" do
>    request(resource(:items), :method => "POST",
>      :params => { :item => {  }})
>  end
>
>  describe "resource(:items)" do
>
>    describe "GET", :given => "a item exists" do
>      before(:each) do
>        @response = request(resource(:items))
>      end
>
>      it "has a list of items" do
>        pending
>        @response.should have_xpath("//ul/li")
>      end
>    end
>
>  end
>
> Have to say I was a bit surprised to learn they'd monkey-patched RSpec...

Well, in fairness to wycats, rspec doesn't really offer formal
extension points that would support this syntax, so he did the best he
could given what is available. We've had some discussion about this
and haven't landed anywhere firm yet.

My opinion is that rspec, as it stands right now, needs a bit of
internal cleanup before we start adding new features like that one.
Also, the way I'd like to see this go is that rspec exposes a formal
extension point - some sort of hook into pre and post-processing of
each example including any arguments it was given. Then the merb
extension could use a published API rather than monkey patching.

FWIW,
David

>
> Ashley
>
> [1]
> http://github.com/wycats/merb-core/tree/master/lib/merb-core/test/test_ext/rspec.rb
>
>
> --
> http://www.patchspace.co.uk/
> http://aviewfromafar.net/
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list