Sha256: 2404691368fe8eb3f22b98ca7a745972b0d8b9c48dd201d2d57a16bfae8f0fe7

Contents?: true

Size: 878 Bytes

Versions: 5

Compression:

Stored size: 878 Bytes

Contents

require 'test_helper'

class BooksControllerTest < ActionDispatch::IntegrationTest
  setup do
    @book = books(:one)
  end

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

  test "should create book" do
    assert_difference('Book.count') do
      post books_url, params: { book: { label: @book.label, name: @book.name, value: @book.value } }, as: :json
    end

    assert_response 201
  end

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

  test "should update book" do
    patch book_url(@book), params: { book: { label: @book.label, name: @book.name, value: @book.value } }, as: :json
    assert_response 200
  end

  test "should destroy book" do
    assert_difference('Book.count', -1) do
      delete book_url(@book), as: :json
    end

    assert_response 204
  end
end

Version data entries

5 entries across 2 versions & 1 rubygems

Version Path
yamls-0.2.2 example/rails-demo/test/controllers/books_controller_test.rb
yamls-0.2.2 example/rails5/test/controllers/books_controller_test.rb
yamls-0.2.2 example/rails6.0.0/test/controllers/books_controller_test.rb
yamls-0.2.1 example/rails5/test/controllers/books_controller_test.rb
yamls-0.2.1 example/rails6.0.0/test/controllers/books_controller_test.rb