0
나는 test_helper.rb에서 간단한 도우미 메서드를 사용하여 테스트를하고 있으며 내 생애 동안 내 사양이 실패한 이유를 알 수 없습니다. 아래 코드를 포함 시켰습니다. spec은 예상되는 "nil"을 출력하고 "sanity respond_to"는 출력합니까? 확인 번호를 확인하십시오. 내가 뭘 놓치고 있니?Rspec testing application_helper.rb
require 'spec_helper'
describe ApplicationHelper do
describe "#tagline" do
specify { helper.tagline('text').should == '<div class="tagline"><p>text</p></div>' }
p helper.respond_to?(:tagline) ? "yes" : "no"
end
end
------
module ApplicationHelper
def tagline(text)
content_for(:tagline) { %Q(<div class="tagline"><p>#{text}</p></div>).html_safe }
end
end