Skip to content

Need shared context and variables between expect inside one it block  #25

@lain0

Description

@lain0

For now, for your snipper there's no variable @calls_count could be shared between two instances of Execute class

BDDSM.describe do
  def with_calls_counted
    @calls_count ||= 0
    @calls_count += 1
  
    yield
  end
  
  let(:two) { with_calls_counted { one + 1 } }
  
  it do
    expect(two).to eq 2
    expect(@calls_count).to eq 1
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions