Browse files

Adding in rubygems, versions, and dependencies

  • Loading branch information...
1 parent 7b37511 commit 5a31c5ef8a93d6646ffbcf3cd832f4eadce67b0b @qrush qrush committed May 27, 2009
View
2 app/models/dependency.rb
@@ -0,0 +1,2 @@
+class Dependency < ActiveRecord::Base
+end
View
2 app/models/rubygem.rb
@@ -0,0 +1,2 @@
+class Rubygem < ActiveRecord::Base
+end
View
2 app/models/version.rb
@@ -0,0 +1,2 @@
+class Version < ActiveRecord::Base
+end
View
15 db/migrate/20090527122639_create_rubygems.rb
@@ -0,0 +1,15 @@
+class CreateRubygems < ActiveRecord::Migration
+ def self.up
+ create_table :rubygems do |table|
+ table.string :name
+ table.string :token
+ table.integer :user_id
+ table.timestamps
+ end
+
+ end
+
+ def self.down
+ drop_table :rubygems
+ end
+end
View
17 db/migrate/20090527122649_create_versions.rb
@@ -0,0 +1,17 @@
+class CreateVersions < ActiveRecord::Migration
+ def self.up
+ create_table :versions do |table|
+ table.string :authors
+ table.text :description
+ table.integer :downloads
+ table.string :number
+ table.integer :rubygem_id
+ table.timestamps
+ end
+
+ end
+
+ def self.down
+ drop_table :versions
+ end
+end
View
15 db/migrate/20090527122658_create_dependencies.rb
@@ -0,0 +1,15 @@
+class CreateDependencies < ActiveRecord::Migration
+ def self.up
+ create_table :dependencies do |table|
+ table.string :name
+ table.integer :rubygem_id
+ table.string :requirement
+ table.timestamps
+ end
+
+ end
+
+ def self.down
+ drop_table :dependencies
+ end
+end
View
28 db/schema.rb
@@ -9,7 +9,23 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20090527120326) do
+ActiveRecord::Schema.define(:version => 20090527122658) do
+
+ create_table "dependencies", :force => true do |t|
+ t.string "name"
+ t.integer "rubygem_id"
+ t.string "requirement"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "rubygems", :force => true do |t|
+ t.string "name"
+ t.string "token"
+ t.integer "user_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
create_table "users", :force => true do |t|
t.string "email"
@@ -24,4 +40,14 @@
add_index "users", ["id", "token"], :name => "index_users_on_id_and_token"
add_index "users", ["token"], :name => "index_users_on_token"
+ create_table "versions", :force => true do |t|
+ t.string "authors"
+ t.text "description"
+ t.integer "downloads"
+ t.string "number"
+ t.integer "rubygem_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
end
View
5 test/factories/dependency.rb
@@ -0,0 +1,5 @@
+Factory.define :dependency do |dependency|
+ dependency.name { 'string' }
+ dependency.rubygem_id { 1 }
+ dependency.requirement { 'string' }
+end
View
5 test/factories/rubygem.rb
@@ -0,0 +1,5 @@
+Factory.define :rubygem do |rubygem|
+ rubygem.name { 'string' }
+ rubygem.token { 'string' }
+ rubygem.user_id { 1 }
+end
View
7 test/factories/version.rb
@@ -0,0 +1,7 @@
+Factory.define :version do |version|
+ version.authors { 'string' }
+ version.description { 'text' }
+ version.downloads { 1 }
+ version.number { 'string' }
+ version.rubygem_id { 1 }
+end
View
8 test/unit/dependency_test.rb
@@ -0,0 +1,8 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class DependencyTest < ActiveSupport::TestCase
+ should "be valid with factory" do
+ assert_valid Factory.build(:dependency)
+ end
+
+end
View
8 test/unit/rubygem_test.rb
@@ -0,0 +1,8 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class RubygemTest < ActiveSupport::TestCase
+ should "be valid with factory" do
+ assert_valid Factory.build(:rubygem)
+ end
+
+end
View
8 test/unit/version_test.rb
@@ -0,0 +1,8 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class VersionTest < ActiveSupport::TestCase
+ should "be valid with factory" do
+ assert_valid Factory.build(:version)
+ end
+
+end

0 comments on commit 5a31c5e

Please sign in to comment.