Sha256: 6438e64e377b29591bc45efa098a85a3e0cf482b1261ed9c1b38ff548804ba08

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

require 'test_helper'

class BooksControllerTest < ActionController::TestCase
  setup do
    @book = books(:one)
  end

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:books)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

  test "should create book" do
    assert_difference('Book.count') do
      post :create, book: { author: @book.author, description: @book.description, discounted: @book.discounted, price: @book.price, published_at: @book.published_at, title: @book.title }
    end

    assert_redirected_to book_path(assigns(:book))
  end

  test "should show book" do
    get :show, id: @book
    assert_response :success
  end

  test "should get edit" do
    get :edit, id: @book
    assert_response :success
  end

  test "should update book" do
    patch :update, id: @book, book: { author: @book.author, description: @book.description, discounted: @book.discounted, price: @book.price, published_at: @book.published_at, title: @book.title }
    assert_redirected_to book_path(assigns(:book))
  end

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

    assert_redirected_to books_path
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
skins-0.0.3 test/dummy/test/controllers/books_controller_test.rb
skins-0.0.2 test/dummy/test/controllers/books_controller_test.rb
skins-0.0.1 test/dummy/test/controllers/books_controller_test.rb