One-liner syntax in RSpec's should-based and expect-based syntaxes
RSpec supports a one-liner syntax for setting an expectation on the subject
:
describe Array do
describe "when first created" do
it { should be_empty }
end
end
The example description "it should be empty" will be defined automatically.
With RSpec 3's expect
-based syntax you use it_is_expected
instead:
describe Array do
describe "when first created" do
it { is_expected.to be_empty }
end
end