Custom matchers broken with move to 2.8.0 #110

Closed
brentmurphy opened this Issue Jan 23, 2012 · 8 comments

Projects

None yet

3 participants

@brentmurphy

Hi,

The move from 2.6 to 2.8 has broken my custom matchers (dsl form). This only occurs however when all the specs in the suite are run, not when they are run individually. For example, error is now "expected x to validate y" fails where before it passed.

Is this a known issue?

Thanks

@justinko
Contributor

Yes sir, it is known. Thanks for reporting.

@brentmurphy

Is that the same? I'm only seeing the behaviour when it's run as part of the suite.

@justinko
Contributor

Can you paste your custom matcher please?

@brentmurphy

Pasting an example below. They all seem to break however.

RSpec::Matchers.define :have_field_for do |field|
  match do |actual|
    if (field = actual.fields[field.to_s]).present?
      [
        (@type.present? ? @type == field.options[:type] : true),
        (@default.present? ? @default == field.options[:default] : true)
      ].all?
    else
      false
    end
  end

 chain :with_default do |default|
   @default = default
 end

  chain :with_type do |type|
    @type = type
  end
end
@justinko
Contributor

David posted some comments on the other issue. Should be fixed tonight :)

@brentmurphy

Cool. Thanks for the help.

@dchelimsky
Member

@brentmurphy your issue is a dup of #104, which is fixed.

@dchelimsky dchelimsky closed this Jan 24, 2012
@brentmurphy

Awesome. Thanks for the quick turnaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment