Sha256: 95d1688b6253b68ffd8df4c7c9fa5dcb619a2232b9b0bcc3a82323bdef2a6ae3
Contents?: true
Size: 1.28 KB
Versions: 5
Compression:
Stored size: 1.28 KB
Contents
require 'test_helper' class Api::V1::PtablesControllerTest < ActionController::TestCase valid_attrs = { :name => 'ptable_test', :layout => 'd-i partman-auto/disk' } test "should get index" do get :index, { } assert_response :success assert_not_nil assigns(:ptables) ptables = ActiveSupport::JSON.decode(@response.body) assert !ptables.empty? end test "should show individual record" do get :show, { :id => ptables(:one).to_param } assert_response :success show_response = ActiveSupport::JSON.decode(@response.body) assert !show_response.empty? end test "should create ptable" do assert_difference('Ptable.count') do post :create, { :ptable => valid_attrs } end assert_response :success end test "should update ptable" do put :update, { :id => ptables(:one).to_param, :ptable => { } } assert_response :success end test "should NOT destroy ptable in use" do assert_difference('Ptable.count', -0) do delete :destroy, { :id => ptables(:one).to_param } end assert_response :unprocessable_entity end test "should destroy ptable that is NOT in use" do assert_difference('Ptable.count', -1) do delete :destroy, { :id => ptables(:four).to_param } end assert_response :success end end
Version data entries
5 entries across 5 versions & 1 rubygems