Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new parameter type: ref and lazy. #62

Merged
merged 1 commit into from
Apr 2, 2021

Conversation

shinji-yoshida
Copy link
Contributor

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.

ref: reference for method such as let variable
lazy: receive block which is evaluated when argment is invoked
Copy link
Collaborator

@joker1007 joker1007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
It's a nice feature!!

@joker1007 joker1007 merged commit d054219 into tomykaira:master Apr 2, 2021
@joker1007
Copy link
Collaborator

Great thanks for your contribution!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants