Displaying 20 results from an estimated 3000 matches similar to: "Forking and integration tests"
2009 Mar 31
4
Mysql Error RELEASE SAVEPOINT active_record_1
Hi, I''m trying to upgrade an app from 2.2.2 to 2.3.2 and I get a bunch
of Mysql Errors : Mysql::Error: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near ''RELEASE SAVEPOINT active_record_1'' at line 1:
RELEASE SAVEPOINT active_record_1
Mysql version is 4.1.22 which supports save points but
2011 Feb 09
0
Mysql2::Error: SAVEPOINT active_record_1 does not exist
Hi,
I''m switching the database of a rails 3 app I have developed from
postgres to mysql so that I can avail of amazon''s rds. Before I make
the change I have been running my test code using mysql on my dev
machine with the mysql2 adaptor . My test code is throwing up some
errors that I haven''t quite been able to get to the bottom of yet.
Basically I have a model that is
2010 Mar 22
0
rspec bug, on Mysql::Error: MySQL server has gone away: ROLLBACK TO SAVEPOINT active_record_1
hello
can anybody help me with this bug, (this sometimes occur sometimes passes)
1)
ActiveRecord::StatementInvalid in ''MailReader on Simple Tasks should not
accept duplicate email''
Mysql::Error: MySQL server has gone away: ROLLBACK TO SAVEPOINT
active_record_1
/home/poldz/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in
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.
2007 Jan 12
2
Forking a process in Rails is messing up mongrel
I''m trying to run an external Ruby script from my Rails app.
To do this i''m using this function
def fork_with_new_connection(config, my_class = ActiveRecord::Base)
pid = fork do
begin
my_class.establish_connection(config)
yield
ensure
my_class.remove_connection
end
end
Process.detach(pid)
end
Then, within my controller I do this:
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 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
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:
2006 Jan 18
1
Helps!!!!! Rails database connection guru needed!!!!!!!
Hi,
I really need help to understand what is happening
while Rails connect to a database, (we area actually
using postgresql, so my example will be with
postgresql) What I understand is Rails is able to
connect to different DB. Actually, this is what we
want, and we have made some tests, everything is juste
fine. However, all these tests lead us to some
important questions that we did find the
2006 Jan 11
0
Connection problem with a generic-runtime-built ActiveRecord::Base
Hi,
I''m trying to create a "runtime-generic" ActiveRecord
class, It means I don''t need to know the table or
database, before I create my program ruby-rails. So I
don''t need to predefine my database in environment.yml
file and pre-build classes inherited from
ActiveRecord::Base.
I write some code, it seems to work. However, I can''t
disconnect my
2010 Jan 21
2
nested forms and attr_accessable
Rails 2.3.5
I am working on a nested form that assigns roles to users through a
table called clearances. I have attr_acessable turned off globally in
an initializer:
ActiveRecord::Base.send(:attr_accessible, nil)
I have this set in clearance.rb
attr_accessible(:description,
:effective_from,
:role_id,
:superceded_after,
:user_id)
And this is what params looks like after the
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' }
2006 Jan 13
1
How to disconnect to a database????
Hi,
We have experienced some problems with
ActiveRecord::Base class of Ruby-Rails. We are
building a web-application based on the Ruby-rails
framework and the web-application needs to access to
difference databases, so we do not pre-define our
database accesses in the database.yml file. In fact,
we are using the
ActiveRecord::Base.establish_connection() to connect
to our database, the function
2007 Nov 08
0
mysql-ruby gem using significantly more memory that mysql.rb ?
I have found that, using the mysql-ruby gem leads to 40 MB more memory
consumption in my tests than plain mysql.rb.
Is anyone aware of this?
My test loads a nasty grid of values using many include statements
which result in about 5000 rows being returned (the actual number of
rows is much less but the joins increase the number).
When using ruby-mysql:
The memory usage jumps from ~75megs to
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/" #
2006 Aug 13
1
establish_connection method
I''m digging into rails source code.
But I''ve got a problem in undestading actionrecord::base source code
which is connection_specification.rb.
In the body of establish_connection method,
def self.establish_connection(spec = nil)
case spec
when nil
raise AdapterNotSpecified unless defined? RAILS_ENV
establish_connection(RAILS_ENV)
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
2009 Jun 07
6
Missing Template when testing with the Brain Buster Captcha partial
When I run my functional tests, they throw an error with the following
message:
ActionView::TemplateError: Missing template /_captcha.erb in view path
app/views:test/vendor/plugins/brain_buster/views/brain_busters
On line #23 of app/views/contacts/_form.html.erb
20: <%= f.label :message %><br />
21: <%= f.text_area :message %>
22:
2011 Jul 28
2
RSpec, shoulda-matchers and Rails model attributes validations
I was trying out RSpec framework in a project and got stopped doing the unit
test of a model. In particular, doing the test for the associations and the
ActiveRecord validations.
I started writing the validations but my tests didn''t look DRY at all.
Before refactoring the tests checked out and look for other people
solutions.
I found out shoulda-matchers and Shoulda (which if I
2011 Sep 05
0
undefined method `dependent' - rspec and shoulda
hello,
Getting this error when using shoulda and rspec for model tests.
my gemfile
...
gem "shoulda-matchers"
..
spec file
..
it { should have_many(:balances).dependent(:destroy) }
error:
User shoulda validations
Failure/Error: it { should
have_many(:balances).dependent(:destroy) }
NoMethodError:
undefined method `dependent'' for