Displaying 20 results from an estimated 700 matches similar to: "Test data life cycle confusion"
2006 Jun 27
2
testing - how to get access to an instance variable
inside controller
def foo
@city = City.find(@params[:id])
@city.bar = 1234
end
While writing functional tests how do I ensure that the @city.bar is 1234?
def test_edit
get :edit, :id => 1
assert_not_nil assigns(:city)
#?? how to assert that city.bar is 1234
end
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2009 May 18
0
[PATCH server] fixed functional tests after recent controller refactoring and managed node controller fixes.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
src/test/functional/host_controller_test.rb | 41 --------------------
.../functional/managed_node_configuration_test.rb | 14 ++++---
src/test/functional/nic_controller_test.rb | 8 ----
src/test/functional/permission_controller_test.rb | 15 ++++---
src/test/functional/quota_controller_test.rb | 2 +-
2008 May 28
2
functional testing joins table problem
I have models/controllers
Class Facility
has_many :facilities_services, :dependent => :delete_all
Class Service
has_many :facilities_services, :dependent => :delete_all
Class FacilitiesServices
belongs_to :facility
belongs_to :service
so in my test/functional/facilities_controller_test.rb, I have
post :destroy, :id => 5
which tosses an error...
2006 May 05
7
Testing model: test becomes dependent on previous test
Im having trouble with Testing models. im following the tutorials in the
book Agile Web Development with Rails. if i execute the code
product_test.rb, i get this error:
============================================================
1) Failure:
test_update2(ProductTest) [test/unit/product_test.rb:30]:
<29.95> expected but was
<99.95>.
3 tests, 11 assertions, 1 failures, 0 errors
2006 Feb 21
0
DB not being repopulated prior to Unit test execution
I''m working my way through the AWD book and have just started the testing chapter. The first two unit tests run as expected. When I add the test for the ''destroy'' function to product_test.rb, however, I''m getting a failure I don''t understand.
The error I''m getting says that in the setup method for test_update, it "couldn''t
2005 Dec 22
1
How to write unit tests with respect to model callbacks?
Hello,
I am exploring the "Testing" part of Rails, but It seems some things
work differently than I thought it would.
Consider the following model:
class Client < ActiveRecord::Base
has_one :project
def after_create
Project.new(:name => self.name, :is_client => true, :client_id
=> self.id).save
end
def after_update
2009 Apr 05
0
New Relic & RightScale - Ruby on Rails Life Cycle Tools
Cloud Computing and Rails are a natural good fit. With tools provided
by New Relic integrated into the RightScale Deployment and Monitoring
platform you have a Best Practice Monitoring system.
I Deploy and Watch servers all day as part of the http://myCloudWatcher.com
service. When I started to build the demo for this next RightScale
Webinar I learned more about my application in the first few
2005 Aug 29
1
rsync process life cycle
I'm working with my ODBC database logging patch again, and I need
some information on how rsync process management works. Essentially
I need to close the database connection on a daemon process right
before the last process (be it receiver or generator) exits.
My question is, which process kills which process? Does the receiver
kill the generator, or vice versa? Do they each die
2015 Jun 04
2
[LLVMdev] a life-cycle question for MCJIT
Context:
We use MCJIT to generate machine code in our LLVM based JIT compiler.
The code generation process has roughly 5 steps:
0. Generate and optimize LLVM IR.
1. Call generateCodeForModule on the output of (0) to translate LLVM
IR to machine code.
2. Figure out the final locations for the code and data generated by
MCJIT using an allocator specific to our runtime. Make
2011 Jul 25
3
Life Cycle Assessment with R.
Hello everyone,
There's something really important about climate change and how many institutions around the globe are looking for softwares solutions in order to achieve they (and everyone) needs to improve life conditions in all the planet.
Currently, they're many comercial softwares working with this important topic named as: "Life Cycle Assesment", monitoring carbon emition,
2007 Feb 06
2
Testing RJS actions
Hi all !
This is my test:
def test_destroy_xhr
Article.expects(:find).with("1").returns(@article = mock("article"))
@article.expects(:destroy).returns(true)
delete :destroy, :id => 1, :format => :js
assert_template "destroy.rjs"
end
And my implementation:
def destroy
@article.destroy
respond_to do |format|
format.html {
2006 Aug 02
1
REST and functional tests
Just playing around with converting an apps to the new REST goodness in
edge rails, and I''m trying to work out how to convert/write the
functional tests.
Is the recommended way to explicitly use the actions (e.g. get :show,
:id => ...; post :create,..., etc) and test the routes separately, or
duplicate the request, in which case how is that done get "/", :id => 5
2006 Jan 06
0
scaffold code fails functional test?
I have the following scaffold generated code which does not run. It does not
even hit the breakpoint.
def create
breakpoint()
@student = Student.new(params[:student])
if @student.save
flash[:notice] = ''Student was successfully created.''
redirect_to :action => ''list''
else
render :action => ''new''
end
2006 May 04
6
second assert_tag failling in rails integration test
Hi all,
I''m fairly new to rails and ruby, but I''ve come across an interesting
glitch and I''m not sure whether I''ve just got something wrong with my
assumptions or if it really is an error in the underlying framework...
I''ve created a bare-bones set of tests to show you where the problem is.
What follows are the steps I went through to reproduce the
2006 May 03
1
Test not Reseting
My test are not resetting for each method in the test class.
It was promised to me on page 146 of Agile Web Development on Rails that
it would.
Am I doing something wrong? The "@delete_victim = User.find(4)" bust
the setup class each time it comes around, even though that is in my
users.yml
class UserTest < Test::Unit::TestCase
fixtures :users
def setup
2006 Mar 08
0
Unit tests dynamic finders
Hi all,
I am having a problem with unit tests. Whenever I have a dependency
between two models (B depends on A) deleting A should also delete B.
This is simple with the dependent parameter in the model file of A. But
when I write a test the dependency seems to work, I can''t find the
answer with id 1 anymore(Answer.find(1)). But I appearently _do_ find it
with
2006 Mar 17
0
unit_tests and deleting from the database
I get errors when running rake test_units:
test_destroy(LocationTest):
ActiveRecord::StatementInvalid: Mysql::Error: #23000Cannot delete or
update a pa
rent row: a foreign key constraint fails (`overblijf_tst/groups`,
CONSTRAINT `fk
_groups_locations` FOREIGN KEY (`location_id`) REFERENCES `locations`
(`id`)): D
ELETE FROM locations
Any pointers??
--
Posted via http://www.ruby-forum.com/.
2006 Mar 20
2
Testing Models And Fixtures
I have finally decided to look into testing and I am going through
the examples in the AWDWR book and I tried the following and it does
not work... even though I don''t see why it shouldn''t.
===========
posts.yml
===========
basic_post:
id: 1
title: Title
body: Body
created_at: 2006-02-01 00:00:00
updated_at: 2006_02-02 00:00:00
2005 Dec 20
0
Problem destroying in unit tests with HABTM
Hi converted two of my models to HABTM today but I am having a real
hard time getting my unit tests to pass now. Specifically, when I
destroy a record I get this error:
...many many lines of this above...
(eval):4:in `destroy_without_habtm_shim_for_categories''
(eval):4:in `destroy_without_habtm_shim_for_categories''
(eval):4:in
2006 Jul 06
0
problema con i test automatizzati
ciao a tutti.
come al solito, sto andando avanti a piccoli passi nel creare
l''applicazione depot del libro "Sviluppare Applicazioni Web con Rails".
Ora mi trovo nella fase di creazione dei test automatizzati.
Ma c''è una cosa che proprio non capisco:
Ho la seguente classe in ~/depot/test/unit/product_test.rb
require File.dirname(__FILE__) +