Modified fixtures files (test/fixtures/*.yml) to use true and false values rather than 1/0 or 't'/'f' or a variable that set either of those appropriately.

Fixes #326. Thanks, Ben!



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@283 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2006-07-17 18:01:35 +00:00
parent 1ee651f8bb
commit 847c283c5b
4 changed files with 27 additions and 68 deletions

View file

@ -1,80 +1,64 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
<%
# This writes the fixture boolean columns appropriately
# depending on the database adapter
#
abcs = ActiveRecord::Base.configurations
case abcs[RAILS_ENV]["adapter"]
when "mysql", "oci"
b_true = 1
b_false = 0
when "postgresql", "sqlite", "sqlite3"
b_true = 't'
b_false = 'f'
else
raise "Task not supported by '#{abcs["test"]["adapter"]}'"
end
%>
agenda:
id: 1
name: agenda
position: 1
hide: <%= b_false %>
hide: false
user_id: 1
call:
id: 2
name: call
position: 2
hide: <%= b_false %>
hide: false
user_id: 1
email:
id: 3
name: email
position: 3
hide: <%= b_false %>
hide: false
user_id: 1
errand:
id: 4
name: errand
position: 4
hide: <%= b_false %>
hide: false
user_id: 1
lab:
id: 5
name: lab
position: 5
hide: <%= b_false %>
hide: false
user_id: 1
library:
id: 6
name: library
position: 6
hide: <%= b_false %>
hide: false
user_id: 1
freetime:
id: 7
name: freetime
position: 7
hide: <%= b_false %>
hide: false
user_id: 1
office:
id: 8
name: office
position: 8
hide: <%= b_false %>
hide: false
user_id: 1
waitingfor:
id: 9
name: waiting for
position: 9
hide: <%= b_false %>
hide: false
user_id: 1

View file

@ -1,26 +1,11 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
<%
# This writes the fixture boolean columns appropriately
# depending on the database adapter
#
abcs = ActiveRecord::Base.configurations
case abcs[RAILS_ENV]["adapter"]
when "mysql", "oci"
b_true = 1
b_false = 0
when "postgresql", "sqlite", "sqlite3"
b_true = 't'
b_false = 'f'
else
raise "Task not supported by '#{abcs["test"]["adapter"]}'"
end
%>
timemachine:
id: 1
name: Build a working time machine
description: ''
position: 1
done: <%= b_false %>
done: false
user_id: 1
moremoney:
@ -28,7 +13,7 @@ moremoney:
name: Make more money than Billy Gates
description: ''
position: 2
done: <%= b_false %>
done: false
user_id: 1
gardenclean:
@ -36,5 +21,5 @@ gardenclean:
name: Evict dinosaurs from the garden
description: ''
position: 3
done: <%= b_false %>
done: false
user_id: 1

View file

@ -19,17 +19,7 @@ end
# This writes the fixture boolean columns appropriately
# depending on the database adapter
#
abcs = ActiveRecord::Base.configurations
case abcs[RAILS_ENV]["adapter"]
when "mysql", "oci"
b_true = 1
b_false = 0
when "postgresql", "sqlite", "sqlite3"
b_true = 't'
b_false = 'f'
else
raise "Task not supported by '#{abcs["test"]["adapter"]}'"
end
%>
1:
@ -38,7 +28,7 @@ end
project_id: 2
description: Call Bill Gates to find out how much he makes per day
notes: ~
done: <%= b_false %>
done: false
created_at: <%= last_week %>
due: <%= two_weeks_hence %>
completed: ~
@ -50,7 +40,7 @@ end
project_id: 3
description: Call dinosaur exterminator
notes: Ask him if I need to hire a skip for the corpses.
done: <%= b_false %>
done: false
created_at: <%= today %>
due: <%= two_weeks_hence %>
completed: ~
@ -86,7 +76,7 @@ end
project_id: 1
description: Construct time dilation device
notes: ~
done: <%= b_false %>
done: false
created_at: <%= today %>
due: ~
completed: ~
@ -98,7 +88,7 @@ end
project_id: 1
description: Phone Grandfather to ask about the paradox
notes: Added some _notes_.
done: <%= b_false %>
done: false
created_at: <%= today %>
due: <%= last_week %>
completed: ~
@ -110,7 +100,7 @@ end
project_id: 3
description: Get a book out of the library
notes: 'Dinosaurs''R'
done: <%= b_false %>
done: false
created_at: <%= today %>
due: ~
completed: ~
@ -122,7 +112,7 @@ end
project_id: ~
description: Upgrade to Rails 0.9.1
notes: ~
done: <%= b_true %>
done: true
created_at: <%= today %>
due: <%= today %>
completed: <%= today %>
@ -134,7 +124,7 @@ end
project_id: ~
description: This should be due today
notes: ~
done: <%= b_false %>
done: false
created_at: <%= today %>
due: <%= today %>
completed: ~
@ -158,7 +148,7 @@ end
project_id: 2
description: Buy shares
notes: ~
done: <%= b_false %>
done: false
created_at: <%= today %>
due: 2005-02-01
completed: ~
@ -170,7 +160,7 @@ end
project_id: 3
description: Buy stegosaurus bait
notes: ~
done: <%= b_false %>
done: false
created_at: <%= today %>
due: <%= next_week %>
completed: ~
@ -182,7 +172,7 @@ end
project_id: 3
description: New action in context
notes: Some notes
done: <%= b_false %>
done: false
created_at: <%= today %>
due: <%= next_week %>
completed: ~
@ -194,7 +184,7 @@ end
project_id: 2
description: Call stock broker
notes: 'tel: 12345'
done: <%= b_false %>
done: false
created_at: <%= last_week %>
due: ~
completed: ~

View file

@ -4,7 +4,7 @@ admin_user:
login: admin
password: <%= Digest::SHA1.hexdigest("#{SALT}--abracadabra--") %>
word: <%= Digest::SHA1.hexdigest("adminSat Feb 25 17:14:00 GMT 20060.236961325863376") %>
is_admin: 1
is_admin: true
preferences: "---\nstaleness_starts: \"7\"\ndate_format: \"%d/%m/%Y\"\nno_completed: \"5\"\nadmin_email: butshesagirl@rousette.org.uk\nweek_starts: \"1\"\ndue_style: \"0\""
other_user:
@ -12,5 +12,5 @@ other_user:
login: jane
password: <%= Digest::SHA1.hexdigest("#{SALT}--sesame--") %>
word: <%= Digest::SHA1.hexdigest("janeSun Feb 19 14:42:45 GMT 20060.408173979260027") %>
is_admin: 0
is_admin: false
preferences: "---\nstaleness_starts: \"7\"\ndate_format: \"%d/%m/%Y\"\nno_completed: \"5\"\nadmin_email: butshesagirl@rousette.org.uk\nweek_starts: \"1\"\ndue_style: \"0\""