Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit b8891ad

Browse files
authored
[PEC-12] fix word min count (#123)
* Update min word requirements to avoid wrong flag * add specs for new min word requirement
1 parent a9caf5e commit b8891ad

2 files changed

Lines changed: 9 additions & 23 deletions

File tree

app/domain/time_entry/description_rules.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ def valid?
1616
private
1717

1818
def has_word_count?
19-
@description.split.size > MIN_WORD_COUNT - 1
19+
if has_jira_ticket?
20+
@description.split.size > 1
21+
else
22+
@description.split.size > 0
23+
end
2024
end
2125

2226
def has_calls_tag?
@@ -45,4 +49,4 @@ def internal_employee
4549
has_word_count? && (has_calls_tag? || has_url? || has_jira_ticket?)
4650
end
4751
end
48-
end
52+
end

spec/domain/time_entry/description_rules_spec.rb

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,12 @@
4545
expect(validator.valid?).to eql(true)
4646
end
4747

48-
it "will pass if it has a keyword" do
49-
entry = Entry.new(description: "This is an English class entry")
50-
validator = TimeEntry::DescriptionRules.new(entry)
51-
expect(validator.valid?).to eql(true)
52-
53-
entry = Entry.new(description: "1:1 with Amanda entry")
54-
validator = TimeEntry::DescriptionRules.new(entry)
55-
expect(validator.valid?).to eql(true)
56-
57-
entry = Entry.new(description: "Email/Slack catch up entry")
58-
validator = TimeEntry::DescriptionRules.new(entry)
59-
expect(validator.valid?).to eql(true)
60-
end
61-
6248
it "will fail if too short" do
63-
entry = Entry.new(description: "[OSS-136]: added")
64-
validator = TimeEntry::DescriptionRules.new(entry)
65-
expect(validator.valid?).to eql(false)
66-
67-
entry = Entry.new(description: "http://www.example.com added")
49+
entry = Entry.new(description: "[OSS-136]")
6850
validator = TimeEntry::DescriptionRules.new(entry)
6951
expect(validator.valid?).to eql(false)
7052

71-
entry = Entry.new(description: "#calls added")
53+
entry = Entry.new(description: "")
7254
validator = TimeEntry::DescriptionRules.new(entry)
7355
expect(validator.valid?).to eql(false)
7456
end
@@ -80,4 +62,4 @@
8062
end
8163
end
8264
end
83-
end
65+
end

0 commit comments

Comments
 (0)