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

stub keyword is required for class methods #3

Open
icy-arctic-fox opened this issue Nov 12, 2023 · 0 comments
Open

stub keyword is required for class methods #3

icy-arctic-fox opened this issue Nov 12, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@icy-arctic-fox
Copy link
Owner

The following does not work as expected:

double TestDouble do
  def self.add_one(value)
    value + 1
  end
end

it "adds one to the value" do
  TestDouble.add_one(2).should eq(3)
end

The test fails with an UnexpectedMessage error.

Using the stub keyword works, but this should be optional.

double TestDouble do
  stub def self.add_one(value)
    value + 1
  end
end

it "adds one to the value" do
  TestDouble.add_one(2).should eq(3)
end
@icy-arctic-fox icy-arctic-fox added enhancement New feature or request help wanted Extra attention is needed labels Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant