Displaying 20 results from an estimated 2000 matches similar to: "Fixtures Problem"
2008 Jan 31
6
loading fixtures?
How do you load fixtures from specs as you would test?
eg. rake db:fixtures:load RAILS_ENV=development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080131/38c3b0ab/attachment.html
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
2006 Jul 29
1
Anything wrong with this test? Cannot access fixture
Hi,
I have problem accessing the testfixture. The values from the
YML-Fixture-File are correctly written into database, but accessing the
fixture is impossible. It is always nil.
Is anything wrong with this test?
class MyModelTest < Test::Unit::TestCase
fixtures :my_model
def test_simple
a = MyModel.find(@my_model["first"].id) # Accessing @my_model is
impossible
...
2006 Aug 03
2
Including ALL fixtures for a test
I am running into some issues with my functional tests because they need
info from almost every single table in the database. I have long
laundry lists of fixture names to include on these test files and then I
have to troubleshooot bizarre test failures because of a fixture that
was not included.
So is there a way to simply include all fixtures in a test? Something
like:
fixtures :all
2005 Oct 27
2
Fixtures are not loading into instance variables. Why not?
Hi,
I have a fixture in a unit test and I see that the
fixture is loaded correctly into the database table,
but no instance variables are created.
So now I''m stuck.
More background: this is my first RoR project and I
have just installed the SaltedLoginGenerator and
generated its output.
Running the unit tests gives an error, so I cut it
down to just 1 test:
2006 Jun 08
2
accessing fixtures in tests
hi all,
my first attempt at tests and i''m having trouble accessing the
fixture values, if anyone can make it suggestions.
i have news_release_test.rb, using new_releases.yml as the fixture file
according to the agile book, i should be able to access the fixture
properties within my test as such:
assert_equal @first_test.id , @news_release.id
unfortunately, i try that and get:
2006 Jan 16
2
My first test - named fixture not autoloading instance variable
I''m trying to write a test like the one at the bottom of page 148 in
Agile Rails.
I''m using rails 1.0
I''ve created the fixture correctly I''m pretty sure because the test
database table is being populated per the fixture.
I have what I think is a simple unit test:
=========
require File.dirname(__FILE__) + ''/../test_helper''
class CaseTest
2006 May 23
2
Putting fixtures into subdirectories
I want to organize my fixtures just like the namespace of my models. So
for example if I have a model Company::Employee I''d like the fixture to
be in fixtures/company/employees.yml.
However, I can''t figure out how to specify the path of the fixture file.
If I do:
fixtures :employees
in my unit test it can''t find the fixture file. Any suggestions?
Thanks,
Todd
2006 Apr 26
3
Test fixture syntax
OK, I know I''m doing something bone-headed, but I can''t for the life of
me figure it out.
I''ve read the test fixtures Rdoc about eight dozen times, and it says
(to me) that if I have a YAML fixture file, dogs.yml that looks like
this:
fido:
id: 1
breed: Terrier
fifi:
id: 2
breed: Poodle
Then I can include
fixtures :dogs
in my functional test, and
2005 Oct 28
2
Accessing fixture
I have a very simple problem. I can''t seem to access
a the fixture by name
I have a sites.yml with:
simple_site:
id: 1
name: demo
description: A demo site
created_on: 2005-10-25 00:00:00
updated_on: 2005-10-25 00:00:00
And I have a test class as:
require File.dirname(__FILE__) + ''/../test_helper''
class SiteTest < Test::Unit::TestCase
fixtures
2006 Jan 11
3
Test fixtures not loaded
I have a problem with test fixtures. The data from the fixtures is
loaded into the db (MySQL) but the variables in the test cases are not
present. The logfiles contain nothing looking like an error.
Any hints what I could have done wrong? Or how to debug this situation?
thanks
Frank
2006 Aug 14
6
Testing fails with fixtures not when invoked directly
I have three files organization.rb, company.rb, and department.rb. I want
to ensure the department always has a company
require File.dirname(__FILE__) + ''/../test_helper''
class OrganizationTest < Test::Unit::TestCase
fixtures :organizations
def setup
@smo = organizations(:smo)
end
def test_department_company_defaults_to_parent
org = Department.new(:name =>
2006 Jan 06
4
Design flaw with Fixtures?
I''ve been trying to add unit testing for collection of models with
complex relationships -- and failing miserably.
Because of the complexity of the relationships, I''m using a database
which validates foreign key constraints (PostgreSQL 8).
I''m finding it nearly impossible to generate tests that are independent
of each other. The basic problem is the DELETE then
2007 Jul 22
18
db:fixtures:load order
I was trying to deal with foreign key issues related to order of
fixture loading when I came across this:
http://techpolesen.blogspot.com/2007/04/rails-fixture-tips.html
This got me looking deeper into rails and I noticed that
db:fixtures:load calls Fixtures.create_fixtures once for each fixture
file. However, Fixtures.create_fixtures is capable of taking multiple
files and also handle the
2006 Aug 11
5
Unit tests - NilClass problem
Hi!
Yesterday I started to write my unit tests for the fist time using
rails. I''m using this method:
http://blog.codahale.com/2005/12/23/a-rails-howto-simplify-your-unit-tests/
My customer_test.rb looks like this:
require File.dirname(__FILE__) + ''/../test_helper''
class CustomerTest < Test::Unit::TestCase
fixtures :customers
# Replace this with your real
2006 Mar 19
2
Unit test confusion
Hey all,
I''m following along with AWDWR, specifically the unit testing.
On page 148, it shows you how Test::Unit::TestCase will automatically
define instance variables based on your fixtures.
It doesn''t seem to actually work, though. It seems that both @artists
["beatles"]["name"] and @beatles.name are nil objects in my test,
where as
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 Aug 16
4
Accessing Constants Declared in Helper Modules
Hello all,
I''m having great trouble accessing a constant declared in a helper for
one of my view templates. I am trying to create a grouped selection list
based on a predefined set of values. Rather than declare this set of
values in the view, I wanted to put it in the helper that automatically
gets included for the view. Unfortunately, it doesn''t seem to work.
All methods
2006 Jan 30
5
Functional tests and dealing with login before_filter
Hi all,
I''m curious as to how you do functional testing on the controllers if, within
the ApplicationController, I have a before_filter :authorize, :except =>
:login, where the private authorize method checks for session[:user].
I can''t do "post :login", because that method is in a different controller.
I tried setting session[:user] directly in the setup
2006 Mar 21
3
Instance variable shortcuts to fixture data are not working?
Hi,
I am following the Agile Web Development with Rails book and it looks
like either book is wrong or edge rails are broken.
I am trying to access fixture data through instance shortcuts. I.e.
customers.yml through @customers and it is not assigned.
Anybody knows why?
Sergei
--
Posted via http://www.ruby-forum.com/.