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

Fix broken specs.

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