mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-15 13:45:25 +08:00
7f7bf0533a
* Fix tests [SCI-6486] * Fix rspec tests [SCI-6486] Co-authored-by: Anton <anton@scinote.net>
58 lines
1.3 KiB
Ruby
58 lines
1.3 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe Api::V1::ConnectionsController, type: :controller do
|
|
include PermissionExtends
|
|
|
|
it_behaves_like "a controller with authentication", {
|
|
index: {
|
|
team_id: 1,
|
|
project_id: 1,
|
|
experiment_id: 1,
|
|
},
|
|
show: {
|
|
team_id: 1,
|
|
project_id: 1,
|
|
experiment_id: 1,
|
|
id: 1
|
|
}
|
|
}, [:create, :destroy],
|
|
:unauthorized
|
|
|
|
|
|
describe 'permissions checking' do
|
|
login_api_user
|
|
|
|
include_context 'reference_project_structure', {
|
|
team_role: :normal_user,
|
|
my_modules: 2,
|
|
connection: true
|
|
}
|
|
|
|
it_behaves_like "a controller action with permissions checking", :get, :index do
|
|
let(:testable) { experiment }
|
|
let(:permissions) { [ExperimentPermissions::READ] }
|
|
let(:action_params) {
|
|
{
|
|
team_id: team.id,
|
|
project_id: project.id,
|
|
experiment_id: experiment.id
|
|
}
|
|
}
|
|
end
|
|
|
|
it_behaves_like "a controller action with permissions checking", :get, :show do
|
|
let(:testable) { my_module }
|
|
let(:permissions) { [ExperimentPermissions::READ] }
|
|
let(:action_params) {
|
|
{
|
|
team_id: team.id,
|
|
project_id: project.id,
|
|
experiment_id: experiment.id,
|
|
id: connection.id
|
|
}
|
|
}
|
|
end
|
|
end
|
|
end
|