shard-spectator/spec/rspec/core/one_liner_subject_spec.cr
2020-01-19 22:05:38 -07:00

32 lines
866 B
Crystal

require "../../spec_helper"
# Examples taken from:
# https://relishapp.com/rspec/rspec-core/v/3-8/docs/subject/one-liner-syntax
# and modified to fit Spectator and Crystal.
Spectator.describe "One-liner syntax" do
context "Implicit subject" do
describe Array(Int32) do
# Rather than:
# it "should be empty" do
# subject.should be_empty
# end
# TODO: Define `should` method on example to be `is_expected`.
# it { should be_empty }
# or
it { is_expected.to be_empty }
end
end
context "Explicit subject" do
describe Array(Int32) do
describe "with 3 items" do
subject { [1, 2, 3] }
# TODO: Define `should_not` method on example to be `is_expected.not_to`.
# it { should_not be_empty }
# or
it { is_expected.not_to be_empty }
end
end
end
end