Displaying 20 results from an estimated 1000 matches similar to: "Testing model: test becomes dependent on previous test"
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__) +
2005 Dec 23
6
Agile book - test error
Hi all,
I get an error when testing the "store_controller_test.rb"
The troublesome line is in the test below:
def test_add_to_cart
get :add_to_cart, :id => @version_control_book.id <<<
cart = session[:cart]
assert_equal @version_control_book.price, cart.total_price
assert_redirected_to :action => ''display_cart''
follow_redirect
2006 Mar 04
2
unittest, not loading yml data
Here is my products.yml
version_control_book:
id: 1
title: Pragmatic Version Control
description: How to use version control
image_url: /images/sk_svn_small.jpg
price: 29.95
date_available: 2005-01-26 00:00:00
automation_book:
id: 2
title: Pragmatic Project Automation
description: How to automate your project
2006 Feb 01
3
Test data life cycle confusion
Hi,
It states on page 140 of Agile Web Development with Rails:
Here?s the bottom line: even if a test method updates the test database,
the database is put back to its default state before the next test method is
run. This is important because we don?t want tests to become dependent
on the results of previous tests.
Well, I''ve been running into a brick wall with some functional tests
2006 Apr 21
2
NoMethodError with test_read_with_hash
While running the product_test.rb test fixture in the Agile Web
Development book (p. 148), but when I run
ruby test/unit/product_test.rb, I get the following error:
1) Error:
test_read_with_hash(ProductTest):
NoMethodError: You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]
2006 Nov 24
13
rSpec on Rails 1.2?
I just updated my Rails install to the most current Edge and my
controller specs fail:
1)
TypeError in ''The User Controller should be a user controller''
can''t convert nil into String
Each spec fails the same way.
<context string> <spec string>
can''t convert nil into String
Any ideas what''s up with this?
Thanks,
s.ross
2006 May 05
7
vim: space or tab in indenting?
this is semi-off topic but still related to ror.
i had a problem with testing my depot program (which i follow the
tutorial in agile web development book). it took me many hours to solved
the problem. all the while i thought i was using spaces inside the
test/fixtures/products.yml
programmer_book:
id: 1
title: Pragmatic Programmer
description: Best book
2007 Apr 30
7
Migrating spec_helper with modifications
Hello,
After moving into the HEAD of rspec, I am greeted with a mountain of errors,
which I expected, due to my specs not being migrated.
I use hpricot for a lot of my view tests, as it is extremely simple to
traverse the DOM with it. I used to include HpricotSpecHelper in
spec_helper.rb, like so:
require ''hpricot_spec_helper''
module Spec
module Rails
module Runner
2006 Apr 16
7
Problem running unit tests
I am running Rails 1.1.2 with Ruby 1.82-15. My database is Postgresql. I
haven''t had any problems generating models, migrations, using scaffolds, and
generally building and using my application, but I haven''t been able to get
testing to work. I initially just ignored the problem and kept developing,
but would like to add proper testing from here on out.
Currently when I type
2007 Mar 15
5
rake spec:views no transaction error
Hello,
I have recently upgraded to the 0.8.2 release of rSpec, and I am receiving
the following message with each view spec execution:
WARNING: there is no transaction in progress
I have upgraded the rspec_on_rails plugin as well, and both the model and
controller tests are working flawlessly. Is there some simple step I
missed? thanks for the input.
-Chris
-------------- next part
2008 Feb 12
4
Funny behavior with Fixtures... on Ubuntu..
Hey Guys,
I''ve got a test class that loads a bunch of fixtures. My understanding
is that fixtures are reloaded between each test... and I even have the
following two method calls at the top of my test class to make doubly
sure...
class TaskTest < Test::Unit::TestCase
self.use_transactional_fixtures = true
self.use_instantiated_fixtures = false
When I run my tests
2007 Mar 19
3
rSpec on Rails Integration Testing
I see that there is an integration testing example in the plugin
code. What is the thinking about integration specs?
Thanks,
Steve
2005 Dec 22
13
in-memory SQLite for testing
I am following the rails book, and arrived to the section about
testing. The test database is configured as:
test:
adapter: sqlite3
database: ":memory:"
and I get this error with the simple product test:
% ruby test/unit/product_test.rb
Loaded suite test/unit/product_test
Started
E/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/
errors.rb:94:in
2007 May 12
3
[OT] - In Memory Databases
My specs are still taking to long to run in a rails app. Is anyone
using an in-memory database to run their specs? Any pointers or tips?
Scott
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 31
2
Test Unit Problem
Hello All,
I am experiencing the following test unit error working with Rails that
I can''t fathom.
I have a products.yml file which holds the following test fixture for
the products table:
dell_pc:
id: 1
title: Dell PC
description: Dell PC
image_url: http://.../pc_image.jpg
price: 15000.00
date_available: 2005-12-31 06:53:00
I also have the following product_test.rb file to
2005 Dec 23
2
SQLite in-memory
I left ":memory:" in database.yml for testing and the most simple
tests in the Agile book do not work (see trace below for test_truth).
Since that''s what comes with the distributed database.yml I suppose
it''s me doing something wrong.
Did someone get SQLite ":memory:" working? How does it grab the schema?
-- fxn
% rake test_units
(in
2006 Mar 26
4
A unit test that should pass
Hi, I wonder why this unit test fails.
The model :
class Article < ActiveRecord::Base
set_table_name "publish_articles"
belongs_to :category
validates_presence_of :title, :excerpt
#snip
end
The test :
def test_validate
@article.title = nil
@article.excerpt = nil
assert !@article.save
assert_equal 2, !@article.errors.count
end
!@article.errors.count returns
2008 Feb 18
5
uh... fixtures?
RSpec-ers:
I''m aware this is quite the FAQ. I have probably asked it myself, but I just
can''t Google up anything but others asking it.
I grabbed the source to Beast, to use as a Rails project uninfluenced by me, or
RSpec. Then I installed the CURRENT version of RSpec and rspec_on_rails, and set
up a model spec on Post.
Here''s the spec_helper.rb lines:
2005 May 03
8
SQLite3 + RAM drive => 3 times faster unit tests
One problem I sort of always had with the ActiveRecord''s tight coupling
to the SQL backend is how slow it makes the unit tests. OK, there are
some ways to make it faster at a price of extra complexity (reusing the
fixtures, doing a rollback in the end of the test, etc), but still - it
is much slower than what I would like a unit test to be.
Today I had a very simple idea (why, oh why