ApplicationHelperモジュールにfull_title
メソッドがあるとしたら、RSpecリクエスト仕様でどのようにアクセスできますか?RSpecリクエストでApplication Helperメソッドにアクセスできますか?
私は今、次のコードを持っている:
NoMethodError: undefined method full_title' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x00000003d43138>
app/helpers/application_helper.rb
module ApplicationHelper
# Returns the full title on a per-page basis.
def full_title(page_title)
base_title = "My Site title"
logger.debug "page_title: #{page_title}"
if page_title.empty?
base_title
else
"#{page_title} - #{base_title}"
end
end
spec/requests/user_pages_spec.rb
require 'spec_helper'
describe "User Pages" do
subject { page }
describe "signup page" do
before { visit signup_path }
it { should have_selector('h2', text: 'Sign up') }
it { should have_selector('title', text: full_title('Sign Up')) }
end
end
を、私は、このエラーメッセージが表示されます
Michael HartlのRails Tutorialのテストによれば、私は自分のユーザー仕様のアプリケーションヘルパーメソッドにアクセスできるはずです。私はここで何の間違いをしていますか?
を持っていますコードとそれは私のために働く。エラーメッセージにさらに情報を追加できますか?また、あなたが共有できるgithubのレポを持っていますか? –
あなたの 'spec/support'ディレクトリにあなたの' utilities.rb'ファイルを作成しましたか? – veritas1
[your code](https://github.com/movingahead/sample_app)をチェックアウトし、すべての仕様が合格しました。データベースを移行しても、sporkを再起動しませんでしたか? –