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

Provide a "valid constant name" validation mode #16

Closed
myronmarston opened this issue May 31, 2012 · 1 comment
Closed

Provide a "valid constant name" validation mode #16

myronmarston opened this issue May 31, 2012 · 1 comment

Comments

@myronmarston
Copy link
Collaborator

I have, on occasion, accidentally done this:

describe MyClass do
  it "does something with a widget" do
    widget = fire_double("Widgt")
    widget.should_receive(:widgify)

    MyClass.do_something(widget)
  end
end

I fat-fingered the spelling of the the Widget constant, and the fire double in my spec will always be a normal double, with none of the interface-verifying goodness rspec-fire would usually give me, even when run with my entire code base loaded.

It'd be nice if there was a way to have rspec-fire tell me about these issues. Obviously, when I'm running a one-off spec without the Widget class loaded, there's no way for rspec-fire to know it's not a valid constant name. However, when I run all my specs together (which I generally do as I create each git commit), it'd be nice to have it run the specs with an rspec-fire mode that will cause an error to be raised if a fire double (or fire class double) is given an unloaded constant name. Essentially this would be a config option that I would set in my spec_helper (or full_spec_helper, or whatever I call my file that loads the entire environment).

Thoughts?

@xaviershay
Copy link
Owner

My only concern is that would add a lot more code since there currently isn't any sort of configuration in rspec-fire, I don't think.

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

No branches or pull requests

2 participants