Skip to content

Route helpers are not defined in helper and view specs #1644

@beydogan

Description

@beydogan

I've just upgraded my Rails version from 4.2.6 to 5.0.0.rc1 and using RSpec version 3.5.0.beta4(was 3.3.3).

Problem is; I have a method which calls root_path in my helper and paths are not defined in helper specs. Issue started after version upgrade.

I'm getting the following error when I run my helper spec;

NoMethodError: undefined method `root_path' for #<#<Class:0x00000002749080>:0x00000011f3e650>

I've tried to add following line to my helper;

include Rails.application.routes.url_helpers

But now error is the following;

NameError: undefined local variable or method `default_url_options' for #<#<Class:0x00000001efa550>:0x0000001784ccd8>

How can I define path helpers for helper specs or default_url_options?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions