Cancan Abilty, Devise and Rspec testing?

Do you have a spec/support/devise. Rb file? It needs to include.

Up vote 1 down vote favorite share g+ share fb share tw.

People, I'm new at RoR enviroment, and I'm trying to do something apparently simple, but its getting complicated. I do not have roles in my application, and I just want to add some features to logged in users, but starting with the RSpec tests, I cannot find the way to test if the user is signed in... I'm using CanCan with Devise. I tried this code below, but it didn't work, says that there is no method called sign_in, I've already tried current_user, and user_signed_in?

Before(:each) do @user = User. New sign_in @user end What am I missing? Gemfile: source 'http://rubygems.

Org' gem 'rails', '~> 3.0.7' # authentication gem 'devise', '~> 1.3.4' #authorization gem "cancan" # mongodb database gem 'mongoid', '~> 2.0' gem 'bson_ext', '~> 1.3' gem "high_voltage" gem 'translate_routes' gem 'factory_girl_rails', "~> 1.1. Rc1" group :development, :test do gem "rspec-rails", ">= 2.0.0" gem "cucumber-rails", ">= 0.3.2" gem "webrat", ">= 0.7.2" gem 'rspec', '2.5.0' gem 'spork' gem 'launchy' gem 'autotest' gem 'autotest-rails-pure' gem 'ruby-debug' gem 'rake', '0.9.2' gem 'shoulda' end ruby-on-rails-3 rspec devise cancan link|improve this question edited Jul 18 '11 at 16:19 asked Jul 18 '11 at 13:23Jrafael506 44% accept rate.

Do you have a spec/support/devise. Rb file? It needs to include RSpec.

Configure do |config| config. Include Devise::TestHelpers, :type => :controller end.

– eugen Jul 18 '11 at 15:10 yes, but I did it again and now its happening another error, its saying that: spec_helper. Rb:21: undefined method `fixture_path=' for # (NoMethodError) – Jrafael Jul 18 '11 at 15:19 Can you post your Gemfile also? – eugen Jul 18 '11 at 15:33.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions