Here is a simple example of the breaking code; ====== CODE ======== describe "payments/new.html.haml" do let(:payment) do mock_model("Payment").as_new_record.as_null_object end
before do assign(:payment, payment) end it "renders a form to take payment details" do render rendered.should have_selector("form", :method => "post", :action => payments_path ) do |form| form.should have_selector("input", :type => "submit") end end it "renders a text field for the billing name" do payment.stub(:billing_name => "Mr. Test Pants") render rendered.should have_selector("form") do |form| form.should have_selector("input", :type => "text", :name => "payment[billing_name]", :value => "Mr. Test Pants" ) end end end =================== Here is the error; ====== ERROR ======== Failure/Error: form.should have_selector("input", expected following output to contain a <input type='text' value='Mr. Test Pants' name='payment[billing_name]'/> tag: <form accept-charset="UTF-8" action="/payments" class="new_payment" id="new_payment" method="post"> <div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div> <input id="payment_billing_name" name="payment[billing_name]" size="30" type="text" value="Payment_#<RSpec::Core::ExampleGroup::Nested_1:0x1031c4220>"><input id="payment_submit" name="commit" type="submit" value="Save"> </form> =================== Attachments: http://www.ruby-forum.com/attachment/5528/example_spec.rb -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users