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

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/c4cebf6d-b5a8-4c20-b2e4-7aa62824c3f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to