On Wed, Nov 23, 2011 at 3:10 PM, Alex Whiteland <li...@ruby-forum.com> wrote:
> I don't know where to put this post,

Here: http://groups.google.com/group/cukes

> but theme of this more similar to
> my issue.
>
> I have trite signin system, like this:
>
>> ApplicationController:
> include SessionsHelper
>
> private
>
> helper_method :current_user
>
> def current_user
>  @current_user ||= User.find(session[:user_id]) if session[:user_id]
> end
>
>
>> SessionsHelper:
>  def is_admin?
>   @current_user && @current_user.id == 1
>  end
>
>
>> features/support/env.rb:
> World(SessionsHelper)
>
> So, if I test
>> is_admin?.should be_true
>
> it returns:
>
> expected nil to be true (RSpec::Expectations::ExpectationNotMetError)
>      ./features/step_definitions/users/add_user.rb:23:in `/^I should
> signin$/'
>      features/users/add_user.feature:13:in `And I should signin'
>
> But I signed in! Why? What's the way to test authentication system from
> scratch?
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to