Hello,
In the application that I am working on, the rspec configuration includes several modules that are "mixed-in" to rspec via config.include, in an RSpec.configuration block. This would make all the instance methods of that module available to my test classes. For example, I have the following helper to abstract some of the login functionality in my acceptance tests:
module LoginHelper
def login(user)
# Insert login logic here
end
end
The implementation of the login method has begun to grow and is starting to include some duplicated code, so I naturally want to abstract some of this duplication out into private methods, to ease code readability. However, it appears that any private method included into my rspec configuration from these "mixed-in" modules will also be visible to my test code. I can verify this by placing a specific raise message into my private method and witness that specific error message appear when the test calls this method and ultimately fails. What I perhaps hoped was that the test would instead fail due to a method scope issue.
I am seeking a way to have methods from these "mixed-in" modules be hidden from test code and only available to public methods from within its module, so that I do not risk having these private methods get accidentally called by the test code. Is there a way to accomplish this in the current version of rspec?
Thank you.
Evan