pending “add some examples to (or delete) #{FILE}”
end
output:
/spec/views/home/index.html.haml_spec.rb:7:in block in <top (required)>': undefined local variable or methodlogin_user’ for
#Class:0xa07074c (NameError)
from
/usr/local/rvm/gems/ruby-1.9.3-p374@affluence-connect/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:238:in module_eval' from /usr/local/rvm/gems/ruby-1.9.3-p374@affluence-connect/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:238:insubclass’
from
/usr/local/rvm/gems/ruby-1.9.3-p374@affluence-connect/gems/rspec-core-2.11.1/lib/rspec/core/example_group.rb:224:in describe' from /usr/local/rvm/gems/ruby-1.9.3-p374@affluence-connect/gems/rspec-core-2.11.1/lib/rspec/core/dsl.rb:18:indescribe’
from
/home/seneca/ashish/affluence2-staging/spec/views/home/index.html.haml_spec.rb:4:in <top (required)>' from /usr/local/rvm/gems/ruby-1.9.3-p374@affluence-connect/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:inload’
from
/usr/local/rvm/gems/ruby-1.9.3-p374@affluence-connect/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in
`block in load_spec_files’
but I googled around. something I assume you have done and it seems that
login_user was a helper you had to redefine yourself. which does not
really
exist anymore, well, at least looking at the documentation of the devise
test helpers.
First thing, there is a forum
here: Redirecting to Google Groups
for devise itself. and there you might get a better help for your
question.
but I googled around. something I assume you have done and it seems that
login_user was a helper you had to redefine yourself. which does not
really
exist anymore, well, at least looking at the documentation of the devise
test helpers.
module ControllerMacros
def login_admin
before(:each) do @request.env[“devise.mapping”] = Devise.mappings[:admin]
sign_in FactoryGirl.create(:admin) # Using factory girl as an
example
end
end
def login_user
before(:each) do @request.env[“devise.mapping”] = Devise.mappings[:user] @current_user = FactoryGirl.create(:user)
# user.confirm! # or set a confirmed_at inside the factory.
Only necessary if you are using the confirmable module
sign_in @current_user
end
end
def login_as_paid_user
before(:each) do @request.env[“devise.mapping”] = Devise.mappings[:user] @current_user = FactoryGirl.create(:user, :member_paid_monthly)
# user.confirm! # or set a confirmed_at inside the factory.
Only necessary if you are using the confirmable module
sign_in @current_user
end
end
def logout!
after(:each) do
session[:user]
end
end
end
its working in controller specs. The problem is with only views specs.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.