title: How can I stub a controller helper method in a view spec with RSpec 3.4?
body: <p>I'm testing a view with <strong>RSpec</strong> (3.4 on <strong>Rails</strong> 4.2.5). And I use the <strong>decent_exposure</strong> gem in my CRUD controller. <strong>decent_exposure</strong> makes it easy to define named methods that are made available to my views and which memoize the resultant values.</p>
  
  <p>But I don't understand how I can stub these methods in a view spec. I tried do it according to the RSpec documentation, but it raises an error.</p>
  
  <p>Why doesn't it work? How can I stub the method <code>article</code> in the view?</p>
  
  <p>My controller</p>
  
  <pre><code>class Account::ArticlesController &lt; Account::BaseController
    expose(:articles) { current_user.articles }
    expose(:article, attributes: :article_params)
  
    # POST /account/articles
    # POST /account/articles.json
    def create
      respond_to do |format|
        if article.save
          format.html { redirect_to account_article_url(article), notice: 'Article was successfully created.' }
          format.json { render :show, status: :created, location: account_article_url(article) }
        else
          format.html { render :new }
          format.json { render json: article.errors, status: :unprocessable_entity }
        end
      end
    end
  
    # PATCH/PUT /account/articles/1
    # PATCH/PUT /account/articles/1.json
    def update
      respond_to do |format|
        if article.update(article_params)
          format.html { redirect_to account_article_url(article), notice: 'Article was successfully updated.' }
          format.json { render :show, status: :ok, location: account_article_url(article) }
        else
          format.html { render :edit }
          format.json { render json: article.errors, status: :unprocessable_entity }
        end
      end
    end
  
    # DELETE /account/articles/1
    # DELETE /account/articles/1.json
    def destroy
      respond_to do |format|
        if article.destroy
          format.html { redirect_to account_articles_url, notice: 'Article was successfully destroyed.' }
          format.json { head :no_content }
        else
          format.html { redirect_to account_articles_url, notice: 'Article was not destroyed.' }
          format.json { render json: article.errors, status: :unprocessable_entity }
        end
      end
    end
  
    private
  
    def article_params
      params.require(:article).permit(:title, :announce, :content, :is_published, :published_at)
    end
  
  end
  </code></pre>
  
  <p>And I have a view spec</p>
  
  <pre><code>require 'rails_helper'
  
  RSpec.describe 'account/articles/new', type: :view do
  
    before do
      allow(view).to receive(:article).and_return(build(:article))
    end
  
    it 'renders new article form' do
      render
      expect(rendered).to match %Q{form[action=#{account_articles_path}][method=post]}
    end
  end
  </code></pre>
  
  <p>But it raises an error</p>
  
  <pre><code>Failures:
  
    1) account/articles/new renders new article form
       Failure/Error: allow(view).to receive(:article).and_return(build(:article))
         #&lt;#&lt;Class:0x007fe85c2c7620&gt;:0x007fe85d161208 @_routes=nil, @_config={}, @view_renderer=#&lt;ActionView::Renderer:0x007fe85d1613c0 @lookup_context=#&lt;ActionView::LookupContext:0x007fe85d1615a0 @details_key=nil, @details={:locale=&gt;[:en], :formats=&gt;[:html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :variants=&gt;[], :handlers=&gt;[:erb, :builder, :raw, :ruby, :coffee, :jbuilder, :haml]}, @skip_default_locale=false, @cache=true, @prefixes=["", "account/articles"], @rendered_format=nil, @view_paths=#&lt;ActionView::PathSet:0x007fe85d1614d8 @paths=[#&lt;ActionView::OptimizedFileSystemResolver:0x007fe85d37fb48 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @cache=#&lt;ActionView::Resolver::Cache:0x007fe85d37fb20 @data=#&lt;ActionView::Resolver::Cache::SmallCache:0x007fe85d37faf8 @backend={}, @default_proc=#&lt;Proc:0x007fe85f071198@/Users/et/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5/lib/action_view/template/resolver.rb:49 (lambda)&gt;&gt;&gt;, @path="/Users/et/Documents/projects/test-blog/app/views"&gt;, #&lt;ActionView::OptimizedFileSystemResolver:0x007fe85d37feb8 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @cache=#&lt;ActionView::Resolver::Cache:0x007fe85d37fe90 @data=#&lt;ActionView::Resolver::Cache::SmallCache:0x007fe85d37fe68 @backend={}, @default_proc=#&lt;Proc:0x007fe85f071198@/Users/et/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5/lib/action_view/template/resolver.rb:49 (lambda)&gt;&gt;&gt;, @path="/Users/et/.rvm/gems/ruby-2.2.2/gems/devise-3.5.3/app/views"&gt;]&gt;&gt;&gt;, @request=#&lt;ActionController::TestRequest:0x007fe85c35e048 @env={"rack.version"=&gt;[1, 3], "rack.input"=&gt;#&lt;StringIO:0x007fe85f87eca0&gt;, "rack.errors"=&gt;#&lt;StringIO:0x007fe85f87ed40&gt;, "rack.multithread"=&gt;true, "rack.multiprocess"=&gt;true, "rack.run_once"=&gt;false, "REQUEST_METHOD"=&gt;"GET", "SERVER_NAME"=&gt;"example.org", "SERVER_PORT"=&gt;"80", "QUERY_STRING"=&gt;"", "rack.url_scheme"=&gt;"http", "HTTPS"=&gt;"off", "SCRIPT_NAME"=&gt;"", "CONTENT_LENGTH"=&gt;"0", "HTTP_HOST"=&gt;"test.host", "REMOTE_ADDR"=&gt;"0.0.0.0", "HTTP_USER_AGENT"=&gt;"Rails Testing", "action_dispatch.routes"=&gt;#&lt;ActionDispatch::Routing::RouteSet:0x007fe85c6713e8&gt;, "action_dispatch.parameter_filter"=&gt;[:password], "action_dispatch.redirect_filter"=&gt;[], "action_dispatch.secret_token"=&gt;nil, "action_dispatch.secret_key_base"=&gt;"eb526d7f4b0c06b367225a0d32ba8b3c3287ea6d6de798961e6fe33b975d44c2cd3ae9f314f0b96c73029f052d4670bc5a4db850ffc6a73586043089f57bdb3b", "action_dispatch.show_exceptions"=&gt;false, "action_dispatch.show_detailed_exceptions"=&gt;true, "action_dispatch.logger"=&gt;#&lt;ActiveSupport::Logger:0x007fe85d32d528 @progname=nil, @level=0, @default_formatter=#&lt;Logger::Formatter:0x007fe85d32d4b0 @datetime_format=nil&gt;, @formatter=#&lt;ActiveSupport::Logger::SimpleFormatter:0x007fe85d2fc928 @datetime_format=nil&gt;, @logdev=#&lt;Logger::LogDevice:0x007fe85d32d460 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#&lt;File:/Users/et/Documents/projects/test-blog/log/test.log&gt;, @mutex=#&lt;Logger::LogDevice::LogDeviceMutex:0x007fe85d32d438 @mon_owner=nil, @mon_count=0, @mon_mutex=#&lt;Mutex:0x007fe85d32d3e8&gt;&gt;&gt;&gt;, "action_dispatch.backtrace_cleaner"=&gt;#&lt;Rails::BacktraceCleaner:0x007fe85c2f4aa8 @filters=[#&lt;Proc:0x007fe85c2f4878@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:14&gt;, #&lt;Proc:0x007fe85c2f4850@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:15&gt;, #&lt;Proc:0x007fe85c2f47d8@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:16&gt;, #&lt;Proc:0x007fe85c2f5750@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:29&gt;], @silencers=[#&lt;Proc:0x007fe85c2f59a8@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:19&gt;], @root="/Users/et/Documents/projects/test-blog/"&gt;, "action_dispatch.key_generator"=&gt;#&lt;ActiveSupport::CachingKeyGenerator:0x007fe85f4cc580 @key_generator=#&lt;ActiveSupport::KeyGenerator:0x007fe85f4cc5a8 @secret="eb526d7f4b0c06b367225a0d32ba8b3c3287ea6d6de798961e6fe33b975d44c2cd3ae9f314f0b96c73029f052d4670bc5a4db850ffc6a73586043089f57bdb3b", @iterations=1000&gt;, @cache_keys=#&lt;ThreadSafe::Cache:0x007fe85f4cc558 @backend={"signed_global_ids64"=&gt;"0\xF4/#*5\xF2\x0F\xB2\x101\v~\xC5\x89\xFF\xDB\x11\xCB(U\xFA\xF87\x13Evz:\xAD\xD6\xA3r\x96\x9A\x82\x17\x84\tR\xF2A\xADV\x85u?^N\xBCT\x84\x10\x11\xD9\xC9&gt;n\xA1\f\x06\xAAuU"}, @default_proc=nil&gt;&gt;, "action_dispatch.http_auth_salt"=&gt;"http authentication", "action_dispatch.signed_cookie_salt"=&gt;"signed cookie", "action_dispatch.encrypted_cookie_salt"=&gt;"encrypted cookie", "action_dispatch.encrypted_signed_cookie_salt"=&gt;"signed encrypted cookie", "action_dispatch.cookies_serializer"=&gt;:json, "action_dispatch.cookies_digest"=&gt;nil, "rack.session"=&gt;{}, "rack.session.options"=&gt;{:key=&gt;"rack.session", :path=&gt;"/", :domain=&gt;nil, :expire_after=&gt;nil, :secure=&gt;false, :httponly=&gt;true, :defer=&gt;false, :renew=&gt;false, :sidbits=&gt;128, :cookie_only=&gt;true, :secure_random=&gt;SecureRandom, :id=&gt;"8a8b5f8906289bb00109022394af0832"}, "action_dispatch.request.path_parameters"=&gt;{:controller=&gt;"account/articles", :action=&gt;"new"}}, @filtered_parameters=nil, @filtered_env=nil, @filtered_path=nil, @protocol=nil, @port=nil, @method=nil, @request_method=nil, @remote_ip=nil, @original_fullpath=nil, @fullpath=nil, @ip=nil, @uuid=nil&gt;, @response=#&lt;ActionController::TestResponse:0x007fe85c2cf0a0 @mon_owner=nil, @mon_count=0, @mon_mutex=#&lt;Mutex:0x007fe85c2cef38&gt;, @stream=#&lt;ActionDispatch::Response::Buffer:0x007fe85c2cedd0 @response=#&lt;ActionController::TestResponse:0x007fe85c2cf0a0 ...&gt;, @buf=[], @closed=false&gt;, @header={"X-Frame-Options"=&gt;"SAMEORIGIN", "X-XSS-Protection"=&gt;"1; mode=block", "X-Content-Type-Options"=&gt;"nosniff"}, @status=200, @sending_file=false, @blank=false, @cv=#&lt;MonitorMixin::ConditionVariable:0x007fe85c2ced58 @monitor=#&lt;ActionController::TestResponse:0x007fe85c2cf0a0 ...&gt;, @cond=#&lt;Thread::ConditionVariable:0x007fe85c2ced30&gt;&gt;, @committed=false, @sending=false, @sent=false, @content_type=nil, @charset=nil, @cache_control={}, @etag=nil&gt;, @params={}, @_assigns={"request"=&gt;#&lt;ActionController::TestRequest:0x007fe85c35e048 @env={"rack.version"=&gt;[1, 3], "rack.input"=&gt;#&lt;StringIO:0x007fe85f87eca0&gt;, "rack.errors"=&gt;#&lt;StringIO:0x007fe85f87ed40&gt;, "rack.multithread"=&gt;true, "rack.multiprocess"=&gt;true, "rack.run_once"=&gt;false, "REQUEST_METHOD"=&gt;"GET", "SERVER_NAME"=&gt;"example.org", "SERVER_PORT"=&gt;"80", "QUERY_STRING"=&gt;"", "rack.url_scheme"=&gt;"http", "HTTPS"=&gt;"off", "SCRIPT_NAME"=&gt;"", "CONTENT_LENGTH"=&gt;"0", "HTTP_HOST"=&gt;"test.host", "REMOTE_ADDR"=&gt;"0.0.0.0", "HTTP_USER_AGENT"=&gt;"Rails Testing", "action_dispatch.routes"=&gt;#&lt;ActionDispatch::Routing::RouteSet:0x007fe85c6713e8&gt;, "action_dispatch.parameter_filter"=&gt;[:password], "action_dispatch.redirect_filter"=&gt;[], "action_dispatch.secret_token"=&gt;nil, "action_dispatch.secret_key_base"=&gt;"eb526d7f4b0c06b367225a0d32ba8b3c3287ea6d6de798961e6fe33b975d44c2cd3ae9f314f0b96c73029f052d4670bc5a4db850ffc6a73586043089f57bdb3b", "action_dispatch.show_exceptions"=&gt;false, "action_dispatch.show_detailed_exceptions"=&gt;true, "action_dispatch.logger"=&gt;#&lt;ActiveSupport::Logger:0x007fe85d32d528 @progname=nil, @level=0, @default_formatter=#&lt;Logger::Formatter:0x007fe85d32d4b0 @datetime_format=nil&gt;, @formatter=#&lt;ActiveSupport::Logger::SimpleFormatter:0x007fe85d2fc928 @datetime_format=nil&gt;, @logdev=#&lt;Logger::LogDevice:0x007fe85d32d460 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#&lt;File:/Users/et/Documents/projects/test-blog/log/test.log&gt;, @mutex=#&lt;Logger::LogDevice::LogDeviceMutex:0x007fe85d32d438 @mon_owner=nil, @mon_count=0, @mon_mutex=#&lt;Mutex:0x007fe85d32d3e8&gt;&gt;&gt;&gt;, "action_dispatch.backtrace_cleaner"=&gt;#&lt;Rails::BacktraceCleaner:0x007fe85c2f4aa8 @filters=[#&lt;Proc:0x007fe85c2f4878@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:14&gt;, #&lt;Proc:0x007fe85c2f4850@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:15&gt;, #&lt;Proc:0x007fe85c2f47d8@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:16&gt;, #&lt;Proc:0x007fe85c2f5750@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:29&gt;], @silencers=[#&lt;Proc:0x007fe85c2f59a8@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:19&gt;], @root="/Users/et/Documents/projects/test-blog/"&gt;, "action_dispatch.key_generator"=&gt;#&lt;ActiveSupport::CachingKeyGenerator:0x007fe85f4cc580 @key_generator=#&lt;ActiveSupport::KeyGenerator:0x007fe85f4cc5a8 @secret="eb526d7f4b0c06b367225a0d32ba8b3c3287ea6d6de798961e6fe33b975d44c2cd3ae9f314f0b96c73029f052d4670bc5a4db850ffc6a73586043089f57bdb3b", @iterations=1000&gt;, @cache_keys=#&lt;ThreadSafe::Cache:0x007fe85f4cc558 @backend={"signed_global_ids64"=&gt;"0\xF4/#*5\xF2\x0F\xB2\x101\v~\xC5\x89\xFF\xDB\x11\xCB(U\xFA\xF87\x13Evz:\xAD\xD6\xA3r\x96\x9A\x82\x17\x84\tR\xF2A\xADV\x85u?^N\xBCT\x84\x10\x11\xD9\xC9&gt;n\xA1\f\x06\xAAuU"}, @default_proc=nil&gt;&gt;, "action_dispatch.http_auth_salt"=&gt;"http authentication", "action_dispatch.signed_cookie_salt"=&gt;"signed cookie", "action_dispatch.encrypted_cookie_salt"=&gt;"encrypted cookie", "action_dispatch.encrypted_signed_cookie_salt"=&gt;"signed encrypted cookie", "action_dispatch.cookies_serializer"=&gt;:json, "action_dispatch.cookies_digest"=&gt;nil, "rack.session"=&gt;{}, "rack.session.options"=&gt;{:key=&gt;"rack.session", :path=&gt;"/", :domain=&gt;nil, :expire_after=&gt;nil, :secure=&gt;false, :httponly=&gt;true, :defer=&gt;false, :renew=&gt;false, :sidbits=&gt;128, :cookie_only=&gt;true, :secure_random=&gt;SecureRandom, :id=&gt;"8a8b5f8906289bb00109022394af0832"}, "action_dispatch.request.path_parameters"=&gt;{:controller=&gt;"account/articles", :action=&gt;"new"}}, @filtered_parameters=nil, @filtered_env=nil, @filtered_path=nil, @protocol=nil, @port=nil, @method=nil, @request_method=nil, @remote_ip=nil, @original_fullpath=nil, @fullpath=nil, @ip=nil, @uuid=nil&gt;, "response"=&gt;#&lt;ActionController::TestResponse:0x007fe85c2cf0a0 @mon_owner=nil, @mon_count=0, @mon_mutex=#&lt;Mutex:0x007fe85c2cef38&gt;, @stream=#&lt;ActionDispatch::Response::Buffer:0x007fe85c2cedd0 @response=#&lt;ActionController::TestResponse:0x007fe85c2cf0a0 ...&gt;, @buf=[], @closed=false&gt;, @header={"X-Frame-Options"=&gt;"SAMEORIGIN", "X-XSS-Protection"=&gt;"1; mode=block", "X-Content-Type-Options"=&gt;"nosniff"}, @status=200, @sending_file=false, @blank=false, @cv=#&lt;MonitorMixin::ConditionVariable:0x007fe85c2ced58 @monitor=#&lt;ActionController::TestResponse:0x007fe85c2cf0a0 ...&gt;, @cond=#&lt;Thread::ConditionVariable:0x007fe85c2ced30&gt;&gt;, @committed=false, @sending=false, @sent=false, @content_type=nil, @charset=nil, @cache_control={}, @etag=nil&gt;, "params"=&gt;{}}, @_controller=#&lt;ActionView::TestCase::TestController:0x007fe85c35e200 @_action_has_layout=true, @_routes=nil, @_headers={"Content-Type"=&gt;"text/html"}, @_status=200, @_request=nil, @_response=nil, @request=#&lt;ActionController::TestRequest:0x007fe85c35e048 @env={"rack.version"=&gt;[1, 3], "rack.input"=&gt;#&lt;StringIO:0x007fe85f87eca0&gt;, "rack.errors"=&gt;#&lt;StringIO:0x007fe85f87ed40&gt;, "rack.multithread"=&gt;true, "rack.multiprocess"=&gt;true, "rack.run_once"=&gt;false, "REQUEST_METHOD"=&gt;"GET", "SERVER_NAME"=&gt;"example.org", "SERVER_PORT"=&gt;"80", "QUERY_STRING"=&gt;"", "rack.url_scheme"=&gt;"http", "HTTPS"=&gt;"off", "SCRIPT_NAME"=&gt;"", "CONTENT_LENGTH"=&gt;"0", "HTTP_HOST"=&gt;"test.host", "REMOTE_ADDR"=&gt;"0.0.0.0", "HTTP_USER_AGENT"=&gt;"Rails Testing", "action_dispatch.routes"=&gt;#&lt;ActionDispatch::Routing::RouteSet:0x007fe85c6713e8&gt;, "action_dispatch.parameter_filter"=&gt;[:password], "action_dispatch.redirect_filter"=&gt;[], "action_dispatch.secret_token"=&gt;nil, "action_dispatch.secret_key_base"=&gt;"eb526d7f4b0c06b367225a0d32ba8b3c3287ea6d6de798961e6fe33b975d44c2cd3ae9f314f0b96c73029f052d4670bc5a4db850ffc6a73586043089f57bdb3b", "action_dispatch.show_exceptions"=&gt;false, "action_dispatch.show_detailed_exceptions"=&gt;true, "action_dispatch.logger"=&gt;#&lt;ActiveSupport::Logger:0x007fe85d32d528 @progname=nil, @level=0, @default_formatter=#&lt;Logger::Formatter:0x007fe85d32d4b0 @datetime_format=nil&gt;, @formatter=#&lt;ActiveSupport::Logger::SimpleFormatter:0x007fe85d2fc928 @datetime_format=nil&gt;, @logdev=#&lt;Logger::LogDevice:0x007fe85d32d460 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#&lt;File:/Users/et/Documents/projects/test-blog/log/test.log&gt;, @mutex=#&lt;Logger::LogDevice::LogDeviceMutex:0x007fe85d32d438 @mon_owner=nil, @mon_count=0, @mon_mutex=#&lt;Mutex:0x007fe85d32d3e8&gt;&gt;&gt;&gt;, "action_dispatch.backtrace_cleaner"=&gt;#&lt;Rails::BacktraceCleaner:0x007fe85c2f4aa8 @filters=[#&lt;Proc:0x007fe85c2f4878@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:14&gt;, #&lt;Proc:0x007fe85c2f4850@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:15&gt;, #&lt;Proc:0x007fe85c2f47d8@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:16&gt;, #&lt;Proc:0x007fe85c2f5750@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:29&gt;], @silencers=[#&lt;Proc:0x007fe85c2f59a8@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:19&gt;], @root="/Users/et/Documents/projects/test-blog/"&gt;, "action_dispatch.key_generator"=&gt;#&lt;ActiveSupport::CachingKeyGenerator:0x007fe85f4cc580 @key_generator=#&lt;ActiveSupport::KeyGenerator:0x007fe85f4cc5a8 @secret="eb526d7f4b0c06b367225a0d32ba8b3c3287ea6d6de798961e6fe33b975d44c2cd3ae9f314f0b96c73029f052d4670bc5a4db850ffc6a73586043089f57bdb3b", @iterations=1000&gt;, @cache_keys=#&lt;ThreadSafe::Cache:0x007fe85f4cc558 @backend={"signed_global_ids64"=&gt;"0\xF4/#*5\xF2\x0F\xB2\x101\v~\xC5\x89\xFF\xDB\x11\xCB(U\xFA\xF87\x13Evz:\xAD\xD6\xA3r\x96\x9A\x82\x17\x84\tR\xF2A\xADV\x85u?^N\xBCT\x84\x10\x11\xD9\xC9&gt;n\xA1\f\x06\xAAuU"}, @default_proc=nil&gt;&gt;, "action_dispatch.http_auth_salt"=&gt;"http authentication", "action_dispatch.signed_cookie_salt"=&gt;"signed cookie", "action_dispatch.encrypted_cookie_salt"=&gt;"encrypted cookie", "action_dispatch.encrypted_signed_cookie_salt"=&gt;"signed encrypted cookie", "action_dispatch.cookies_serializer"=&gt;:json, "action_dispatch.cookies_digest"=&gt;nil, "rack.session"=&gt;{}, "rack.session.options"=&gt;{:key=&gt;"rack.session", :path=&gt;"/", :domain=&gt;nil, :expire_after=&gt;nil, :secure=&gt;false, :httponly=&gt;true, :defer=&gt;false, :renew=&gt;false, :sidbits=&gt;128, :cookie_only=&gt;true, :secure_random=&gt;SecureRandom, :id=&gt;"8a8b5f8906289bb00109022394af0832"}, "action_dispatch.request.path_parameters"=&gt;{:controller=&gt;"account/articles", :action=&gt;"new"}}, @filtered_parameters=nil, @filtered_env=nil, @filtered_path=nil, @protocol=nil, @port=nil, @method=nil, @request_method=nil, @remote_ip=nil, @original_fullpath=nil, @fullpath=nil, @ip=nil, @uuid=nil&gt;, @response=#&lt;ActionController::TestResponse:0x007fe85c2cf0a0 @mon_owner=nil, @mon_count=0, @mon_mutex=#&lt;Mutex:0x007fe85c2cef38&gt;, @stream=#&lt;ActionDispatch::Response::Buffer:0x007fe85c2cedd0 @response=#&lt;ActionController::TestResponse:0x007fe85c2cf0a0 ...&gt;, @buf=[], @closed=false&gt;, @header={"X-Frame-Options"=&gt;"SAMEORIGIN", "X-XSS-Protection"=&gt;"1; mode=block", "X-Content-Type-Options"=&gt;"nosniff"}, @status=200, @sending_file=false, @blank=false, @cv=#&lt;MonitorMixin::ConditionVariable:0x007fe85c2ced58 @monitor=#&lt;ActionController::TestResponse:0x007fe85c2cf0a0 ...&gt;, @cond=#&lt;Thread::ConditionVariable:0x007fe85c2ced30&gt;&gt;, @committed=false, @sending=false, @sent=false, @content_type=nil, @charset=nil, @cache_control={}, @etag=nil&gt;, @params={}, @_view_context_class=#&lt;Class:0x007fe85c2c7620&gt;, @_lookup_context=#&lt;ActionView::LookupContext:0x007fe85d1615a0 @details_key=nil, @details={:locale=&gt;[:en], :formats=&gt;[:html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :variants=&gt;[], :handlers=&gt;[:erb, :builder, :raw, :ruby, :coffee, :jbuilder, :haml]}, @skip_default_locale=false, @cache=true, @prefixes=["", "account/articles"], @rendered_format=nil, @view_paths=#&lt;ActionView::PathSet:0x007fe85d1614d8 @paths=[#&lt;ActionView::OptimizedFileSystemResolver:0x007fe85d37fb48 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @cache=#&lt;ActionView::Resolver::Cache:0x007fe85d37fb20 @data=#&lt;ActionView::Resolver::Cache::SmallCache:0x007fe85d37faf8 @backend={}, @default_proc=#&lt;Proc:0x007fe85f071198@/Users/et/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5/lib/action_view/template/resolver.rb:49 (lambda)&gt;&gt;&gt;, @path="/Users/et/Documents/projects/test-blog/app/views"&gt;, #&lt;ActionView::OptimizedFileSystemResolver:0x007fe85d37feb8 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @cache=#&lt;ActionView::Resolver::Cache:0x007fe85d37fe90 @data=#&lt;ActionView::Resolver::Cache::SmallCache:0x007fe85d37fe68 @backend={}, @default_proc=#&lt;Proc:0x007fe85f071198@/Users/et/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5/lib/action_view/template/resolver.rb:49 (lambda)&gt;&gt;&gt;, @path="/Users/et/.rvm/gems/ruby-2.2.2/gems/devise-3.5.3/app/views"&gt;]&gt;&gt;, @_view_renderer=#&lt;ActionView::Renderer:0x007fe85d1613c0 @lookup_context=#&lt;ActionView::LookupContext:0x007fe85d1615a0 @details_key=nil, @details={:locale=&gt;[:en], :formats=&gt;[:html, :text, :js, :css, :ics, :csv, :vcf, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :variants=&gt;[], :handlers=&gt;[:erb, :builder, :raw, :ruby, :coffee, :jbuilder, :haml]}, @skip_default_locale=false, @cache=true, @prefixes=["", "account/articles"], @rendered_format=nil, @view_paths=#&lt;ActionView::PathSet:0x007fe85d1614d8 @paths=[#&lt;ActionView::OptimizedFileSystemResolver:0x007fe85d37fb48 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @cache=#&lt;ActionView::Resolver::Cache:0x007fe85d37fb20 @data=#&lt;ActionView::Resolver::Cache::SmallCache:0x007fe85d37faf8 @backend={}, @default_proc=#&lt;Proc:0x007fe85f071198@/Users/et/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5/lib/action_view/template/resolver.rb:49 (lambda)&gt;&gt;&gt;, @path="/Users/et/Documents/projects/test-blog/app/views"&gt;, #&lt;ActionView::OptimizedFileSystemResolver:0x007fe85d37feb8 @pattern=":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:handlers,}", @cache=#&lt;ActionView::Resolver::Cache:0x007fe85d37fe90 @data=#&lt;ActionView::Resolver::Cache::SmallCache:0x007fe85d37fe68 @backend={}, @default_proc=#&lt;Proc:0x007fe85f071198@/Users/et/.rvm/gems/ruby-2.2.2/gems/actionview-4.2.5/lib/action_view/template/resolver.rb:49 (lambda)&gt;&gt;&gt;, @path="/Users/et/.rvm/gems/ruby-2.2.2/gems/devise-3.5.3/app/views"&gt;]&gt;&gt;&gt;, @_config={}&gt;, @_request=#&lt;ActionController::TestRequest:0x007fe85c35e048 @env={"rack.version"=&gt;[1, 3], "rack.input"=&gt;#&lt;StringIO:0x007fe85f87eca0&gt;, "rack.errors"=&gt;#&lt;StringIO:0x007fe85f87ed40&gt;, "rack.multithread"=&gt;true, "rack.multiprocess"=&gt;true, "rack.run_once"=&gt;false, "REQUEST_METHOD"=&gt;"GET", "SERVER_NAME"=&gt;"example.org", "SERVER_PORT"=&gt;"80", "QUERY_STRING"=&gt;"", "rack.url_scheme"=&gt;"http", "HTTPS"=&gt;"off", "SCRIPT_NAME"=&gt;"", "CONTENT_LENGTH"=&gt;"0", "HTTP_HOST"=&gt;"test.host", "REMOTE_ADDR"=&gt;"0.0.0.0", "HTTP_USER_AGENT"=&gt;"Rails Testing", "action_dispatch.routes"=&gt;#&lt;ActionDispatch::Routing::RouteSet:0x007fe85c6713e8&gt;, "action_dispatch.parameter_filter"=&gt;[:password], "action_dispatch.redirect_filter"=&gt;[], "action_dispatch.secret_token"=&gt;nil, "action_dispatch.secret_key_base"=&gt;"eb526d7f4b0c06b367225a0d32ba8b3c3287ea6d6de798961e6fe33b975d44c2cd3ae9f314f0b96c73029f052d4670bc5a4db850ffc6a73586043089f57bdb3b", "action_dispatch.show_exceptions"=&gt;false, "action_dispatch.show_detailed_exceptions"=&gt;true, "action_dispatch.logger"=&gt;#&lt;ActiveSupport::Logger:0x007fe85d32d528 @progname=nil, @level=0, @default_formatter=#&lt;Logger::Formatter:0x007fe85d32d4b0 @datetime_format=nil&gt;, @formatter=#&lt;ActiveSupport::Logger::SimpleFormatter:0x007fe85d2fc928 @datetime_format=nil&gt;, @logdev=#&lt;Logger::LogDevice:0x007fe85d32d460 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#&lt;File:/Users/et/Documents/projects/test-blog/log/test.log&gt;, @mutex=#&lt;Logger::LogDevice::LogDeviceMutex:0x007fe85d32d438 @mon_owner=nil, @mon_count=0, @mon_mutex=#&lt;Mutex:0x007fe85d32d3e8&gt;&gt;&gt;&gt;, "action_dispatch.backtrace_cleaner"=&gt;#&lt;Rails::BacktraceCleaner:0x007fe85c2f4aa8 @filters=[#&lt;Proc:0x007fe85c2f4878@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:14&gt;, #&lt;Proc:0x007fe85c2f4850@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:15&gt;, #&lt;Proc:0x007fe85c2f47d8@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:16&gt;, #&lt;Proc:0x007fe85c2f5750@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:29&gt;], @silencers=[#&lt;Proc:0x007fe85c2f59a8@/Users/et/.rvm/gems/ruby-2.2.2/gems/railties-4.2.5/lib/rails/backtrace_cleaner.rb:19&gt;], @root="/Users/et/Documents/projects/test-blog/"&gt;, "action_dispatch.key_generator"=&gt;#&lt;ActiveSupport::CachingKeyGenerator:0x007fe85f4cc580 @key_generator=#&lt;ActiveSupport::KeyGenerator:0x007fe85f4cc5a8 @secret="eb526d7f4b0c06b367225a0d32ba8b3c3287ea6d6de798961e6fe33b975d44c2cd3ae9f314f0b96c73029f052d4670bc5a4db850ffc6a73586043089f57bdb3b", @iterations=1000&gt;, @cache_keys=#&lt;ThreadSafe::Cache:0x007fe85f4cc558 @backend={"signed_global_ids64"=&gt;"0\xF4/#*5\xF2\x0F\xB2\x101\v~\xC5\x89\xFF\xDB\x11\xCB(U\xFA\xF87\x13Evz:\xAD\xD6\xA3r\x96\x9A\x82\x17\x84\tR\xF2A\xADV\x85u?^N\xBCT\x84\x10\x11\xD9\xC9&gt;n\xA1\f\x06\xAAuU"}, @default_proc=nil&gt;&gt;, "action_dispatch.http_auth_salt"=&gt;"http authentication", "action_dispatch.signed_cookie_salt"=&gt;"signed cookie", "action_dispatch.encrypted_cookie_salt"=&gt;"encrypted cookie", "action_dispatch.encrypted_signed_cookie_salt"=&gt;"signed encrypted cookie", "action_dispatch.cookies_serializer"=&gt;:json, "action_dispatch.cookies_digest"=&gt;nil, "rack.session"=&gt;{}, "rack.session.options"=&gt;{:key=&gt;"rack.session", :path=&gt;"/", :domain=&gt;nil, :expire_after=&gt;nil, :secure=&gt;false, :httponly=&gt;true, :defer=&gt;false, :renew=&gt;false, :sidbits=&gt;128, :cookie_only=&gt;true, :secure_random=&gt;SecureRandom, :id=&gt;"8a8b5f8906289bb00109022394af0832"}, "action_dispatch.request.path_parameters"=&gt;{:controller=&gt;"account/articles", :action=&gt;"new"}}, @filtered_parameters=nil, @filtered_env=nil, @filtered_path=nil, @protocol=nil, @port=nil, @method=nil, @request_method=nil, @remote_ip=nil, @original_fullpath=nil, @fullpath=nil, @ip=nil, @uuid=nil&gt;, @view_flow=#&lt;ActionView::OutputFlow:0x007fe85a962d88 @content={}&gt;, @output_buffer="", @virtual_path=nil, @rendered_views=#&lt;ActionView::TestCase::Behavior::RenderedViewsCollection:0x007fe85a962b30 @rendered_views={}&gt;&gt; does not implement: article
       # ./spec/views/account/articles/new.html.haml_spec.rb:6:in `block (2 levels) in &lt;top (required)&gt;'
  
  Finished in 1.11 seconds (files took 6.26 seconds to load)
  1 example, 1 failure
  
  Failed examples:
  
  rspec ./spec/views/account/articles/new.html.haml_spec.rb:9 # account/articles/new renders new article form
  </code></pre>