Fix broken spec and linting errors
This commit is contained in:
parent
30fe9289b8
commit
588391cb2f
|
@ -694,7 +694,7 @@ SQL
|
||||||
check_params!
|
check_params!
|
||||||
return save_default_query if @id && @id < 0
|
return save_default_query if @id && @id < 0
|
||||||
|
|
||||||
@id = @id ||self.class.alloc_id
|
@id = @id || self.class.alloc_id
|
||||||
DataExplorer.pstore_set "q:#{id}", to_hash
|
DataExplorer.pstore_set "q:#{id}", to_hash
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -282,7 +282,7 @@ describe DataExplorer::QueryController do
|
||||||
|
|
||||||
it "only returns queries that the group has access to" do
|
it "only returns queries that the group has access to" do
|
||||||
group.add(user)
|
group.add(user)
|
||||||
make_query('SELECT 1 as value', {name: 'A'}, ["#{group.id}"])
|
make_query('SELECT 1 as value', { name: 'A' }, ["#{group.id}"])
|
||||||
|
|
||||||
get :group_reports_index, params: { group_name: group.name }, format: :json
|
get :group_reports_index, params: { group_name: group.name }, format: :json
|
||||||
expect(response.status).to eq(200)
|
expect(response.status).to eq(200)
|
||||||
|
@ -310,7 +310,7 @@ describe DataExplorer::QueryController do
|
||||||
|
|
||||||
describe "#group_reports_run" do
|
describe "#group_reports_run" do
|
||||||
it "calls run on QueryController" do
|
it "calls run on QueryController" do
|
||||||
query = make_query('SELECT 1 as value', {name: 'B'}, ["#{group.id}"])
|
query = make_query('SELECT 1 as value', { name: 'B' }, ["#{group.id}"])
|
||||||
controller.expects(:run).at_least_once
|
controller.expects(:run).at_least_once
|
||||||
|
|
||||||
get :group_reports_run, params: { group_name: group.name, id: query.id }, format: :json
|
get :group_reports_run, params: { group_name: group.name, id: query.id }, format: :json
|
||||||
|
@ -362,4 +362,3 @@ describe DataExplorer::QueryController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe Guardian do
|
describe Guardian do
|
||||||
|
|
||||||
|
before { SiteSetting.data_explorer_enabled = true }
|
||||||
|
|
||||||
def make_query(group_ids = [])
|
def make_query(group_ids = [])
|
||||||
q = DataExplorer::Query.new
|
q = DataExplorer::Query.new
|
||||||
q.id = Fabrication::Sequencer.sequence("query-id", 1)
|
q.id = Fabrication::Sequencer.sequence("query-id", 1)
|
||||||
q.name ="Query number #{q.id}"
|
q.name = "Query number #{q.id}"
|
||||||
q.sql = "SELECT 1"
|
q.sql = "SELECT 1"
|
||||||
q.group_ids = group_ids
|
q.group_ids = group_ids
|
||||||
q.save
|
q.save
|
||||||
|
|
Loading…
Reference in New Issue