[rspec-users] Do the :attributes and :content matchers work
sinclair bain
rspec.user at gmail.com
Thu Aug 2 16:15:41 EDT 2007
[Rails plugin 1.0.5]
Hi,
I am looking for some guidance.
When working on a partial which looks like this
<div class="bug" style="width: 100%;" />
I have some examples which should fail - I think - but do not:
it ' should fail' do
response.should have_tag( 'div.bug', :content => 'There is no
content!' )
end
it ' should fail since there is no bug attribute with a value of
"here"' do
response.should have_tag( 'div', :attributes => {:bug => "here"} )
response.should have_tag( 'div', :attributes => {:bug => "here",
:another_bug => 'there'} )
end
I am calling render :partial => '/bug/div' in the before :each block.
As I said I would expect this to fail but it does not.
I am trying this because in the
<my_app>/vendor/plugins/rspec_on_rails/spec/rails/dsl/view_spec_spec.rb
file there is an example
describe "A view that includes a partial using :collection and
:spacer_template", :behaviour_type => :view do
before(:each) do
render "view_spec/partial_collection_including_template"
end
it "should render the partial w/ spacer_tamplate" do
response.should have_tag('div', :content => 'Alice')
response.should have_tag('hr', :attributes =>{:id => "spacer"})
response.should have_tag('div', :content => 'Bob')
end
end
which does just this.
Can anyone help please ?
Cheers!
sinclair
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070802/c3ed6209/attachment.html
More information about the rspec-users
mailing list