rails-acnh-randomizer / test / controllers / acnh_villagers_controller_test.rb
acnh_villagers_controller_test.rb
Raw
require "test_helper"

class AcnhVillagersControllerTest < ActionDispatch::IntegrationTest
  setup do
    @acnh_villager = acnh_villagers(:one)
  end

  test "should get index" do
    get acnh_villagers_url, as: :json
    assert_response :success
  end

  test "should create acnh_villager" do
    assert_difference("AcnhVillager.count") do
      post acnh_villagers_url, params: { acnh_villager: { birthday: @acnh_villager.birthday, bubblecolor: @acnh_villager.bubblecolor, catchphrase: @acnh_villager.catchphrase, gender: @acnh_villager.gender, hobby: @acnh_villager.hobby, iconuri: @acnh_villager.iconuri, imageuri: @acnh_villager.imageuri, name: @acnh_villager.name, personality: @acnh_villager.personality, species: @acnh_villager.species, string: @acnh_villager.string, textcolor: @acnh_villager.textcolor } }, as: :json
    end

    assert_response :created
  end

  test "should show acnh_villager" do
    get acnh_villager_url(@acnh_villager), as: :json
    assert_response :success
  end

  test "should update acnh_villager" do
    patch acnh_villager_url(@acnh_villager), params: { acnh_villager: { birthday: @acnh_villager.birthday, bubblecolor: @acnh_villager.bubblecolor, catchphrase: @acnh_villager.catchphrase, gender: @acnh_villager.gender, hobby: @acnh_villager.hobby, iconuri: @acnh_villager.iconuri, imageuri: @acnh_villager.imageuri, name: @acnh_villager.name, personality: @acnh_villager.personality, species: @acnh_villager.species, string: @acnh_villager.string, textcolor: @acnh_villager.textcolor } }, as: :json
    assert_response :success
  end

  test "should destroy acnh_villager" do
    assert_difference("AcnhVillager.count", -1) do
      delete acnh_villager_url(@acnh_villager), as: :json
    end

    assert_response :no_content
  end
end