stalniy/bdd-lazy-var

Add support for `its` similar to rspec

Closed this issue · 4 comments

  • its implementation
  • it without description implementation
describe("User", () => {
  subject() => new User())

  its("role", () => expected.to.equal("member"))
})

Basically its is a wrapper around it and example above can be converted to

it("s role equals to member", () => {
  expect($subject.role).to.equal("member")
})

Syntax like this will not require to add one more global variable:

its('role', is => is.expected.to.equal("member"))

Not sure if it'd be part of this issue or another, but it would also be great to have something like rspec's it { is_expected.to eq("member") } syntax, for when we're just testing the subject directly.

I guess the syntax for JS would be it(() => is.expected.to.equal("member"))

@dkniffin I think it would be a good addition!

available in bdd-lazy-var@2.4.0