Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brenna & Alison's VideoStore API #10

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e498c78
set up rails API
bcmdarroch May 9, 2017
4681742
started pseudocode
bcmdarroch May 9, 2017
32f7b22
pseudocoded routes
bcmdarroch May 9, 2017
7d6ccdf
set up models, controllers and routes
AlisonZ May 9, 2017
67abd17
seeded db
bcmdarroch May 9, 2017
fe61127
wrote some customer tests
bcmdarroch May 9, 2017
62714fd
made rental model
bcmdarroch May 9, 2017
4e45454
added new relationships
AlisonZ May 9, 2017
142dca1
initial test for customer
AlisonZ May 9, 2017
85c53d3
customer tests all passing
AlisonZ May 9, 2017
a25b25d
wrote movie tests, mostly passing
bcmdarroch May 9, 2017
6a46eca
almost finished customer and movie model testing, one bug to fix
AlisonZ May 9, 2017
7b56aa5
customer and movie tests all passing :)))
bcmdarroch May 10, 2017
16fe702
added coverage to gitignore
bcmdarroch May 10, 2017
7b2fa50
rentals tests. all broken
AlisonZ May 10, 2017
058a2c0
fixed rental tests
bcmdarroch May 10, 2017
a4964fd
made some controllers and the basic controller methods for movies and…
AlisonZ May 10, 2017
29c6247
wave 2 finished
AlisonZ May 10, 2017
85ca5e4
smoke test passes all tests, customer controller tests finished
AlisonZ May 10, 2017
e8e3423
most movie controller tests passing
bcmdarroch May 10, 2017
a52c485
deleted all coverage
bcmdarroch May 11, 2017
9a6aeef
movie controller passes all tests
bcmdarroch May 11, 2017
8851b84
added controller index test
bcmdarroch May 11, 2017
068c8b2
date time working
AlisonZ May 11, 2017
d5f2688
cleaned up movie test a lil
bcmdarroch May 11, 2017
29b40b4
customer controller tests done
AlisonZ May 11, 2017
f5e9fdf
Merge branch 'master' of https://github.com/bcmdarroch/VideoStoreAPI
AlisonZ May 11, 2017
bb24f80
start rentals controller
bcmdarroch May 11, 2017
4c57001
got rentals checkout working
bcmdarroch May 12, 2017
43ec255
checkin method
AlisonZ May 12, 2017
b236630
got checkout and checkin working, tested in postman
bcmdarroch May 12, 2017
4b152bc
rental model tests pass, fixed rental checkout and due date tests
AlisonZ May 12, 2017
d38104c
rental controller test stubs
bcmdarroch May 12, 2017
ad9d18f
fixed minor merge conflict
AlisonZ May 12, 2017
7c1152b
starting writing the rental controller tests
AlisonZ May 12, 2017
fa25392
rental controller returning json test working
AlisonZ May 12, 2017
a469ac3
wrote checkout tests
bcmdarroch May 12, 2017
05eae3e
finished testing for checkin controller
AlisonZ May 12, 2017
5dcb1a8
patch to put in rentals route
bcmdarroch May 12, 2017
cc46b70
Merge branch 'master' of https://github.com/bcmdarroch/VideoStoreAPI
bcmdarroch May 12, 2017
62f1076
wrote overdue controller method and model methods
bcmdarroch May 12, 2017
aefcf17
tested overdue in postman, works :))))
bcmdarroch May 12, 2017
c2589ea
finished rental controller tests except for one at the end
bcmdarroch May 12, 2017
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
Prev Previous commit
Next Next commit
rentals tests. all broken
AlisonZ committed May 10, 2017
commit 7b2fa5078c60cb414d544294f29ca857f9935f90
2 changes: 1 addition & 1 deletion coverage/.last_run.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"result": {
"covered_percent": 100.0
"covered_percent": 95.0
}
}
179 changes: 174 additions & 5 deletions coverage/.resultset.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,208 @@
{
"MiniTest": {
"coverage": {
"/Users/brenna/ada/week14/VideoStoreAPI/app/models/movie.rb": [
"/Users/alisonzerbe/Ada/APIs/VideoStoreAPI/app/models/customer.rb": [
1,
1,
1,
null,
1,
1,
1,
null
],
"/Users/alisonzerbe/Ada/APIs/VideoStoreAPI/app/models/application_record.rb": [
1,
1,
null
],
"/Users/brenna/ada/week14/VideoStoreAPI/app/models/application_record.rb": [
"/Users/alisonzerbe/Ada/APIs/VideoStoreAPI/test/models/movie_test.rb": [
1,
null,
1,
9,
null,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
null,
null,
1,
null,
1,
0,
0,
null,
null,
null,
1,
1,
1,
null,
null,
1,
null,
1,
0,
0,
null,
null,
null,
1,
1,
1,
null,
null
],
"/Users/brenna/ada/week14/VideoStoreAPI/app/models/customer.rb": [
"/Users/alisonzerbe/Ada/APIs/VideoStoreAPI/app/models/movie.rb": [
1,
1,
1,
null,
1,
1,
1,
1,
null
],
"/Users/alisonzerbe/Ada/APIs/VideoStoreAPI/test/models/rental_test.rb": [
1,
null,
1,
5,
null,
null,
1,
1,
0,
null,
null,
1,
1,
0,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
1,
1,
1,
1,
null,
null,
null
],
"/Users/brenna/ada/week14/VideoStoreAPI/app/models/rental.rb": [
"/Users/alisonzerbe/Ada/APIs/VideoStoreAPI/app/models/rental.rb": [
1,
1,
1,
null
]
},
"timestamp": 1494439168
"timestamp": 1494446684
}
}
1,078 changes: 1,062 additions & 16 deletions coverage/index.html

Large diffs are not rendered by default.

45 changes: 44 additions & 1 deletion test/models/rental_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
require "test_helper"

describe Rental do

let(:rental) { rentals(:one) }


it "has a customer associated with it" do
rental.customer.must_be_instance_of Customer
rental.customer must_equal 'brenna'
end

it "has a movie associated with it" do
rental.movie.must_be_instance_of Movie
rental.movie.must_equal 'strange'
end

it "is valid object with checkout_date, due_date, customer and movie" do
rental.valid? true
rental.checkout_date.must_equal '2017-05-02'
rental.due_date.must_equal '2017-05-09'
end

it "is invalid without a due_date" do
rental = Rental.create(customer_id: customers(:alison), movie_id: movies(:strange), checkout_date: "2015-05-10")
rental.valid? false
rental.errors.messages.must_include :due_date

end

it "is invalid without a checkout_date" do
rental = Rental.create(customer_id: customers(:alison), movie_id: movies(:strange), due_date: "2015-05-10")
rental.valid? false
rental.errors.messages.must_include :checkout_date
end

it "has a due_date that is one week from the checkout_date" do
due_date = Date.parse(rental.due_date)
checkout_date = Date.parse(rental.checkout_date)
due_date[:mday].must_equal checkout_date[:mday] + 7
end

it "is invalid if the due_date is not one week from the checkout_date" do
rental = Rental.create(customer_id: customers(:alison), movie_id: movies(:strange), due_date: "2015-05-10", checkout_date: "2015-05-1")
rental.valid? false
rental.errors.messages.must_include :due_date
end

end