Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

has.feature #68

Closed
wants to merge 1 commit into from

3 participants

@francois

Using 2.5.0, running specs using the doc formatter, the following matcher:

it { should have_persona(message[:persona]) }

generates a misleading message:

should have key {:type=>"twitter", :screen_name=>"fbeausoleil"}

I expected a message that included the method's name, something like this:

should have persona {:type=>"twitter", :screen_name=>"fbeausoleil"}

When I tried using HEAD, I got the message I expected. This feature confirms and ensures the message will stay as-is.

@justinko

Sigh, Github isn't closing this for me.

00f014d

@justinko justinko closed this
@dchelimsky
Owner

@francois - we already have scenarios for have_key and have_xxxx in https://github.com/rspec/rspec-expectations/blob/master/features/built_in_matchers/predicates.feature, so I rolled back your patch. Do you feel those cover what you're looking for sufficiently?

@francois

I'm sad my name won't be in the contributors list, but I fully understand and agree with your revert :) I'll find something else to contribute on then!

@kchien kchien referenced this pull request from a commit in kchien/rspec-expectations
@justinko justinko Tweaks to has.feature - Closes #68 933be5b
@kchien kchien referenced this pull request from a commit in kchien/rspec-expectations
@dchelimsky dchelimsky Revert the last three commits - we already have scenarios for has_FOO in
features/built-in-matchers/predicate-matchers.feature

Squashed commit of the following:

commit 521a6f025a786076f5b10beea553f74b01a17b10
Author: David Chelimsky <dchelimsky@gmail.com>
Date:   Sat Apr 9 16:37:47 2011 -0500

    Revert "Confirmed the doc format outputs the right values"

    This reverts commit 00f014d.

commit f218740f4338b2d92bf978a361f01756727f37b0
Author: David Chelimsky <dchelimsky@gmail.com>
Date:   Sat Apr 9 16:37:37 2011 -0500

    Revert "Tweaks to has.feature - Closes #68"

    This reverts commit 933be5b.

commit d8361f659f26dd011bdcdca9fc38c159ed3a13e0
Author: David Chelimsky <dchelimsky@gmail.com>
Date:   Sat Apr 9 16:37:12 2011 -0500

    Revert "Add has.feature to Relish .nav"

    This reverts commit 5ca17e7.
155e5c0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 7, 2011
  1. @francois
This page is out of date. Refresh to see the latest.
Showing with 33 additions and 0 deletions.
  1. +33 −0 features/built_in_matchers/has.feature
View
33 features/built_in_matchers/has.feature
@@ -0,0 +1,33 @@
+Feature: has_SOMETHING() matcher
+
+ RSpec provides a helper such that:
+
+ * subject.should have_key(x)
+ * subject.should have_item_with_name(x)
+
+ call the appropriate predicate method.
+
+ Scenario: have_item_with_name(x) on an object that implements #has_item_with_name?
+ Given a file named "have_item_with_name_spec.rb" with:
+ """
+ class O
+ def initialize(array)
+ @array = array
+ end
+
+ def has_item_with_name?(name)
+ @array.include?(name)
+ end
+ end
+
+ describe O.new(%w(francois jake)) do
+ it { should have_item_with_name("francois") }
+ it { should_not have_item_with_name("john") }
+ end
+ """
+
+ When I run `rspec --format doc have_item_with_name_spec.rb`
+ Then the examples should all pass
+ And the output should contain all of these:
+ | should have item with name "francois" |
+ | should not have item with name "john" |
Something went wrong with that request. Please try again.