Displaying 20 results from an estimated 200 matches similar to: "How to get more debug information in test log ?"
2012 Nov 08
1
validates_uniqueness_of(*attr_names) w scope not working in unit test
Rails 3.2.8
Very strange , it works in dv mode console , but not in a unit test
class User < ActiveRecord::Base
belongs_to :subdomain
validates_uniqueness_of :email, :scope => :subdomain_id
class UserTest < ActiveSupport::TestCase
def initialize_user
@booboo = FactoryGirl.create(:subdomain, name: "booboo")
@coocoo = FactoryGirl.create(:subdomain, name:
2013 Oct 08
1
Trouble with rspec and FactoryGirl Sequence
I''m following Michael Hartl''s Ruby on Rails 3 Tutorial but I''m using
Rails 3.2.8 and FactoryGirl 4.2.0 and rspec 2.14.1 I''m in chapter 10
trying to generate tests for pagination (using will_paginate 3.2.5 which
works fine in dev)
I can get FactoryGirl to test just fine if I don''t use Sequence but I
can''t seem to figure out the correct syntax
2011 Mar 30
0
Anonymous Subclass of ActionController::Base
I''m trying to spec a subclass of ActionController::Base using an
anonymous subclass but I am running into errors but I am receiving a
uninitialized constant StubResource
Here is my base class
class Admin::BaseController < ApplicationController
before_filter :etherweb_site
load_and_authorize_resource
layout "admin/admin"
protected
def etherweb_site
end
end
2014 Feb 18
0
How to Test Multimodel Paperclip attachments?
I'm using Rspec and FactoryGirl to create specs for multimodel paperclip
attachments. From searching other questions, it seems like a single
image attachment is more common.
Car.rb
class Car < ActiveRecord::Base
has_many :uploads, dependent: :destroy
validates :uploads, presence: { message: 'You must upload at least
one image' }
2012 Jun 08
1
[Rails 3.2.5] Rails: unit test fixture_path : fixture_file_upload cannot find the file ...
I am trying to perform a test unit, using FactoryGirl
include ActionDispatch::TestProcess
FactoryGirl.define do
factory :article do
.......
photo { fixture_file_upload ''/files/test.jpg'', ''image/jpg'' }
end
end
IN mt test_helper.rb I defined the fixture_path
def fixture_path
File.dirname(__FILE__) + "/fixtures/" #
2013 Aug 22
1
How do I deal with ActiveRecord::RecordInvalid: Validation failed:
Hello all,
I am currently writing model tests in rails 4. I am attempting to add an
error to a reservation object if the total number of reservations for a
given date and time has reached a pre-determined limit.
When my test runs, it is hitting the appropriate code but it is raising the
following error as opposed to just giving me an error in the object that I
can use.
2011 Nov 18
1
What does :count actually mean in assert_select?
Hi guys,
I tried reading up the RSPEC Book (Dec 2010) and googled a bit but I
could not find anything.
I''m using Rspec2.
Example:
spec/factories/categories.rb
======================
FactoryGirl.define do
factory :category_intakes, :class => ''category'' do
name ''intakes and filters''
description ''airfilters and
2012 Nov 18
3
remarkable activerecord association RSpec
i''m using gem Remarkable activerecord for association. i''ve installed
remarkable and remarkable activerecrod both gem. i''ve added both gem in
my Gemfile. i''ve added "remarkable_activerecord" as required in
spec_helper.rb.
describe Authentication do
FactoryGirl.build(:authentication).should
belong_to(:user)
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 Feb 28
1
Validation Failed: Userkey has already been taken, Email has already been taken
Hi,
I am using Factory girl with rspec and capybara for testing my rails
appliction. I have the below code
FactoryGirl.define do
factory :user do |f|
f.email "sss1 at gmail.com"
f.userkey "12ssd345q62"
end
end
When I run the test it is failing as "Validation Failed: Userkey has
already been taken, Email has already been taken".
What could be the reason for
2014 Jun 09
0
How can I test my controller via rspec for something other than response.should be_success?
1) Right now this is just testing a successful response. However, since
I've gone and created a Post via FactoryGirl... how can I test the
@post.id equals one of the id's being returned by the get: index json?
describe Api::V1::PostsController do
context 'Post' do
before(:each) do
@post = FactoryGirl.create(:post)
end
context '#index' do
2014 Feb 11
0
Cucumber test question
Hello all,
I am trying to understand when I try to run a test in cucumber what I am
missing that it is failing. I am using FactoryGirl to create my records and
using cucumber to test my logic however I know that I am doing something
wrong in my testing I just can't seem to figure out what. Here is what I
have:
Feature:
Feature: All features related to staff info
Scenario: notification
2012 Nov 12
7
RSpec: controller POST create
Rails 3.1.3
rspec-rails (2.11.4)
rspec 2.11.1
I am new to rspec. I don''t quite understand tests for POST create part.
I have generated scaffold, and simultaneously it generated
controller_spec.rb as well.
it "assigns a newly created plan as @plan" do
post :create, {:plan => valid_attributes}, valid_session
assigns(:plan).should be_a(Plan)
2012 Apr 04
1
sambaHomePath usage
My name is Camelia Botez and I'm linux system admin.
I try to configure samba server usind ldap authentication and different sambaHomePath from login home directory.
For ex. A user user_test has his home (login) directory /home/user_test and I want , using samba map on windows to have /srv/user_test home directory for this user.
We included in ldap schema 2 attributes sambaHomeDrive (H: )
And
2003 Aug 13
0
Password change problems
Dear Sir
I?m terribly confused about one problem in our environment. We have one
NIS+SAMBA environment, running in E450 with Solaris 7. Apparently, after
one system patch application, the password change is not working. Please
look this:
1) In the server, with root account:
# passwd user_test
New password:
Re-enter new password:
NIS passwd/attributes changed on server
passwd (SYSTEM): Password
2013 Sep 04
2
Speed up image processing of Paperclip in Acceptance Tests
Hi All,
I have a question here: How to Speed up image processing of Paperclip in
Acceptance Tests
When running capybara feature specs I can see lots of Slow factory notices
which are populated byfactory_girl. These Slow factory things heavy slow
down the feature specs, I think, even feature specs are intrinsic slow
specs. Then I had some inspect and found out most of the Slow factory was
2006 Jul 31
0
validates_confirmation_of won''t work
Hello folks, this is the first time I''ve written to this forum. If
there''s already a topic on this, forgive me but the search isn''t working
right now.
I seem to have a problem validating confirmation of a password. The
first two snippets are some model code and some test code that work just
fine:
----------------------------
class Challenge < ActiveRecord::Base
2006 Apr 28
2
Accessing fixtures from unit tests
I have set up some fixtures in test/fixtures/users.xml:
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
admin:
id: 1
username: admin
password: admin
pbarry:
id: 2
username: pbarry
I have a unit test for my user model:
require File.dirname(__FILE__) + ''/../test_helper''
class UserTest < Test::Unit::TestCase
fixtures :users
def
2010 Jul 19
0
Forking and integration tests
Hi All,
I had a bug in one project, that data get duplicated in the DB due to
multiple instances of the application (multiple thins) are accessing the
DB at the same time .. The typical mistake.
Problem fixed.
I just need to write a test code that covers the fixed bug.
I need to simulate the concurrent requests that can result in the
original bug. I thought of many ideas and decided to go with
2009 Jun 01
0
smart data loading
I need something to load my seed data when I stage my app for
milestone releases. I''m using fixtures currently but maintaining the
foreign key relationships is getting more difficult as the app grows
larger.
I''d like something that''s aware of my foreign keys constraints and
knows to load the data in the proper order.
I''ve looked at FactoryGirl and seed_fu so