How to create contexts in shoulda macros

Posted by Honza on Stack Overflow See other posts from Stack Overflow or by Honza
Published on 2010-04-25T14:56:27Z Indexed on 2010/04/26 9:33 UTC
Read the original article Hit count: 291

Asking this question again with smaller code sample:

  # this is a dummy shoulda macro that creates a context
  def self.macro_context
    context "macro" do
      yield
    end
  end

  # i am expecting this test to fail within the macro context
  context "some context" do
    macro_context do
      should "test" do
        fail
      end
    end
  end

So what I would expect is to see:

  1) Error:
  test: some context macro context should test. (TestClassName)

But I am getting only this:

So what I would expect is to see:

  1) Error:
  test: some context should test. (TestClassName)

Any idea what am I doing wrong?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails