There are a dozen Rails plugins whose goal is to replace fixtures in testing. Here are a few I can think of:
fixture replacement
factory girl
factories and workers
rails scenarios
fixture-scenarios
object daddy
There are probably others. Which of these plugins do you prefer and why?
...
The NUnit documentation doesn't tell me when to use a method with a testfixturesetup en when to do the setup in the constructor
public class MyTest
{
private MyClass myClass;
public MyTest()
{
myClass = new MyClass();
}
[TestFixtureSetUp]
public void Init()
{
myClass = new MyClass();
}
...
Because of some non standard table creation options I am forced to use the sql dump instead of the standard schema.rb (i.e. I have uncommented this line in the environment.rb config.active_record.schema_format = :sql). I have noticed that when I use the sql dump that my fixtures do not seem to be loaded into the database. Some data is l...
I'm using the Selenium Fitnesse Bridge Fixture in order to write tests in Fitnesse for Selenium. It's great because it covers ALL the functions that Selenium has. However, the problem I'm running into is storing variables like I would in Selenium IDE.
| !- fixtures.SeleniumFixture -!|
| setup | http://www.google.com/ | *chrome /usr/lib/...
I'm using the selenium IDE and the Selenium-Fitnesse Bridge fixture and I'm trying to test that when I clear a default value out of a form field, my form displays an error message.
So when I record with the Selenium IDE, what it does is the equivalent of telling Selenium to type nothing.
| type | text_field | |
The problem with this ...
In acts-as-authenticated, and now restful-authentication, the first user fixture is "Quentin."
Just curious if anyone knows the origin of that name? Quentin Tarantino? Someone's dog or child?
...
I'm reading about Rails fixtures in this guide (thanks, trevorturk). It appears you define classes in a Yaml file and they're automatically loaded into the test DB -- cool.
But if you want to specify that this recipe belongs to that cookbook (or whatever) how do you do that?
Are you supposed to specify the values for cookbook.id and re...
I find fixtures a bit tedious to use in Ruby on Rails, partly because I need to manually correct them after most migrations.
Is there a way (a plugin?) I can have my fixtures modified when I run my migrations?
...
I have an initializer which sets a default that is used throughout the app. The value is an ActiveRecord model, I'm essentially caching it for the lifetime of the app:
@@default_region = Region.find_by_uri("whistler")
The record is guaranteed to be in the database: it's fixture data which is referenced by other models. This works fine...
Since I've started using rspec, I've had a problem with the notion of fixtures. My primary concerns are this:
I use testing to reveal surprising behavior. I'm not always clever enough to enumerate every possible edge case for the examples I'm testing. Using hard-coded fixtures seems limiting because it only tests my code with the ve...
What data do you use with Selenium tests on Rails apps? Do you load from fixtures? Use an existing dev db? Use a separate (non-fixture) db?
I'm considering my options here. I have a Rails app with a large Selenium test suite that runs on a modified version of Selenium Grid. Part of the process, right now, is loading a large set of fixt...
I'm trying to write a FitNesse fixture against an interface (in c#). I want to be able to have the fixture dynamically load the implementation from a dll (so that I can use the same tests against different implementations of the same interface...i.e. mock data, live data, etc.). I have a init method in my fixture that takes 2 strings, ...
As described in this article, I am using automatic associations in fixtures. For example, if a region object has a country id, instead of doing "country_id": 1, I do "country": "USA". "USA" is a label in my countries.yml file, so fixtures knows how to take care of this. However, this only works when you do not specify an ID value for ...
Hello
I have the following join table that works:
class CreateRolesUsers < ActiveRecord::Migration
def self.up
create_table :roles_users,:id => false do |t|
t.integer :role_id, :null => false
t.integer :user_id, :null => false
end
end
def self.down
drop_table :roles_users
end
end
But I don't know h...
I am having trouble loading Django fixtures into my MySQL database because of contenttypes conflicts. First I tried dumping the data from only my app like this:
./manage.py dumpdata escola > fixture.json
but I kept getting missing foreign key problems, because my app "escola" uses tables from other applications. I kept adding addition...
How do you prefer to organize your test data in Ruby On Rails: fixtures, object factories or anything else? Why?
...
Hey all -
I'm trying to create some fixture data for my unit tests in CakePHP (via SimpleTest) and I have no idea how to handle my foreign key relationships. Here's a sample of the fixture code:
<?php
class SpecialtyFixture extends CakeTestFixture {
var $name = "Specialty";
var $import = "Specialty";
var $records = array(
...
I have fixtures with initial data that needs to reside in my database (countries, regions, carriers, etc.). I have a task rake db:seed that will seed a database.
namespace :db do
desc "Load seed fixtures (from db/fixtures) into the current environment's database."
task :seed => :environment do
require 'active_record/fixtures'
...
General Confusion
I have bands which can have 3 genres. I read in a previous SO post that the proper way to handle this is a couple steps:
1) In band.rb
has_and_belongs_to_many :genres
2) Create a band_genres join table
Even after reading the documentation, I am a bit confused as to what HABTM actually means. I guess I would just n...
I am working with Rails 2.3 and I have the following associations:
User:
has_many :photos
has_many :classifications
Photo:
belongs_to :user
has_many :classifications
Classification:
belongs_to :user
belongs_to :photo
I have a fixture for each model:
users.yml:
tester:
username: tester
...
photos.yml:
bianco:
id...