https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Add the systems table.
* web/ranch/test/unit/system_test.rb: New. Test unit of the model.
* web/ranch/test/fixtures/systems.yml: New. Fixtures for the model.
* web/ranch/app/models/system.rb: New. Models corresponding to the
table.
* web/ranch/app/models/bench.rb: Benches table has a system_id field.
* web/ranch/db/schema.rb: Add the system table.
app/models/bench.rb | 1 +
app/models/system.rb | 5 +++++
db/schema.rb | 6 ++++++
test/fixtures/systems.yml | 5 +++++
test/unit/system_test.rb | 10 ++++++++++
5 files changed, 27 insertions(+)
Index: web/ranch/test/unit/system_test.rb
--- web/ranch/test/unit/system_test.rb (revision 0)
+++ web/ranch/test/unit/system_test.rb (revision 0)
@@ -0,0 +1,10 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class SystemTest < Test::Unit::TestCase
+ fixtures :systems
+
+ # Replace this with your real tests.
+ def test_truth
+ assert_kind_of System, systems(:first)
+ end
+end
Index: web/ranch/test/fixtures/systems.yml
--- web/ranch/test/fixtures/systems.yml (revision 0)
+++ web/ranch/test/fixtures/systems.yml (revision 0)
@@ -0,0 +1,5 @@
+# Read about fixtures at
http://ar.rubyonrails.org/classes/Fixtures.html
+first:
+ id: 1
+another:
+ id: 2
Index: web/ranch/app/models/bench.rb
--- web/ranch/app/models/bench.rb (revision 31)
+++ web/ranch/app/models/bench.rb (working copy)
@@ -2,5 +2,6 @@
belongs_to :project
has_many :output
+ belongs_to :system
end
Index: web/ranch/app/models/system.rb
--- web/ranch/app/models/system.rb (revision 0)
+++ web/ranch/app/models/system.rb (revision 0)
@@ -0,0 +1,5 @@
+class System < ActiveRecord::Base
+
+ has_many :bench
+
+end
Index: web/ranch/db/schema.rb
--- web/ranch/db/schema.rb (revision 31)
+++ web/ranch/db/schema.rb (working copy)
@@ -8,6 +8,7 @@
t.column "name", :string, :limit => 128, :default =>
"noname", :null => false
t.column "project_id", :integer, :default => 0, :null => false
t.column "revision", :integer, :default => 0, :null => false
+ t.column "system_id", :integer, :default => 0, :null => false
end
add_index "benches", ["project_id"], :name =>
"project_id"
@@ -37,4 +38,9 @@
t.column "head_revision", :integer, :default => 0, :null => false
end
+ create_table "systems", :force => true do |t|
+ t.column "hostname", :string, :limit => 128, :default =>
"localhost", :null => false
+ t.column "info", :text, :default => "", :null => false
+ end
+
end