similar to: rspec fixtures stay in the test db - is this right?

Displaying 20 results from an estimated 4000 matches similar to: "rspec fixtures stay in the test db - is this right?"

2006 May 09
2
load fixtures
I''m finally getting beyond using basic test fixtures, and a few questions have popped up. Has anyone found ways to do these? 1. Use a test fixture that is named differently from its table name? We''d like to have more than one possible fixture per table. (Or perhaps use test fixtures named similarly but in different directories.) 2. Load a test fixture for one test method only
2007 Aug 08
1
Transactional fixtures not working as expected
Hi! I am quite new to BDD and I just wrote my first tests. Suddenly I received unexpected results because in a model test I load only users-fixtures but when the views-fixtures in which I load the posts-fixtures, are run before this model-test, the posts-fixtures are loaded too. I test for example if there is one record in the posts-table after creating one post. But when there are fixtures
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
2007 May 21
2
Rails'' fixtures suck! But what about something like this?
Sorry about the very long email, but this is a hairy topic that''s been annoying me for some time and I decided to try to do something about. Also, if you got this twice, I apologize too, but it didn''t seem to have successfully gone out the first time. Background: ---------- I''ve been dealing with Rails for about a year and a half now. I''ve been using
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
2007 Sep 07
4
fixtures in before(:all)
I was planning on using a fixture within a description that didn''t modify the fixture, so I put it in a before(:all) block: describe "Customer", "xml" do fixtures :customers before(:all) do one = customers(:one) end # ... As a result, I got this message: 1) NoMethodError in ''Customer xml before(:all)'' You have a nil object when you
2007 Jun 27
5
Mosquito Fixtures Won''t Load
I can''t get fixtures to load correctly in a Mosquito test. The first fixture loads in the unit test, but the rest don''t load at all. File structure: tracker/ tracker.rb test/ test_tracker.rb fixtures/ tracker_measurements.yml tracker_projects.yml Relevant test code: require ''rubygems''
2007 Dec 01
10
Fixtures Cleanup
All, I''ve been playing a bit with some patches to make the fixture loading and management code a little bit easier to maintain. If I were to start chopping out features, how would you feel about losing: Fixture instantiation, Old school single-file fixtures, CSV fixtures, The ability to specify a subset of fixtures (everything''s always loaded instead), The ability to
2007 May 18
3
Fixtures considered harmful?
I''m trying to get really serious about doing true BDD for a new Rails project, and I note that at <http://rspec.rubyforge.org/documentation/ rails/index.html> it says: "we really don?t recommend the use of rails fixtures" On the same page it also says (about Model specs): "these are the only specs that we feel should actually interact with the database"
2006 Apr 28
2
Accessing fixtures from unit tests
I have set up some fixtures in test/fixtures/users.xml: # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html admin: id: 1 username: admin password: admin pbarry: id: 2 username: pbarry I have a unit test for my user model: require File.dirname(__FILE__) + ''/../test_helper'' class UserTest < Test::Unit::TestCase fixtures :users def
2009 Mar 28
10
Use fixtures within fixtures?
Heya, I''m using globalize2 and have following problem with my fixtures: categories.yml: one: parent_id: two color: #ff00aa two: color: #00ff11 three: parent_id: two color: #ab00ab category_translations.yml one-en: id: one locale: en name: Cars one-es: id: one locale: es name: Coches two-en: id: two locale: en name: Start two-es: id: two locale: es
2005 Dec 15
3
Fixtures and table name
Is there a way to use table name other than the default or to turn it around have multiple fixture files associated to the same table. Here''s my use case: I have multiple unit test classes that all work with the same model class and hence the same database table. However, for each test class I want the data to be in a different state. So I''d like to have something like class
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:
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
2009 Dec 22
1
Rails fixtures - defining a table name?
Hi, At the minute all my fixtures have the same name as the table that they are intended for, because of a recent issue with rails it doesn''t seem possible to have a fixture beginning with the word ''test'' Does anyone know of a way to have a different fixture name and then map it to the correct table? Thanks -- Posted via http://www.ruby-forum.com/. -- You received
2006 Aug 04
1
All Fixtures plugin
Just released a very simple plugin for including all fixtures in your tests. Once you have a large number of table, manually managing the fixtures for every single test stub can be quite tedious. Use as follows class BlogArticleTest < Test::Unit::TestCase all_fixtures def test_foo ... end end Couldn''t be easier. More info here:
2010 Jun 03
2
creating fixtures for has_many :through
I''m stymied at how to create a fixture that establishes a has_many :through relationship. I''ve watched the railscast at: http://media.railscasts.com/videos/081_fixtures_in_rails_2.mov ... but that''s for HABTM relationships. I''ve read: http://www.ruby-forum.com/topic/145676 but that ultimately doesn''t answer any question. So with no further ado:
2008 Jul 20
10
STI and fixtures
Hi all ! Loading fixtures doens''t seems to associate my 2 objects, do know what''s wrong ? In app/ class Manager < Employee has_many :employees, :foreign_key => :reports_to end class Employee < Person belongs_to :manager, :foreign_key => ''reports_to'' end class Person < ActiveRecord::Base belongs_to :address end fixtures for
2006 Jul 02
2
Fixtures Problem
I''m having a problem configuring fixtures -- for some reason, when I run my unit test, I''m not getting any of the instance variables that are advertised in "Agile Web Development with Rails". I''ve gone through various Wikis and Google, and it seems like I''m the only person with this problem. There is no error message per se, but when I try to use the
2006 Mar 23
7
Fixtures just Do Not Work for Me
Hello, I have been struggling to get fixtures to work here with no success. They just Do Not Work For Me (tm). I have created a model named Headline with the `generate'' script and modified the test/fixtumes/headlines.yml as follows ---------- gita: id: 1 author: raulseixas title: gita happened_at: 2005-01-01 00:00:00 description: gita This is the CD reissue of