{"id":15270321,"url":"https://github.com/hauleth/watermelon","last_synced_at":"2025-04-12T06:25:25.099Z","repository":{"id":60775500,"uuid":"173275705","full_name":"hauleth/watermelon","owner":"hauleth","description":"BDD testing library for Elixir","archived":false,"fork":false,"pushed_at":"2020-09-10T08:17:46.000Z","size":67,"stargazers_count":20,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T01:51:08.541Z","etag":null,"topics":["bdd","cucumber","elixir","exunit","exunit-tests","gherkin","testing"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hauleth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["hauleth"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-03-01T09:40:16.000Z","updated_at":"2024-11-28T01:20:31.000Z","dependencies_parsed_at":"2022-10-04T17:16:03.846Z","dependency_job_id":null,"html_url":"https://github.com/hauleth/watermelon","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fwatermelon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fwatermelon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fwatermelon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fwatermelon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hauleth","download_url":"https://codeload.github.com/hauleth/watermelon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055442,"owners_count":21040191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bdd","cucumber","elixir","exunit","exunit-tests","gherkin","testing"],"created_at":"2024-09-30T07:08:13.718Z","updated_at":"2025-04-12T06:25:25.069Z","avatar_url":"https://github.com/hauleth.png","language":"Elixir","funding_links":["https://github.com/sponsors/hauleth"],"categories":[],"sub_categories":[],"readme":"# Watermelon\n\nSuper simple Gherkin features to ExUnit tests translator.\n\nInspired by [Cabbage][], but with slightly different API and few ideas of my own\nto simplify working with the library.\n\n## Installation\n\nThe package can be installed by adding `watermelon` to your list of dependencies\nin `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:watermelon, \"~\u003e 0.1.0\", only: [:test]}\n  ]\nend\n```\n\nThe docs can be found at [https://hexdocs.pm/watermelon](https://hexdocs.pm/watermelon).\n\n## Usage\n\nDefine file `tests/feature/coffe.feature`:\n\n```gherkin\nFeature: Serve coffee\n  Coffee should not be served until paid for\n  Coffee should not be served until the button has been pressed\n  If there is no coffee left then money should be refunded\n\n  Scenario: Buy last coffee\n    Given there are 1 coffees left in the machine\n    And I have deposited £1\n    When I press the coffee button\n    Then I should be served a coffee\n  Scenario Outline: Coffee count\n    Given there are \u003cstart\u003e coffees left in the machine\n    And I have deposited £\u003cmoney\u003e\n    When I press the coffee button \u003corders\u003e times\n    Then I should have \u003cleft\u003e coffees\n\n    Examples:\n      | start | money | orders | left |\n      |    12 |     5 |      5 |    7 |\n      |    20 |     5 |      5 |   15 |\n```\n\nIn your test module:\n\n```elixir\ndefmodule MyTest do\n  use ExUnit.Case\n  use Watermelon.Case\n\n  feature_file(\"coffee.feature\")\n\n  defgiven match(number) when \"there are {int} coffee(s) left in the machine\" do\n    {:ok, %{machine: Machine.put_coffee(Machine.new(), number)}}\n  end\n\n  defgiven match(number) when \"I have deposited £{int}\", context: %{machine: machine} do\n    {:ok, %{machine: Machine.deposit(machine, nil, number)}}\n  end\n\n  defwhen match when \"I press the coffee button\", context: %{machine: machine} do\n    assert {:ok, machine} = Machine.press_coffee(machine)\n    {:ok, machine: machine}\n  end\n\n  defwhen match(n) when \"I press the coffee button {int} times\", context: %{machine: machine} do\n    machine =\n      for _ \u003c- 1..n, reduce: machine do\n        machine -\u003e\n          assert {:ok, machine} = Machine.press_coffee(machine)\n\n          machine\n      end\n\n    {:ok, machine: machine}\n  end\n\n  defthen match when \"I should be served a coffee\", context: state do\n    assert {:coffee, _} = Machine.take_drink(state.machine)\n\n    :ok\n  end\n\n  defthen match(num) when \"I should have {int} coffee(s)\", context: %{machine: machine} do\n    assert machine.coffees == num\n\n    :ok\n  end\nend\n```\n\n## LICENSE\n\nMozilla Public License 2.0, see [LICENSE](LICENSE).\n\n[Cabbage]: https://github.com/cabbage-ex/cabbage\n[white-bread]: https://github.com/meadsteve/white-bread\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhauleth%2Fwatermelon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhauleth%2Fwatermelon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhauleth%2Fwatermelon/lists"}