Displaying 20 results from an estimated 1000 matches similar to: "Functional Testing"
2007 May 20
9
How to test for exceptions
Hi folks,
I''m in the process of converting a Test::Unit functional test to RSpec, but I''ve run into a slight problem. I tried looking through the documentation but I still don''t know what I missed.
Thanks in advance,
Blake
describe VenuesController, "on update" do
before(:each) do
@venue = mock("venue")
2011 Sep 01
2
Custom ActiveRecord Error Message
I''m generating 3 models on 1 controller and i''m rescuing
ActiveRecord::RecordInvalid for validation errors, however 2 of the
models have the same attribute called "name", and if there''s an error on
that field, I wouldn''t know whether that belongs to model A or model B.
What then is the best way of modifying the error message of a validation
error
2006 Nov 22
3
Controller Isolation
Hi,
I have a project that I had running under rspec 0.6.x and recently upgraded
to 0.7.2.
I am trying to isolate my controllers from the database as I go through and
change all the specs to run under 0.7.2.
I am having a problem where I need to make the create! method return the
mocked object as well as raise RecordInvalid exception. Is this at all
possible?
I use the rescue statement in my
2009 Jan 30
2
rescue ActiveRecord::RecordInvalid
Hi all,
I am using is_attachment plugin, but I will always end up with this
error:
RuntimeError in PostsController#create
BLAH
which was caused by:
version.filename = file_name_for_version(version_name)
begin
version.save!
rescue ActiveRecord::RecordInvalid
raise "BLAH"
end
end
RecordInvalid was raised by save! because is invalid.
Does anyone know why? I am uploading
2007 Nov 17
7
Down with Lambda!!
Rspec is all about using natural language to define behavior. In this
context, I feel that lambda is sorely out of place. I was chatting on
#irc and a pal of mine (wycats) proposed an interesting alternative:
alias_method :doing, :lambda
so instead of something like
lambda {post :create, {:title => nil}}.should
raise_error(ActiveRecord::RecordInvalid)
we get
doing {post :create, {:title
2007 Sep 13
2
Failing to raise an exception in a stub
I''ve come across rather strange behaviour when trying to raise an
exception in a stubbed method.
I''m speccing the behaviour of a Rails create action, where I''m using
save! to catch failed saves. In the case of working save, I''m using
the following stub:
@client.stub!(:save!).and_return(true)
which works fine.
However, in the negative case,
2006 Mar 29
2
save related models from one form
I have three tables customers, indentities and people. I hav ecreated
models for them. The are connected with foreign keys and
has_many/belongs_to in this fashion:
customers has_many: identities
identities belongs_to: customer
identities has_many: people
people belongs_to: identities
Now, I have a form in which I would like to create db entries for the
three tables. customers have a password
2007 May 22
3
Comments wanted about spec''ing out a couple controller methods
(oops, accidentally sent this to the rspec-devel list, sorry about that)
Could someone help me spec out these Rails controller methods? I
don''t know where to get started, especially with the transaction
stuff. Or, if anyone else could suggest ways I could improve the
code, that would be great as well.
Puzzle has_one Media. Both are AR model objects.
class PuzzlesController <
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 Aug 08
5
Can''t seem to spec a ActiveRecord::RecordInvalid exception properly...
1 def create
2 @user = User.new(params[:user])
3 @user.save!
4 self.current_user = @user
5 redirect_to user_path(@user)
6 flash[:notice] = "Thanks for signing up!"
7 rescue ActiveRecord::RecordInvalid
8 render :action => ''new''
9 end
I can''t seem to properly spec this out. I am trying numerous things, the
latest one is
2007 Apr 26
2
How to close Frame?
When I call frame.destory on Windows XP, I am told that
CodeLineStatistics/init.rb:5: [BUG] Segmentation fault
ruby 1.8.6 (2007-03-13) [i386-mswin32]
This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application''s support team for more information.
What''s the correct way to close the frame?
--
flyerhzm@hotmail.com
2007 Jan 19
2
[Xen-ia64-devel][PATCH] Fix Xen crash when creating VTI in some machines.
Xend will do a hypercall to destory domain when creating VTI guest fail.
If "is_vti"
not be set at this point, HV will call relinquish_vcpu_resource() which
belong
to domU. It may try to free a NULL pointer, so dom0 crash.
This patch fix it.
Signed-off-by, Zhang Xin < xing.z.zhang@intel.com >
Good good study,day day up ! ^_^
-Wing(zhang xin)
OTC,Intel Corporation
2006 Jun 22
1
Active Record question, orphaned children
I have a Deck object and a Card object with their corresponding tables. (You
know a deck of cards.) When I destory a Deck it leaves orphaned cards in
the database. Is there a way to set up the objects with ActiveRecord so that
when a parent object is destoryed the child objects are destroyed as well?
My code below.
class Deck < ActiveRecord::Base
has_many :cards
end
class Card <
2009 Jul 04
12
save! not allowed after validates_uniqueness
I have this in a model
validates_uniqueness_of :aspect, :scope => :user_id
In an instance method of the same model I have "save!" but I don''t touch
the :aspect attribute in that instance method at all.
Whenever that save! command is run however I get this error:
ActiveRecord::RecordInvalid: Validation failed: Aspect has
already been taken
I don''t
2011 Jul 28
2
rails 3 routing error
Here''s the error:
1) SessionsController GET ''new'' should be successful
Failure/Error: get :new
ActionController::RoutingError:
No route matches {:controller=>"sessions", :action=>"new"}
# ./spec/controllers/sessions_controller_spec.rb:8:in `block (3
levels) in <top (required)>''
2) SessionsController GET
2006 Jul 26
4
create! should return an Active Record object no matter what
I just using the bang versions of save and create after seeing Rick
(technoweenie) use it in his code. I like it much better.
I have a problem with the create! method. It doesn''t return an Active
Record object if it fails. That means you can''t display the errors on
the object. Whats the point than?
Here is a broken example that should work.
def create
@product =
2011 Jan 17
4
Factory Girl and attr_accessor with validation
I have a problem with a recent change to one of my models when created
via Factory.create.
class User < ActiveRecord::Base
attr_accessor :tc_check
validates :tc_check, :presence => true, :acceptance => true
...
end
The following definition fails, when calling
Factory.create(:valid_user)
Factory.define :valid_user, :class => User do |u|
u.email
2017 Mar 17
2
Re: VIR_ERR_OPERATION_INVALID from virDomainDestroyFlags call
"Daniel P. Berrange" <berrange@redhat.com> writes:
> On Fri, Mar 17, 2017 at 11:55:13AM +0100, Milan Zamazal wrote:
>> Hi, we experienced a strange, non-reproducible error after a successful
>> migration to another host. When we called virDomainDestroyFlags with
>> VIR_DOMAIN_DESTROY_GRACEFUL flag after the migration on the source host,
>> we got
2006 Jul 10
5
[SECURITY] Samba 3.0.1 - 3.0.22: memory exhaustion DoS against smbd
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
==========================================================
==
== Subject: Memory exhaustion DoS against smbd
== CVE ID#: CAN-2006-1059
==
== Versions: Samba Samba 3.0.1 - 3.0.22 (inclusive)
==
== Summary: smbd may allow internal structures
== maintaining state for share connections
== to grow unbounded.
==
2006 Jul 10
5
[SECURITY] Samba 3.0.1 - 3.0.22: memory exhaustion DoS against smbd
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
==========================================================
==
== Subject: Memory exhaustion DoS against smbd
== CVE ID#: CAN-2006-1059
==
== Versions: Samba Samba 3.0.1 - 3.0.22 (inclusive)
==
== Summary: smbd may allow internal structures
== maintaining state for share connections
== to grow unbounded.
==