Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/domain/time_entry/description_rules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ def valid?
private

def has_word_count?
@description.split.size > MIN_WORD_COUNT - 1
if has_jira_ticket?
@description.split.size > 1
else
@description.split.size > 0
end
end

def has_calls_tag?
Expand Down Expand Up @@ -45,4 +49,4 @@ def internal_employee
has_word_count? && (has_calls_tag? || has_url? || has_jira_ticket?)
end
end
end
end
24 changes: 3 additions & 21 deletions spec/domain/time_entry/description_rules_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,12 @@
expect(validator.valid?).to eql(true)
end

it "will pass if it has a keyword" do
entry = Entry.new(description: "This is an English class entry")
validator = TimeEntry::DescriptionRules.new(entry)
expect(validator.valid?).to eql(true)

Comment thread
aisayo marked this conversation as resolved.
entry = Entry.new(description: "1:1 with Amanda entry")
validator = TimeEntry::DescriptionRules.new(entry)
expect(validator.valid?).to eql(true)

entry = Entry.new(description: "Email/Slack catch up entry")
validator = TimeEntry::DescriptionRules.new(entry)
expect(validator.valid?).to eql(true)
end

it "will fail if too short" do
entry = Entry.new(description: "[OSS-136]: added")
validator = TimeEntry::DescriptionRules.new(entry)
expect(validator.valid?).to eql(false)

entry = Entry.new(description: "http://www.example.com added")
entry = Entry.new(description: "[OSS-136]")
validator = TimeEntry::DescriptionRules.new(entry)
expect(validator.valid?).to eql(false)

entry = Entry.new(description: "#calls added")
entry = Entry.new(description: "")
validator = TimeEntry::DescriptionRules.new(entry)
expect(validator.valid?).to eql(false)
end
Expand All @@ -80,4 +62,4 @@
end
end
end
end
end