[rspec-devel] [ rspec-Bugs-15638 ] When naming a protected method, if it begins with 'should_' it causes it to be treated as an example.

noreply at rubyforge.org noreply at rubyforge.org
Thu Nov 15 02:32:06 EST 2007


Bugs item #15638, was opened at 2007-11-15 01:32
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=15638&group_id=797

Category: runner module
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nathan Sutton (fowlduck)
Assigned to: Nobody (None)
Summary: When naming a protected method, if it begins with 'should_' it causes it to be treated as an example.

Initial Comment:
starting a protected method with should_ causes it to be treated as an example.

edge rails revision: 8146
edge rspec revision: 2889
edge rspec_on_rails revision: 2889

describe SessionsController do

  # a bunch of examples, some that call should_be_logged_in

protected

  def should_be_logged_in
    response.session.should_not be_nil
    session[:user].should_not be_nil
  end

end

When running the spec:

SessionsController should_be_logged_in' FAILED
expected not nil, got nil
./spec/controllers/sessions_controller_spec.rb:111:in `should_be_logged_in'
script/spec:4:


Renamed the method to 'be_logged_in' and all specs then pass.  Line 111, in this case, is 'session[:user].should_not be_nil'.



----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=15638&group_id=797


More information about the rspec-devel mailing list