<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -37,29 +37,42 @@ describe Merb::Test::Rspec::ViewMatchers do
           Hpricot.should_receive(:parse).and_return @document
         end
       
-        it &quot;should should pass all found elements to the block&quot; do
+        it &quot;should pass all found elements to the block&quot; do
           @block_called = false
         
           @document.should_receive(:search).and_return [&quot;&quot;]
-          HasTag.new(&quot;tag&quot;).matches?(&quot;&quot;) {|e| @block_called = true}
-        
-          @block_called.should be_true
+          HasTag.new(&quot;tag&quot;).matches?(&quot;&quot;) {|e| e.should == &quot;&quot; }
         end
       
-        it &quot;should not intercept any errors raised in the block&quot; do
+        it 'should intercept errors raised in the block' do
           @document.should_receive(:search).and_return [&quot;&quot;]
           lambda {
             HasTag.new(&quot;tag&quot;).matches?(&quot;&quot;) {|e| true.should be_false }
-          }.should raise_error(Spec::Expectations::ExpectationNotMetError)
+          }.should_not raise_error(Spec::Expectations::ExpectationNotMetError)
+        end
+
+        it 'should raise ExpectationNotMetError when there are no matched elements' do
+          @document.should_receive(:search).and_return [&quot;&quot;]
+          lambda {
+            @document.should have_tag(:tag) {|e| true.should be_false }
+          }.should raise_error(Spec::Expectations::ExpectationNotMetError, &quot;tag:\nexpected false, got true&quot;)
+        end
+
+        #part of bugfix for #329
+        it 'should not raise error if block for first of matched elements by xpath expression fails' do
+          @document.should_receive(:search).and_return [&quot;a&quot;, &quot;b&quot;]
+          lambda {
+            @document.should have_tag(:tag) { |tag| tag.should == &quot;b&quot; }
+          }.should_not raise_error(Spec::Expectations::ExpectationNotMetError)
         end
       end
     
       describe &quot;#with_tag&quot; do
-        it &quot;should set @inner_tag&quot; do
+        it &quot;should set @outer_has_tag&quot; do
           outer = HasTag.new(&quot;outer&quot;)
           inner = outer.with_tag(&quot;inner&quot;)
         
-          outer.selector.should include(inner.selector)
+          inner.selector.should include(outer.selector)
         end
       end
     
@@ -95,15 +108,15 @@ describe Merb::Test::Rspec::ViewMatchers do
     
       describe &quot;#failure_message&quot; do
         it &quot;should include the tag name&quot; do
-          HasTag.new(&quot;anytag&quot;).failure_message.should include(&quot;&lt;anytag&quot;)
+          HasTag.new(&quot;anytag&quot;).failure_message.should include(&quot;anytag&quot;)
         end
       
         it &quot;should include the tag's id&quot; do
-          HasTag.new(&quot;div&quot;, :id =&gt; :spacer).failure_message.should include(&quot;&lt;div id=\&quot;spacer\&quot;&quot;)
+          HasTag.new(&quot;div&quot;, :id =&gt; :spacer).failure_message.should include(&quot;div#spacer&quot;)
         end
       
         it &quot;should include the tag's class&quot; do
-          HasTag.new(&quot;div&quot;, :class =&gt; :header).failure_message.should include(&quot;&lt;div class=\&quot;header\&quot;&quot;)
+          HasTag.new(&quot;div&quot;, :class =&gt; :header).failure_message.should include(&quot;div.header&quot;)
         end
       
         it &quot;should include the tag's custom attributes&quot; do
@@ -113,18 +126,12 @@ describe Merb::Test::Rspec::ViewMatchers do
       end
     
       describe &quot;id, class, and attributes for error messages&quot; do
-        it &quot;should start with a space for a class, id, or custom attribute&quot; do
-          HasTag.new(&quot;tag&quot;, :id =&gt; &quot;identifier&quot;).id_for_error.should =~ /^ /
-          HasTag.new(&quot;tag&quot;, :class =&gt; &quot;classifier&quot;).class_for_error.should =~ /^ /
-          HasTag.new(&quot;tag&quot;, :rand =&gt; &quot;attr&quot;).attributes_for_error.should =~ /^ /
-        end
-      
-        it &quot;should have 'class=\&quot;classifier\&quot;' in class_for_error&quot; do
-          HasTag.new(&quot;tag&quot;, :class =&gt; &quot;classifier&quot;).class_for_error.should include(&quot;class=\&quot;classifier\&quot;&quot;)
+        it &quot;should have '.classifier' in class_for_error&quot; do
+          HasTag.new(&quot;tag&quot;, :class =&gt; &quot;classifier&quot;).class_for_error.should include(&quot;.classifier&quot;)
         end
       
-        it &quot;should have 'id=\&quot;identifier\&quot; in id_for_error&quot; do
-          HasTag.new(&quot;tag&quot;, :id =&gt; &quot;identifier&quot;).id_for_error.should include(&quot;id=\&quot;identifier\&quot;&quot;)
+        it &quot;should have '#identifier' in id_for_error&quot; do
+          HasTag.new(&quot;tag&quot;, :id =&gt; &quot;identifier&quot;).id_for_error.should include(&quot;#identifier&quot;)
         end
       end
     end</diff>
      <filename>spec/public/test/view_matchers_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ef6092a6ee79d112eccbea1b8862c21d46d51b99</id>
    </parent>
  </parents>
  <author>
    <name>Michael Holub</name>
    <email>michael.holub@gmail.com</email>
  </author>
  <url>http://github.com/wycats/merb-core/commit/d4739e7620f2f553578009c859de2dae4863c8a4</url>
  <id>d4739e7620f2f553578009c859de2dae4863c8a4</id>
  <committed-date>2008-10-11T21:31:08-07:00</committed-date>
  <authored-date>2008-10-11T07:21:59-07:00</authored-date>
  <message>fixed specs for viewmatchers

Signed-off-by: Michael S. Klishin &lt;michael@novemberain.com&gt;</message>
  <tree>607f8165a7abae6bf04d4a1884a023e5b858f0de</tree>
  <committer>
    <name>Michael S. Klishin</name>
    <email>michael@novemberain.com</email>
  </committer>
</commit>
