Displaying 20 results from an estimated 20000 matches similar to: "i can not get current_user while writing test case with Rspec and Capybara"
2012 Jun 14
1
Cucumber/RSpec ::: Capybara? Webrat What am I using??
Hey everybody
I''m currently reading through the Pragmatic Programmers RSpec book, and
I really enjoy it.
But I’m facing some problems because of the fact that the book is
already some years old, I guess. I have installed rvm and use Ruby
1.9.3, and I didn’t really get some Rails code examples to work
properly, so I tried it with a 1.8.7 installation, but there I had some
other problems
2012 Mar 05
0
Rails 3 - How can you get access to current_user in the IRB console?
I''m doing some design/debugging in IRB and need to login a user and then be
able to gain access to current_user in my efforts (I''m using Devise for
authentication.)
I found a sequence from SO that allows me to successfully login via IRB and
access a page response:
>> ApplicationController.allow_forgery_protection = false
>> app.post(''/sign_in'',
2012 Jul 22
1
RSpec/rails & Capybara: #within
I''m new with Capybara and after a good amount of google, I still can''t
figure out how the #within methods works!
I can use it only if I call visit before? There''s no way to use it on a
string, like the `page = Capybara.string(html_string)` trick?
When describe a view, I want something like that:
describe "path/to/view.html.erb" do
it "should pass"
2012 Jun 08
0
Having difficulty testing redirects with Rspec and Capybara
Every time I try to test a redirect, I get this error: @request must be an
ActionDispatch::Request
Any idea why? I''m using Rspec-Rails 2.9.0, Capybara 1.1.2, and Rails 3.2.
Here''s my test:
describe "AdminAccountPages" do
subject { page }
let(:user) { FactoryGirl.create(:user) }
let(:account) { user.owned_accounts.create!(name: "ACME Corp",
2007 Aug 21
2
using restful_authentication current_user inside controller specs
I''m using restful_authentication in my app and I have the before filters in
my application rhtml:
before_filter :login_required
around_filter :set_timezone
around_filter :catch_errors
Currently I have them commented out while rspec''in but I''ll need to add them
in my specs.
def create
@ticket = Ticket.new(params[:ticket])
@ticket.user = current_user
if
2013 Jun 18
1
Getting rspec error: Net::SMTPServerBusy: Relay access denied
I''m trying to test registration emails (sent with devise), and I keep
getting the error:
Net::SMTPServerBusy: 454 4.7.1 <model_spec-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org>: Relay access denied
I''m running Rails 3.2.11 with Capybara, and I have (temporarily) chopped my
spec_helper.rb and test.rb files down to the bare minimum, still getting
the error above.
2013 May 02
1
trouble-with-capybara-and-rspec-on-a-new-model-spec
I have searched a lot for a solution, but I could not find it! I am trying
to make a rails application after watching Michael Hartl''s tutorial and
when i fill data manually and submit it nothing happens and nothing records
in the Mailers table and I am facing the following error:
Failures:
1) Mailer pages mail us with valid information should send a mail
Failure/Error: expect
2010 Aug 09
0
Devise :current_password validations and checking (how???)
Hi Guys,
In my devise applications in Rails 3, I created a separate form under my
SettingsController class of which it handles the ''Change Password'' of
the User Model, so i can manipulate the current_user in the
SettingsController.
Now, I followed the set-up in the Devise/Views on how to update the form
using ''Change password'' and either way update User for
2007 Aug 11
2
Rspec and acl_system2 plugin
Hello,
I''m trying to spec a Rails application using the couple
restful_authentication/acl_system2 plugins.
In my admin layout, I put the following code :
<% restrict_to "admin" do -%>
<ul id="admin-tabs">
<li> /users Users management </li>
</ul>
<% end -%>
Then in my spec file
2011 Aug 09
0
Devise, RSpec and Webrat
My app is builded with rails 2.3.12, rspec-rails 1.3.2, webrat 0.7.3.
My spec_helper.rb
ENV["RAILS_ENV"] ||= ''test''
require
File.expand_path(File.join(File.dirname(__FILE__),''..'',''config'',''environment''))
require ''spec/autorun''
require ''spec/rails''
require
2013 Mar 20
2
Rspec + Devise + BaseController
Hello there,
I''m creating a base controller for the admin section of a project. All
controllers whitin the admin section will inherit from it.
#####################################################
#app/controllers/admins/base_controller.rb
class Admins::BaseController < ApplicationController
layout "admin_cms"
before_filter :authenticate_admin!
end
2012 Feb 04
0
ActiveRecord Associations not working in RSpec with Devise
Hi everyone,
I have the following classes:
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable, :timeoutable,
:recoverable, :rememberable, :trackable, :validatable
has_many :comments, :dependent => destroy
...
end
class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :commentable, :polymorphic => true
...
end
In rails console,
2010 Sep 03
1
Action Controller Error: undefined local variable or method `current_user'
Newbie learning Rails. I''m currently on Chp9 here:
http://railstutorial.org/chapters/sign-in-sign-out#top
At the end of the tutorial, rails is erroring (see below). being new
to Rails and after having checked the tutorial... How do you resolve
this kind of error. It''s saying current_user is not defined, and it is
supposed to be defined with/Sites/sample_app/app/helpers/
2011 Apr 26
1
new goodness, Capybara::RSpecMatchers in helper specs
This https://github.com/rspec/rspec-rails/commit/59793dcc349b64f4ebcf742606371001256c774d
is exciting news!! ("this adds capybara matchers to view and helper
specs")
Now, if I just knew how to take advantage of it? Do I have to require
something else in spec_helper? I have already added included
gem ''rspec-rails'', ''~> 2.6.0.rc2''
gem
2010 Jul 03
0
rspec controller test strange error: undefined method `call' for nil:NilClass
must be doing something dumb....
not sure, but the ''call'' appears to be on the block.call when the
respond_to block gets executed.
straight forward "channels" resource with a ''create'' action.... only
new thing is just assigning the current_user to the model.
def create
@channel = Channel.new(params[:channel])
@channel.user = @user
2013 Jul 04
3
Rspec devise, testing extended RegistrationController action destroy
Hi everyone,
I have devise 1.5.4 working with rails 3.0.20 and ruby 1.8.7 .
I have extended the destroy action from the RegistrationController, to soft
delete users instead of really deleting them from the database.
def destroy
# raise resouce.inspect # this is just to see if the test hits the
action
resource.soft_delete
set_flash_message :notice, :destroyed
sign_out resource
2008 Jan 15
0
Problem with ruby-debug and rspec
So i''ve been getting this same thing with both rspec 1.1.1 and now with 1.1.2.
ruby-debug works with i''m in the application code, but not when i''m in
the ''spec'', or spec helper methods i''m loading. Basically any command
which should normally work like p, or pp, gets passed through to a
method_missing.
I''m kind of stumped on this
2007 Aug 23
3
recording current_user
Hi,
Another noob here I am afraid! I have a questuin about the current_user
method that comes with AAA.
I have AAA set up and working fine and if i put <%=
self.current_user.login %> into a view it shows the login name as
expected on the page.
What I cant work out is how to record this into the database when the
user completes a form.
My app so far only has two models.
2010 Jun 20
7
rspec-rails 2.0.0.beta.12 showing undefined method error for route_to
First of all, I''ve been trying to find an answer for this problem all
over the internet without luck.
The thing is that I am using RVM with ruby 1.9.2-head and I created a
new empty gemset. Then I installed bundler gem with:
gem bundler install
That installed the library into the /Users/damselem/.rvm/gems/
ruby-1.9.2-head at rails3/gems directory. Then I went to my rails 3 app
2011 Jul 30
2
Get the current user as Json with Devise
Hi!
I use Devise and Basic HTTP Authentication to access user areas from a
mobile app. When the user enters its details in the app and it tries to
"login" (you don''t actually login with basic auth as you send the
credentials with each request) I want to get a response back with the user
info, like user ID, email (not password) etc.
- So, is there a way to do this out of