Skip to content

Commit

Permalink
Begin switching to GreenDots
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed May 2, 2023
1 parent b506aeb commit 68d8928
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
- name: Tests
run: bundle exec sus

- name: GreenDots tests
run: bundle exec gd gd

rubocop:
runs-on: 'ubuntu-latest'
steps:
Expand Down
14 changes: 12 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,19 @@ Phlex is incredibly complex and requires a lot of meta-programming but when you

## Tests

We use the **[Sus](https://github.com/ioquatix/sus)** testing framework. It feels a bit like RSpec with a few small differences. There’s no documentation for Sus at the moment, but you should be able to pick up the basics from reading other tests or looking at the implementation in the Sus repo.
New tests should be written using [GreenDots](https://github.com/joeldrapper/green_dots) and placed in the `gd` folder. You can run these tests with:

You can run all the tests with `bundle exec sus`.
```
bundle exec gd gd
```

Joel maintains GreenDots itself, so if you run into any issues, please reach out to him by creating an issue in the GreenDots repo so he can improve the framework.

Previously, we used **[Sus](https://github.com/ioquatix/sus)**. Sus tests are in the `test` folder and can be run with:

```
bundle exec sus
```

## Documentation

Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ gem "rubocop"
gem "sus"
gem "benchmark-ips"
gem "yard"
gem "green_dots", github: "joeldrapper/green_dots"

group :test do
gem "i18n"
Expand Down
18 changes: 18 additions & 0 deletions gd/phlex/callable.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

class Example
include Phlex::Callable

def call
"Hello, world!"
end
end

def example
Example.new
end

test "to_proc" do
expect(example.to_proc).to_be_a Proc
expect(example.to_proc.call) == "Hello, world!"
end
3 changes: 3 additions & 0 deletions gd/support/helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

require "phlex"

0 comments on commit 68d8928

Please sign in to comment.