summaryrefslogtreecommitdiff
path: root/yarns/070-search.yarn
blob: c55b3da7077ab643d94477b795708c4376430fac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Search tickets
==============

`distix list` lets the user limit the list of tickets it shows using a
query language. For now, the search language is very simplistic: it
only allows a query of the form `foo!=bar`, where `foo` and `bar` form
a key/value pair and the query matches if `foo` does __not__ have a
value `bar`. This is useful for listing open tickets: `distix list
state!=closed`. Tickets do not, by default, have a `state` key, but
they can be marked closed by setting one.

The search language will be improved later. The purpose of the simple
approach is to get `distix` into a form that can be used for real in
real projects as soon as possible.

    SCENARIO list finds only open tickets

First, create two tickets with different titles.

    WHEN user attempts to run distix init REPO
    THEN attempt succeeded

    WHEN user changes working directory to REPO
    AND user attempts to run distix new first-ticket --save-ticket-id=../T1
    THEN attempt succeeded

    WHEN user attempts to run distix new second-ticket --save-ticket-id=../T2
    THEN attempt succeeded

Make sure `distix list` shows both tickets.

    WHEN user attempts to run distix list
    THEN attempt succeeded
    AND output matches "first-ticket"
    AND output matches "second-ticket"

Set the second ticket's state to closed, and make sure `distix list`
still shows both tickets.

    WHEN user attempts to run 
    ... distix set --ticket-id-from=../T2 state=closed DUMMY
    THEN attempt succeeded

    WHEN user attempts to run distix list
    THEN attempt succeeded
    AND output matches "first-ticket"
    AND output matches "second-ticket"

However, if we search for open tickets, only the first ticket should
be listed.

    WHEN user attempts to run distix list state!=closed
    THEN attempt succeeded
    AND output matches "first-ticket"
    AND output doesn't match "second-ticket"