Kent

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

I am currently using rails 6. When I run the Rspec system testing, the API cannot pass data to my index page. Here is my test code:
require "rails_helper"
require_relative "../support/devise"

RSpec.feature "Dash Chart", type: :system, js: true do
  let!(:user) { create(:user) }

  it "should show the chart with data" do
  visit "/users/sign_in"

  fill_in "Email", with: "chris@wallstpigeon.com"
  fill_in "Password", with: "password"
  click_button "Log in"

  visit "/dashboard"

  click_button "Search"
  expect(page).to have_content("Search")


 end

end
And the error is:

Dash Chart should show the chart with data
Failure/Error: @index_chartdata ||= @raw_chartdata.map { |n| [n["minute"], n["close"]] }

NoMethodError:
undefined method `map' for nil:NilClass

The map function aim to get specific chart data from API response body.