Sha256: 2a21cc2f4f6efe24a4fad8f2f6212b65658861571b9f85c914cb7e1e0ba172fa
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
require 'test_helper' require 'papercat/api/documents_controller' module Papercat module Api class DocumentsControllerTest < ActionController::TestCase setup do @routes = Engine.routes @record = papercat_documents(:document_1) end test "should get index" do # sign_in :account, @admin xhr :get, :index, {format: :json} assert_response :success assert_not_nil assigns(:collection) end test "should create document" do assert_difference('Document.count') do xhr :post, :create, {format: :json, document: @record.data.dup} end assert_not_nil assigns(:record) end test "should show document" do # sign_in :account, @admin xhr :get, :show, {format: :json, id: @record.id} assert_response :success assert_not_nil assigns(:record) end test "should update document" do # sign_in :account, @admin xhr :patch, :update, {format: :json, id: @record.id, document: @record.data.dup} assert_not_nil assigns(:record) end test "should destroy document" do # sign_in :account, @admin assert_difference('Document.count', -1) do xhr :delete, :destroy, {format: :json, id: @record.id} end assert_not_nil assigns(:record) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
papercat-0.0.2 | test/controllers/papercat/api/documents_controller_test.rb |