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

  • Home
  • SEARCH
  • 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 6364293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:08:44+00:00 2026-05-25T00:08:44+00:00

I feel like I’m missing something pretty basic, but I can’t seem to figure

  • 0

I feel like I’m missing something pretty basic, but I can’t seem to figure it out, either.

When doing the following spec:

require 'spec_helper'

describe "/mymodel/show.html.erb" do
  before(:each) do
    @mymodel = Factory(:mymodel)
    @user = Factory(:user)
    assign(:web_tip, @mymodel)
    assign(:current_user, @user)
  end

  it "renders attributes in <p>" do
    render
    rendered.should have_text(/somevalue/)
  end
end

I get an error that the local variable current_user is undefined (the view’s layout wants to call it to show the current login status).

I’m on Rails 3, Rspec 2.6.4, and thought I was following the current docs correctly.

  • 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-25T00:08:45+00:00Added an answer on May 25, 2026 at 12:08 am

    Well, I never figured out how to get authlogic to work with this, so I monkeypatched a current_user method on the tests themselves to get it to work.

    def current_user
       Factory(:user)
    end
    

    Worked, though I’d still award an “answer” if someone can help me to di the right way.

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

Sidebar

Related Questions

I feel like this is a dumb question and I'm missing something, but I
I feel like this question ought to have been covered, but I can't seem
I feel like I must be doing something really stupid. What can I do
I feel like I'm missing something obvious... but does firebug interfere with cookie deletion?
I feel like I'm missing something here, but I have this datagrid which when
I feel like this must be an issue of me doing something silly, but
I feel like this should be obvious, and perhaps I'm totally missing something, but
I feel like I should know this, but I haven't been able to figure
I feel like i am completely missing something because I am not able to
I feel like I'm missing something simple here (as usual). I'm trying to read

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.