Skip to content

url helpers in tests not found #682

@megatux

Description

@megatux

Hi, I have errors running the autogenerated tests for my controller. The url helpers methods are not found.

I created a new rails app this way and ran tests (some edits & other installed gems are omitted):

rails new sample-bun_tailwind_phlex_htmx -j bun -c tailwind -d sqlite3 --skip-hotwire --skip-jbuilder --skip-bootsnap`

bundle add phlex-rails
bin/rails generate phlex:install
bin/rails g phlex:controller Articles index show

# running tests:

bin/rails test
....


# Running:

E

Error:
ArticlesControllerTest#test_should_get_show:
NameError: undefined local variable or method `articles_show_url' for an instance of ArticlesControllerTest
    test/controllers/articles_controller_test.rb:12:in `block in <class:ArticlesControllerTest>'


bin/rails test test/controllers/articles_controller_test.rb:11

E

Error:
ArticlesControllerTest#test_should_get_index:
NameError: undefined local variable or method `articles_index_url' for an instance of ArticlesControllerTest
    test/controllers/articles_controller_test.rb:7:in `block in <class:ArticlesControllerTest>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions