Commit a00c09a617c4c67d7c9f5fbba8f62e42253f709e
1 parent
93df8ac0
Exists in
colab
and in
4 other branches
Created Repository Attributes, joining Repository with User
Signed-off-by: Pedro Scocco <pedroscocco@gmail.com>
Showing
5 changed files
with
47 additions
and
1 deletions
Show diff stats
db/migrate/20150616164352_create_repository_attributes.rb
0 → 100644
db/schema.rb
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | # |
| 12 | 12 | # It's strongly recommended that you check this file into your version control system. |
| 13 | 13 | |
| 14 | -ActiveRecord::Schema.define(version: 20150515195059) do | |
| 14 | +ActiveRecord::Schema.define(version: 20150616164352) do | |
| 15 | 15 | |
| 16 | 16 | create_table "kalibro_configuration_attributes", force: :cascade do |t| |
| 17 | 17 | t.integer "user_id" |
| ... | ... | @@ -38,6 +38,15 @@ ActiveRecord::Schema.define(version: 20150515195059) do |
| 38 | 38 | t.boolean "public", default: true |
| 39 | 39 | end |
| 40 | 40 | |
| 41 | + create_table "repository_attributes", force: :cascade do |t| | |
| 42 | + t.integer "repository_id" | |
| 43 | + t.integer "user_id" | |
| 44 | + t.datetime "created_at", null: false | |
| 45 | + t.datetime "updated_at", null: false | |
| 46 | + end | |
| 47 | + | |
| 48 | + add_index "repository_attributes", ["user_id"], name: "index_repository_attributes_on_user_id" | |
| 49 | + | |
| 41 | 50 | create_table "users", force: :cascade do |t| |
| 42 | 51 | t.string "name", limit: 255, default: "", null: false |
| 43 | 52 | t.string "email", limit: 255, default: "", null: false | ... | ... |
| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | +require 'rails_helper' | |
| 2 | + | |
| 3 | +RSpec.describe RepositoryAttributes, type: :model do | |
| 4 | + context 'validations' do | |
| 5 | + it { is_expected.to validate_presence_of(:repository_id) } | |
| 6 | + it { is_expected.to validate_presence_of(:user) } | |
| 7 | + end | |
| 8 | + | |
| 9 | + describe 'associations' do | |
| 10 | + it { is_expected.to belong_to(:user) } | |
| 11 | + end | |
| 12 | +end | ... | ... |