tomykaira / rspec-parameterized

RSpec::Parameterized supports simple parameterized test syntax in rspec.
MIT License
417 stars 28 forks source link

Add new parameter type: ref and lazy. #62

Closed shinji-yoshida closed 3 years ago

shinji-yoshida commented 3 years ago

usage:

describe "ref and lazy" do
  let(:one) { 1 }
  let(:four) { 4 }

  where(:a, :b, :answer) do
    [
      [ref(:one), ref(:four), lazy { two + three }],
    ]
  end

  with_them do
    context "define two and three after where block" do
      let(:two) { 2 }
      let(:three) { 3 }

      it "should do additions" do
        expect(a + b).to eq answer
      end
    end
  end
end

This change should be a workaround for issue #8.

joker1007 commented 3 years ago

Great thanks for your contribution!!