我正在用RSpec编写一个视图规范,我不断遇到这个问题.测试会找到textarea但是当我尝试测试内容时它会失败.有什么建议?
这是我遇到麻烦的测试.
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
我可能做错了,因为我在TDD上很新,但是当我从textarea中删除了真正让我困惑的值时,我看到这个测试通过了.那么有没有办法测试textarea的内容?