Fix specs.

This commit is contained in:
Guo Xiang Tan 2016-08-19 16:46:03 +08:00
parent e1475f4c5c
commit 891be329d7
1 changed files with 21 additions and 7 deletions

View File

@ -29,13 +29,27 @@ describe DataExplorer::QueryController do
end
it 'denies every request' do
get :index; expect(response.body).to be_empty # check_xhr fail
expect { xhr :get, :index }.to raise_error ApplicationController::PluginDisabled
expect { xhr :get, :schema }.to raise_error ApplicationController::PluginDisabled
expect { xhr :get, :show, id: 3 }.to raise_error ApplicationController::PluginDisabled
expect { xhr :post, :create, id: 3 }.to raise_error ApplicationController::PluginDisabled
expect { xhr :post, :run, id: 3 }.to raise_error ApplicationController::PluginDisabled
expect { xhr :put, :update, id: 3 }.to raise_error ApplicationController::PluginDisabled
expect { xhr :delete, :destroy, id: 3 }.to raise_error ApplicationController::PluginDisabled
xhr :get, :index
expect(response.status).to eq(404)
xhr :get, :schema
expect(response.status).to eq(404)
xhr :get, :show, id: 3
expect(response.status).to eq(404)
xhr :post, :create, id: 3
expect(response.status).to eq(404)
xhr :post, :run, id: 3
expect(response.status).to eq(404)
xhr :put, :update, id: 3
expect(response.status).to eq(404)
xhr :delete, :destroy, id: 3
expect(response.status).to eq(404)
end
end