diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6acab991..dbe2e291 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9073df58..92e54d58 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/Gemfile b/Gemfile index b3e88cad..f2c49801 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/gd/phlex/callable.rb b/gd/phlex/callable.rb new file mode 100644 index 00000000..efc4e480 --- /dev/null +++ b/gd/phlex/callable.rb @@ -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 diff --git a/gd/support/helper.rb b/gd/support/helper.rb new file mode 100644 index 00000000..91ec90a9 --- /dev/null +++ b/gd/support/helper.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require "phlex"