similar to: timestamps in fixtures

Displaying 20 results from an estimated 20000 matches similar to: "timestamps in fixtures"

2006 Jan 07
1
How to DRY with Fixtures (helper or extend Time class, how)?
I have a test/fixtures/users.yml like so: apa: id: 1 username: apa [...] created_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%> updated_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%> I don''t like how I''m repeating myself with the strftime bit. Is there some shorter Time method to format time for a (MySQL) datetime field that
2006 Jul 13
1
fixtures getting a little hard to manage
I have lots of tests which rely on fixtures being a particular state in order to pass. For example, one test checks that a User object can have no more than 3 associated ''Page'' objects at a time. That''s a simple example but I have more complicated tests too. The problem is I sometimes add a fixture without realising it''ll affect the tests and everything
2006 Jun 08
4
datetime fixture format for Mysql 5.0
Hi All: I develop on several machines, most have Mysql 4.* and one has Mysql 5.0. On 4.*, the following erb for a fixture works fine: updated_at: <%= 1.days.ago.to_s:db%> But fails on 5.0. I had a similar deal when I had date fixtures, and switched forrmats so that both 4.* and 5.0 were happy. is there to_s:db_works_for_mysql_50() ? or similar? Thanks Forrest
2006 Jun 13
2
Locating an arbitrary fixture...
Is there a good way to get an arbitrary fixture from the generated fixture function? I need a way to get one of my fixtures, I don''t care which one. It doesn''t need to be random and could always return the same fixture. This is part of a support function for custom assertions and it doesn''t know what class its working on, let alone what fixture names are possible.
2005 Aug 23
0
Fixtures: pluraly bitten
With my functional tests (on PgSQL) I get strange errors like this 1) Error: test_create(AufgabeControllerTest): ActiveRecord::StatementInvalid: ERROR: duplicate key violates unique constraint "aufgaben_pkey" Tracking this down, I found that sequences are only reset for some of the tables I''m using. The reason? Inconsistent singularization. I won''t go so far as
2006 May 21
5
model methods
Hello everyone, In my model, I have def leave_at_formatted leave_at.strftime("%I:%M %p") end I was wondering if there were any way to define to_s for leave_at in order to get the same result? Thanks!
2006 Jan 09
5
Formatting timestamp objects
I want to print my timestamp objects in a specific format. I want to print a date like this: Sunday, January 8 2006 I don''t want it to print January 08. For the time, I want it to look like this: 9:08 pm Not 09:08 and lower case PM. I created these methods: def format_date(date) date.strftime("%A, %B #{date.day} #{date.year}") end def format_time(date) if
2005 Nov 10
6
Manually loading fixture data
Hi all, I''ve got some tables with fixed amounts of data in them (a "states" table, for example). For tables like this I can easily put *all* of the data in the fixture. For general futzing purposes, and for those times I want to reload a database from scratch outside of testing (for whatever reason), what''s the best approach? I thought perhaps ActiveRecord::Base had
2007 Apr 17
3
using rake db:fixtures:load with rspec fixtures
Hi, I''m new to rspec. I have some fixtures in /spec/fixtures. If they were in /test/fixtures they could be loaded with rake db:fixtures:load. Is there any way other than a symlink to load my rspec fixtures into the database with rake? Or, can I cause rspec to load the fixtures from /test/fixtures? Thanks, Paul
2006 Jul 10
1
rake db:fixtures:load FIXTURES=xyz
I am attempting to do selective fixture loading against my test database. When I run rake db:fixtures:load FIXTURES=DataSetInfo I get no output. (A full trace is below). I''m trying to figure out why nothing happens. 1) Does the command above attempt to operate against my test database? 2) DataSetInfo is the name of my table and the name of my yml file I generated these YAML
2011 Aug 10
1
How to stop Rspec loading my Cucumber fixtures
I have a bunch of fixtures designed to populate the database for my Cucumber integration tests. But at this stage I want my database to be empty when using Rspec. So, I moved the fixtures from `/spec/fixtures` to `features/support/fixtures`, and updated `features/support/env.rb` to read: Fixtures.reset_cache fixtures_folder = File.join(RAILS_ROOT, ''features'',
2011 Dec 25
1
Fixtures vs Fixture class, what is the intended purpose?
Hello, i am trying to fix the code for fixtures in rails because it is buggy and internal variable names are confusing, could somebody please explain to me what is the intended purpose of Fixture and Fixtures classes respectively? For example, why do we need both `Fixtures.initialize`and `Fixture.initialize`? They both "initialize" a single fixture, and in fact `Fixture.initialize`
2007 Mar 29
1
Extending the to_s method
Hi! I''m developing an localization plugin (just for my own purposes) and I wanted to extend the to_s method for the Time class. What I want to do: when someone does date.to_s(:short) that a localized version of the :short date is displayed. But I don''t know how to accomplish this. I know have this: class Time def to_s(option) print option.to_yaml
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
2008 Jun 19
0
Error loading fixtures with classes that set_table_name
Hi all, I just hit a big wall involving a legacy database. I''ve got an active record class called "School" that uses "set_table_name ''old_school''" to map to a legacy database table: class School < ActiveRecord::Base set_table_name ''old_school'' end It works great, until I''m testing and I want to use fixtures.
2008 Jun 23
0
Error loading fixtures for classes that set_table_name
Hi all, I just hit a big wall involving a legacy database. I''ve got an active record class called "School" that uses "set_table_name ''old_school''" to map to a legacy database table: class School < ActiveRecord::Base set_table_name ''old_school'' end It works great, until I''m testing and I want to use fixtures.
2006 Jan 24
0
Fixtures subdirectories
Hi, [This is a repost, I can?t find where went my previous post, ] I wanted to create subdirectories in the fixtures directory in order to be able to manage many different initial states for my system (or to sort fixtures / corresponding model subpackages). I came up with the idea of writing: Test::Unit::TestCase.fixture_path = RAILS_ROOT + "/test/fixtures/selling"
2005 Dec 12
2
Using a lib in YAML fixtures
I''m using the runt library [1] to do some temporal expression matching. I want to keep the expression in a binary field in my db. I figured that then in order to do the fixtures, I''d need to do some erb in the yaml file. So I came up with this: onetime: id: 1 name: One Time description: This event occurs only one time. timex: <%= REYear.new(7) & REMonth.new(24)
2006 Jul 18
1
Fixtures Max Size? SystemStackError: stack level too deep
Hello, I have a table of zipcodes that I am using in my application, so there are approximately 50,000 rows in this table. I have dumped the table to a fixture yaml file to represent this data, but when I try to load it, I get this error: SystemStackError: stack level too deep Is there a max size allowed for a fixture file..? Here is the --trace output: rake db:fixtures:load --trace **
2006 Mar 30
3
Export Fixtures Plugin
= Description This plugin is a super lightweight tool used to export data into the test/fixtures directory. So if you want to export all your data from your production server into your development environment, this will simplify the process without having to load up your database manager. [%] rake db:fixtures:export_all RAILS_ENV=development [%] rake db:fixtures:load = INSTALLATION