BDD style DSL for Petitest.
Add this line to your application's Gemfile:
gem "petitest"
And then execute:
bundle
Or install it yourself as:
gem install petitest
Require "petitest/spec"
and extend Petitest::Spec
into your test class.
require "petitest/autorun"
require "petitest/spec"
class ExampleTest < Petitest::Test
include ::Petitest::Spec
# ... your tests ...
end
Nest a test group with description. .context
is an alias.
describe "GET /me" do
context "without logged-in" do
it "returns 401" do
assert { response.status == 200 }
end
end
end
Define a test with description. .specify
is an alias.
it "returns foo" do
assert { x == "foo" }
end
specify "x is foo" do
assert { x == "foo" }
end
Define a memozied method.
let(:result) do
1 + 1
end
it "returns 2" do
assert { result == 2 }
end