Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/customers_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class CustomersController < ApplicationController
end
4 changes: 4 additions & 0 deletions app/models/customer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Customer < ApplicationRecord
has_many :movies

end
15 changes: 15 additions & 0 deletions db/migrate/20171106210919_create_customers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class CreateCustomers < ActiveRecord::Migration[5.1]
def change
create_table :customers do |t|
t.string :name
t.string :registered_at
t.string :address
t.string :city
t.string :state
t.string :postal_code
t.string :phone

t.timestamps
end
end
end
5 changes: 5 additions & 0 deletions db/migrate/20171106213051_add_acount_credit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddAcountCredit < ActiveRecord::Migration[5.1]
def change
add_column :customers, :account_credit, :float
end
end
15 changes: 14 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,22 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 0) do
ActiveRecord::Schema.define(version: 20171106213051) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "customers", force: :cascade do |t|
t.string "name"
t.string "registered_at"
t.string "address"
t.string "city"
t.string "state"
t.string "postal_code"
t.string "phone"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.float "account_credit"
end

end
7 changes: 7 additions & 0 deletions test/controllers/customers_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require "test_helper"

describe CustomersController do
# it "must be a real test" do
# flunk "Need real tests"
# end
end
19 changes: 19 additions & 0 deletions test/fixtures/customers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

# This model initially had no columns defined. If you add columns to the
# model remove the "{}" from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one:
name: Shelley Rocha
registered_at: Wed, 29 Apr 2015 07:54:14 -0700
address: Ap 292-5216 Ipsum Rd.
city: Hillsboro
state: OR,
postal_code: 24309
phone": (322) 510-8695
account_credit: 13.15
# column: value
#
# two: {}
# column: value
13 changes: 13 additions & 0 deletions test/models/customer_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require "test_helper"

describe Customer do
let(:customer) { Customer.new }

it "must be valid" do
value(customer).must_be :valid?
end

# at least one positive and one negative test case for each relation, validation, and custom function


end