Controller tests error message: "ActionView::Template::Error: The asset "MyString" is not present in the asset pipeline"

Viewed 1993

This is code of test that is failing:

  test "should get index" do
    get products_url
    assert_response :success
  end

Error info is ActionView::Template::Error: The asset "MyString" is not present in the asset pipeline.

WTF?

2 Answers

Ran into the same problem but found a simple solution. First I fixed in /test/fixtures/products.yml

one:
  title: MyString
  description: MyText
  image_url: lorem.jpg
  price: 9.99

two:
  title: MyString
  description: MyText
  image_url: lorem.jpg
  price: 9.99

Lastly I actually added into my assets/images an image titled "lorem.jpg". I found it confusing since they don't mention this at all on the book but hopefully this little pointer it will get you back on track.

Related