[rspec-users] Use filters to wrap examples into a pending block?
Jeroen van Dijk
jeroentjevandijk at gmail.com
Thu Dec 23 07:02:15 EST 2010
Oh and don't forget the 'else' part:
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
else
example.call
end
end
end
Suddenly my test suite was mega fast and I had no failing specs... oops :-)
Cheers
On Thu, Dec 23, 2010 at 12:40 PM, Jeroen van Dijk <
jeroentjevandijk at gmail.com> wrote:
> 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/e0dc2ca1/attachment.html>
More information about the rspec-users
mailing list