Commit 59fa8dca authored by Ruben Davila's avatar Ruben Davila

Fix broken specs.

parent 09e1faa8
......@@ -251,7 +251,7 @@ module SlashCommands
desc 'Set estimate'
params 'e.g: 1w 3d 2h 14m'
condition do
current_user.can?(:"admin_#{issuable.to_ability_name}", project)
current_user.can?(:"update_#{issuable.to_ability_name}", project)
end
command :estimate do |raw_duration|
@updates[:time_estimate] = ChronicDuration.parse(raw_duration, default_unit: 'hours')
......
......@@ -24,7 +24,7 @@ class AddEstimateToIssuables < ActiveRecord::Migration
# disable_ddl_transaction!
def change
add_column :issues, :time_estimate, :integer, default: 0
add_column :merge_requests, :time_estimate, :integer, default: 0
add_column_with_default :issues, :time_estimate, :integer, default: 0
add_column_with_default :merge_requests, :time_estimate, :integer, default: 0
end
end
class CreateTimelogs < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def change
create_table :timelogs do |t|
t.integer :time_spent, null: false
......
......@@ -6,6 +6,7 @@ project_tree:
- :events
- issues:
- :events
- :timelogs
- notes:
- :author
- :events
......@@ -27,6 +28,7 @@ project_tree:
- :events
- :merge_request_diff
- :events
- :timelogs
- label_links:
- label:
:priorities
......
......@@ -15,6 +15,7 @@ issues:
- events
- merge_requests_closing_issues
- metrics
- timelogs
events:
- author
- project
......@@ -80,6 +81,7 @@ merge_requests:
- approvals
- approvers
- approver_groups
- timelogs
merge_request_diff:
- merge_request
pipelines:
......@@ -207,3 +209,5 @@ award_emoji:
- user
priorities:
- label
timelogs:
- trackable
......@@ -20,6 +20,7 @@ Issue:
- lock_version
- milestone_id
- weight
- time_estimate
Event:
- id
- target_type
......@@ -151,6 +152,7 @@ MergeRequest:
- milestone_id
- approvals_before_merge
- rebase_commit_sha
- time_estimate
MergeRequestDiff:
- id
- state
......@@ -345,4 +347,11 @@ LabelPriority:
- label_id
- priority
- created_at
- updated_at
\ No newline at end of file
- updated_at
Timelog:
- id
- time_spent
- trackable_id
- trackable_type
- created_at
- updated_at
......@@ -467,6 +467,16 @@ describe SlashCommands::InterpretService, services: true do
let(:issuable) { merge_request }
end
it_behaves_like 'estimate command' do
let(:content) { '/estimate 1h' }
let(:issuable) { issue }
end
it_behaves_like 'spend command' do
let(:content) { '/spend 1h' }
let(:issuable) { issue }
end
context 'when current_user cannot :admin_issue' do
let(:visitor) { create(:user) }
let(:issue) { create(:issue, project: project, author: visitor) }
......@@ -516,16 +526,6 @@ describe SlashCommands::InterpretService, services: true do
let(:content) { '/remove_due_date' }
let(:issuable) { issue }
end
it_behaves_like 'estimate command' do
let(:content) { '/estimate 1h' }
let(:issuable) { issue }
end
it_behaves_like 'spend command' do
let(:content) { '/spend 1h' }
let(:issuable) { issue }
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment