diff --git a/app/views/cards/show.json.jbuilder b/app/views/cards/show.json.jbuilder index 0ed9bd1ad..39feca775 100644 --- a/app/views/cards/show.json.jbuilder +++ b/app/views/cards/show.json.jbuilder @@ -1,2 +1,2 @@ json.partial! "cards/card", card: @card -json.steps @card.steps, partial: "steps/step", as: :step +json.steps @card.steps, partial: "cards/steps/step", as: :step diff --git a/test/controllers/cards_controller_test.rb b/test/controllers/cards_controller_test.rb index 6ef509ac4..3800c0652 100644 --- a/test/controllers/cards_controller_test.rb +++ b/test/controllers/cards_controller_test.rb @@ -134,9 +134,14 @@ class CardsControllerTest < ActionDispatch::IntegrationTest end test "show as JSON" do - get card_path(cards(:logo)), as: :json + card = cards(:logo) + card.steps.create!(content: "First step") + card.steps.create!(content: "Second step", completed: true) + + get card_path(card), as: :json assert_response :success - assert_equal cards(:logo).title, @response.parsed_body["title"] + assert_equal card.title, @response.parsed_body["title"] + assert_equal 2, @response.parsed_body["steps"].size end test "create as JSON" do