Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6734131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:51:08+00:00 2026-05-26T10:51:08+00:00

I have a requests spec that makes multiple calls to visit within a single

  • 0

I have a requests spec that makes multiple calls to visit within a single block (visits ‘/sessions/new’ and visits ‘/admin’). This results in:

ActionView::Template::Error:
       undefined local variable or method `view_factory' for #<#<Class:0x007fedda1d5180>:0x007fedda1bb118>

Any way to fix this? Thanks. The code is:

describe "Admin" do

  before do
    visit new_session_path
    fill_in "Email",    with: user.email
    fill_in "Password", with: user.password
    click_button "Submit"
  end

  describe "GET /admin" do
    it "should be successful" do
      visit admin_dashboard_path
    end
  end

end

Update:

After some searching, I found that the errors only occure when running with Spork. Here is my spec_helper.rb flile that configures Spork:

require 'rubygems'
require 'spork'
require 'simplecov'

ENV["RAILS_ENV"] ||= 'test'

SimpleCov.start if ENV["COVERAGE"]

Spork.prefork do

  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'
  require 'capybara/rspec'

  Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

  RSpec.configure do |config|
    config.mock_with :mocha

    config.include Auth::Helper
  end

end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:51:09+00:00Added an answer on May 26, 2026 at 10:51 am

    I had a similar problem and found a little workaround. I assume that view_factory is a helper method defined in a plugin and it is included to the application helper with something like ActionController::Base.helper FactoryHelperModule.

    What I did was to include the following snippet to my app/helpers/application_helper.rb:

    if Rails.env.test?
      include FactoryHelperModule
    end
    

    If the helper methods are in a module and if the helper methods are declared like mine, there is a chance that this will work. I haven’t found yet why this happens though.

    Btw, I am on rails 3.0.4 and spork 0.9.0.rc9

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that sends multiple Ajax requests simultaneously. I was originally running
I know that if I want to have requests for MyPage.aspx go to the
I have a desktop written with Winforms. Now I have requests that people want
I have had many requests come in to a project that I work on,
I have a PHP client that requests an XML file over HTTP (i.e. loads
Im using capybara for my integration/acceptance tests. They're in /spec/requests/ folder. Now I have
I have 2 tables requests ( ID , company_id , amount ) companies (
I have an application in which most requests are submitted via AJAX, though some
I have a website where all requests are redirected silently (via .htaccess ) to
I have no problems processing jQuery GET requests in a controller, however I cannot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.