[rspec-users] Use filters to wrap examples into a pending block?

Jeroen van Dijk jeroentjevandijk at gmail.com
Thu Dec 23 06:40:40 EST 2010


Found the answer by looking at the features:

RSpec.configure do |c|
  c.around do |example|
    if example.metadata.has_key?(:broken)
      pending "is broken since change from 3.0.0.beta4 to 3.0.3" do
        example.call
      end
    end
  end
end

Nice :-)

On Thu, Dec 23, 2010 at 11:57 AM, Jeroen van Dijk <
jeroentjevandijk at gmail.com> wrote:

> Hi all,
>
> I was wonder whether something like the following is possible in RSpec?
>
> RSpec.configure do |c|
>   c.filter_examples : pending_for_some_reason => lambda {|example|
>     pending "This example is failing due to upgrade of x" do
>        example.call
>     end
>   }
> end
>
> it "should succeed, but probably doesn't yet", :pending_for_some_reason =>
> true do
>    raise "fail"
> end
>
> I'm currently working on a library that has many failing specs due to an
> upgrade of a dependency. It would be nice if a could just flag examples that
> are failing due to that change without having to copy paste the pending
> block.
>
> Cheers,
> Jeroen
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20101223/57804b65/attachment-0001.html>


More information about the rspec-users mailing list