1
私はApplicationControllerにRailsのRSpecの未定義のメソッド<RSpecの:: ExampleGroups
def set_seo(page)
set_meta_tags :site => '', :title => page.seo_title ? page.seo_title : '', :reverse => true,
:description => page.seo_description ? page.seo_description : ""
end
にset_seo方法を持っており、この方法を含んでいる私のBrandsControllerをテストしたい
def index
#some code here
set_seo(@content)
end
私のコントローラの仕様
require 'spec_helper'
describe BrandsController do
render_views
before(:all) do
@content = create(:content)
create(:user)
end
describe "GET index" do
it "index" do
allow(ApplicationController).to receive(set_seo(@content)).and_return(set_seco(@content))
brand = Brand.create
get :index
expect(response).to render_template(:index)
end
しかし、私は持っている
NoMethodError:
undefined method `set_seo' for #<RSpec::ExampleGroups::BrandsController::GETIndex:0x007f866daa96c8>