I am writing a view spec with RSpec and I keep getting this problem. The test will find textarea, but it fails when I try to check the contents. Any suggestions?
This is a test I'm having problems with.
describe "reminders/edit.html.erb" do before(:each) do @reminder = Factory(:reminder) end it "should render the form to edit a reminder" do assign :reminder, @reminder render rendered.should have_selector("form", :method => "post", :action => reminder_path(@reminder) ) do |f| f.should have_selector("input", :type => "text", :name => "reminder[title]", :value => "The Title" ) f.should have_selector("textarea", :name => "reminder[content]", :value => 'The big content') f.should have_selector("input", :type => "submit") end end
I can do it all wrong, since I'm pretty new to TDD, but I see that this test passes when I remove a value from a text box that really confuses me. So is there a way to test a text field for its contents?
source share