diff --git a/app/domain/time_entry/description_rules.rb b/app/domain/time_entry/description_rules.rb index 751991f..80c938e 100644 --- a/app/domain/time_entry/description_rules.rb +++ b/app/domain/time_entry/description_rules.rb @@ -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? @@ -45,4 +49,4 @@ def internal_employee has_word_count? && (has_calls_tag? || has_url? || has_jira_ticket?) end end -end +end \ No newline at end of file diff --git a/spec/domain/time_entry/description_rules_spec.rb b/spec/domain/time_entry/description_rules_spec.rb index fcf625d..ee2e27a 100644 --- a/spec/domain/time_entry/description_rules_spec.rb +++ b/spec/domain/time_entry/description_rules_spec.rb @@ -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) - - 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 @@ -80,4 +62,4 @@ end end end -end +end \ No newline at end of file