Petitest::Spec
BDD style DSL for Petitest.
Installation
Add this line to your application's Gemfile:
gem "petitest"And then execute:
bundleOr install it yourself as:
gem install petitestUsage
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.describe and .context
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.it and .specify
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.let
Define a memozied method.
let(:result) do
1 + 1
end
it "returns 2" do
assert { result == 2 }
end