Navigation Menu

Skip to content

Commit

Permalink
implement missing step for current feature
Browse files Browse the repository at this point in the history
also refactor step definitions a little bit
  • Loading branch information
arnemertz committed Aug 20, 2021
1 parent c456b07 commit 2e83540
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions behave/CMakeLists.txt
@@ -1,7 +1,7 @@
add_test(NAME behave_stable_tests COMMAND behave -t ~skip -t ~wip
add_test(NAME behave_stable_tests COMMAND behave -t ~skip -t ~wip -k
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

add_test(NAME behave_wip_tests COMMAND behave -w
add_test(NAME behave_wip_tests COMMAND behave -t wip -k --no-capture --no-logcapture
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
4 changes: 2 additions & 2 deletions behave/issue_list_create.feature
Expand Up @@ -33,7 +33,7 @@ Feature: Creating and listing issues
| thi-iss-yyy-zzz | Third issue | open |
And it prints "total: 3 issues"

@skip
@wip
Scenario: creation of identical issues is rejected
Given an empty issue repository
When we create an issue titled "A unique issue" with description
Expand All @@ -49,7 +49,7 @@ Feature: Creating and listing issues
Then it prints "Issue already exists: a-uni-iss-zzz-[hash]"
And terminates with exit code ERROR

@skip
@wip
Scenario: creation of issues with identical title but different description is allowed
Given an empty issue repository
When we create an issue titled "A unique issue" with description
Expand Down
6 changes: 5 additions & 1 deletion behave/steps/fix_cli.py
Expand Up @@ -20,11 +20,15 @@ def start_fix_no_args(context):
_start_fix_with_args(context, [])


def check_output_regex(context, pattern):
context.fix.expect(pattern)


@then(u'it prints "{output}"')
def check_output(context, output):
pattern = output.replace("[hash]", "[0-9a-f]{7}")
if pattern != output:
context.fix.expect(pattern)
check_output_regex(context, pattern)
else:
context.fix.expect_exact(output)

Expand Down
8 changes: 7 additions & 1 deletion behave/steps/fix_issues.py
Expand Up @@ -32,6 +32,12 @@ def create_issue_random_description(context, title):
def check_issue_list(context):
# first: column headings, separated by non-word characters,
# then: entries for each column, again separated by non-word characters
context.fix.expect(r'ID\W+STATUS\W+TITLE') # TODO: call fix_cli
fix_cli.check_output_regex(context, r'ID\W+STATUS\W+TITLE')
for row in context.table:
fix_cli.check_output(context, fr'{row["issue ID prefix"]}-[hash]\W+{row["status"]}\W+"{row["title"]}"')


@then(u'it prints a list of {count:d} issues')
def check_issue_list_count(context, count):
check_issue_list(context)
fix_cli.check_output(f"total: {count} issues")

0 comments on commit 2e83540

Please sign in to comment.