Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Nov 10, 2017
2 parents 8ff7728 + b7d48d3 commit 91a2fc5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/co/comdor/github/Language.java
Expand Up @@ -86,8 +86,8 @@ abstract class Language {
String categorize(final Mention mention) throws IOException {
final Set<Object> keys = this.commands.keySet();
String type = "unknown";
boolean match = true;
for(final Object key : keys) {
boolean match = true;
final String keyString = (String) key;
final String[] words = this.commands.getProperty(keyString, "")
.split("\\^");
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/responses_en.properties
@@ -1,13 +1,13 @@
hello.comment=@%s Hi there! I'm only version `0.0.2`, so I can't do much yet. Follow me and [my website](http://comdor.co) for updates on the next version.

run.comment.started=@%s I received your command, but I am only version `0.0.2`, I cannot run it yet.\
run.comment.started=@%s I received your command, but I am only version `0.0.2`, I cannot run it yet. \
Follow me and [my website](http://comdor.co) for updates on the next version.

architects.approval=@%s Thank you for the command!\n\n\
%s Please approve this.

architects.missing=@%s For this command there has to be at least one architect defined,\
whom I should ask for approval! More details [here]().
architects.missing=@%s For this command there has to be at least one architect defined (via ``.comdor.yml``), \
whom I should ask for approval! More details [here](http://comdor.co/config.html).

author.no.rights=@%s Only commanders or architects can give such a command! More details [here](http://www.comdor.co/config.html).

Expand Down
29 changes: 29 additions & 0 deletions src/test/java/co/comdor/github/EnglishTestCase.java
Expand Up @@ -74,6 +74,35 @@ public void categorizesHelloCommands() throws Exception {
);
}

/**
* A 'run' comment is understood.
*/
@Test
public void categorizesRunCommands() throws Exception {
final Mention run1 = this.mockMention("@comdor, run ``cloc .`` pls");
final Mention run2 = this.mockMention("@comdor, run it");
final Mention run3 = this.mockMention("@comdor pls run ``mvn clean``");
final Mention run4 = this.mockMention("@comdor run");
final Mention run5 = this.mockMention("@comdor run?");

final Language english = new English();
MatcherAssert.assertThat(
english.categorize(run1), Matchers.equalTo("run")
);
MatcherAssert.assertThat(
english.categorize(run2), Matchers.equalTo("run")
);
MatcherAssert.assertThat(
english.categorize(run3), Matchers.equalTo("run")
);
MatcherAssert.assertThat(
english.categorize(run4), Matchers.equalTo("run")
);
MatcherAssert.assertThat(
english.categorize(run5), Matchers.equalTo("run")
);
}

/**
* A comment is not understood.
*/
Expand Down

0 comments on commit 91a2fc5

Please sign in to comment.