Rails rspec undefined method for #<RSpec::ExampleGroups
<p>I have set_seo method in my ApplicationController</p>

<pre><code>def set_seo(page)
   set_meta_tags :site =&gt; '', :title =&gt; page.seo_title ? page.seo_title : '', :reverse =&gt; true,
              :description =&gt; page.seo_description ? page.seo_description : ""
end
</code></pre>

<p>and want to test my BrandsController which includes this method   </p>

<pre><code> def index
    #some code here
    set_seo(@content)
 end
</code></pre>

<p>my controller spec </p>

<pre><code>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
</code></pre>

<p>but i have got </p>

<pre><code> NoMethodError:
   undefined method `set_seo' for #&lt;RSpec::ExampleGroups::BrandsController::GETIndex:0x007f866daa96c8&gt;
</code></pre>