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

Completed Media Ranker #29

Open
wants to merge 64 commits into
base: KED/master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
cda108c
create models
kedevlin Nov 30, 2015
4792c90
Create controllers
kedevlin Nov 30, 2015
c3d93d2
Add routes
kedevlin Nov 30, 2015
7febcc9
Create CRUD controller methods
kedevlin Nov 30, 2015
de26c24
Add movie index view and update controller method
kedevlin Nov 30, 2015
994b7cb
Fix movie index view, add book index view, update book index controller
kedevlin Nov 30, 2015
d4b318c
Add album index view and update index method in controller
kedevlin Nov 30, 2015
ecb205a
Create show views and update show method for all three controllers
kedevlin Nov 30, 2015
a790342
Create form and edit view files for all controllers, create form for …
kedevlin Nov 30, 2015
d5c74fd
Create form for movie and album
kedevlin Nov 30, 2015
3c9847e
Add redirect to update method of all 3 controllers
kedevlin Nov 30, 2015
a3aecd6
Create new views, add new button to index views
kedevlin Nov 30, 2015
14c38f3
Complete new and create methods for all three controllers
kedevlin Nov 30, 2015
1f3a49c
Complete destroy methods for all 3 controllers
kedevlin Nov 30, 2015
c94ac27
Create upvote method for movies
kedevlin Nov 30, 2015
6930d6b
Add upvote methods to books and albums
kedevlin Nov 30, 2015
01450e5
Create root route with list of 10 from each table
kedevlin Nov 30, 2015
02822b6
Order by rank on root page
kedevlin Nov 30, 2015
e360b69
order by ranked on show pages
kedevlin Nov 30, 2015
8fb8a13
Add links to index views on root view
kedevlin Dec 1, 2015
c89bcee
Add View All Media button to index pages
kedevlin Dec 1, 2015
b6d2764
Add Upvote button to index pages
kedevlin Dec 1, 2015
bc49cc2
Add links to index pages from show pages
kedevlin Dec 1, 2015
ad730c9
Add header, add validation to all 3 models
kedevlin Dec 1, 2015
80ac720
Add name validation for 3 models
kedevlin Dec 1, 2015
3cda762
Added before_action to all 3 controllers
kedevlin Dec 1, 2015
836d0af
Setup rspec and manually create files
kedevlin Dec 1, 2015
2a1b470
Add test to album spec
kedevlin Dec 1, 2015
78245b3
Add tests to movie and book specs
kedevlin Dec 1, 2015
a753812
Add GET index tests to controller specs
kedevlin Dec 1, 2015
f79af1e
Added album controller tests for GET new, POST create, and GET show
kedevlin Dec 1, 2015
77f0c52
add test for post create with bad params (album controller)
kedevlin Dec 1, 2015
cab896f
Add album controller tests for edit with good params
kedevlin Dec 1, 2015
1c0060f
complete album PATCH update tes
kedevlin Dec 1, 2015
392006d
Add album destroy test
kedevlin Dec 2, 2015
cfdf599
in albums test, defined album object via let before any of the class'…
kedevlin Dec 2, 2015
d23dd2b
Add book controller tests
kedevlin Dec 2, 2015
c46ed1a
Added controller tests for movie
kedevlin Dec 2, 2015
4ea084b
Add SimpleCov gem
kedevlin Dec 2, 2015
e79c849
Add bootstrap gem
kedevlin Dec 2, 2015
131373e
Style header
kedevlin Dec 2, 2015
c8c91a4
Add bootstrap styling to home page
kedevlin Dec 2, 2015
fcad9cb
Add bootstrap styling to movie index page
kedevlin Dec 2, 2015
464b1d4
Added some boostrap styling to movie show page
kedevlin Dec 3, 2015
ab3ec47
Style edit and new movie views with bootsrap
kedevlin Dec 3, 2015
e1c51e8
Finish styling movie show page with bootstrap
kedevlin Dec 3, 2015
6dee57c
Add bootstrap styling to all views of albums and books
kedevlin Dec 3, 2015
e833054
Add shared example for model specs
kedevlin Dec 3, 2015
0b63f4f
Add shared example test for 3 controllers for GET index
kedevlin Dec 3, 2015
79af199
Add shared examples for show and new tests
kedevlin Dec 3, 2015
25743dd
Add shared example test for POST create
kedevlin Dec 3, 2015
145af64
Add shared example GET edit
kedevlin Dec 3, 2015
8a0ba69
Add shared examples for PATCH update
kedevlin Dec 3, 2015
d102896
Add DELETE destroy shared example
kedevlin Dec 3, 2015
fac53c8
Add PATCH upvote shared tests
kedevlin Dec 3, 2015
eacd01e
Add partial for movie index view
kedevlin Dec 4, 2015
7c69b5b
Add reference to index partial in albums and movies index
kedevlin Dec 4, 2015
ae16f87
Added show partial and reference to it in movies show view
kedevlin Dec 4, 2015
fec3d5a
Add partials to books and albums show
kedevlin Dec 4, 2015
b88cc42
add partial for forms, reference in edit and new views and delete con…
kedevlin Dec 4, 2015
c7cf364
Add top list partial and reference it for each controller in welcome#…
kedevlin Dec 4, 2015
781903a
Add space in <title>
kedevlin Dec 4, 2015
85340db
setup factory girl
kedevlin Jan 13, 2016
54cb442
update rspec to include factories
kedevlin Jan 13, 2016
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
Add shared examples for PATCH update
  • Loading branch information
kedevlin committed Dec 3, 2015
commit 8a0ba69227e78105f081da159ae819ccf28ea781
33 changes: 2 additions & 31 deletions spec/controllers/albums_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -5,14 +5,14 @@
let(:model) { Album }
let (:good_params) do
{
album: { name: "Test Album", description: "Album's description", artist: "Album's artist"
album: { name: "zzzTest", description: "Album's description", artist: "Album's artist"
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think either this closing curly brace should be on the same line as album: { ... or the key/value pairs in the album sub-hash should be split out onto their own lines, to keep with the style of the containing hash.

}
end

let (:bad_params) do
{
album: { description: "Album's description", artist: "Album's artist"
album: { name: "", description: "Album's description", artist: "Album's artist"
}
}
end
@@ -23,35 +23,6 @@
# end


# describe "PATCH 'update'" do
# let (:good_params) do
# {
# id: album.id,
# album: { name: "zzzTest Album", description: "zzzzAlbum's description", artist: "zzzAlbum's artist"
# }
# }
# end
#
# let (:bad_params) do
# {
# id: album.id,
# album: { name: "", description: "Album's description", artist: "Album's artist"
# }
# }
# end
#
# it "redirects to show page" do
# patch :update, good_params
# expect(subject).to redirect_to album_path(album)
# expect(Album.find(album.id).name).to eq "zzzTest Album"
# end
#
# it "renders edit template on error" do
# patch :update, bad_params
# expect(subject).to render_template :edit
# expect(Album.find(album.id).name).to eq "Test Album"
# end
# end
#
# describe "DELETE 'destroy'" do
# it "redirects to index page" do
35 changes: 2 additions & 33 deletions spec/controllers/books_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -5,14 +5,14 @@
let(:model) { Book }
let (:good_params) do
{
book: { name: "Test Book", description: "Book's description", author: "Book's author"
book: { name: "zzzTest", description: "Book's description", author: "Book's author"
}
}
end

let (:bad_params) do
{
book: { description: "Book's description", author: "Book's author"
book: { name: "", description: "Book's description", author: "Book's author"
}
}
end
@@ -22,37 +22,6 @@
# Book.create(name: "Test Book", description: "Book's description", author: "Book's author")
# end



# describe "PATCH 'update'" do
# let (:good_params) do
# {
# id: book.id,
# book: { name: "zzzTest Book", description: "zzzzBook's description", author: "zzzBook's author"
# }
# }
# end
#
# let (:bad_params) do
# {
# id: book.id,
# book: { name: "", description: "Book's description", author: "Book's author"
# }
# }
# end
#
# it "redirects to show page" do
# patch :update, good_params
# expect(subject).to redirect_to book_path(book)
# expect(Book.find(book.id).name).to eq "zzzTest Book"
# end
#
# it "renders edit template on error" do
# patch :update, bad_params
# expect(subject).to render_template :edit
# expect(Book.find(book.id).name).to eq "Test Book"
# end
# end
#
# describe "DELETE 'destroy'" do
# it "redirects to index page" do
34 changes: 2 additions & 32 deletions spec/controllers/movies_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -5,14 +5,14 @@
let(:model) { Movie }
let (:good_params) do
{
movie: { name: "Test Movie", description: "Movie's description", director: "Movie's director"
movie: { name: "zzzTest", description: "Movie's description", director: "Movie's director"
}
}
end

let (:bad_params) do
{
movie: { description: "Movie's description", director: "Movie's director"
movie: { name: "", description: "Movie's description", director: "Movie's director"
}
}
end
@@ -22,36 +22,6 @@
# Movie.create(name: "Test Movie", description: "Movie's description", director: "Movie's director")
# end


# describe "PATCH 'update'" do
# let (:good_params) do
# {
# id: movie.id,
# movie: { name: "zzzTest Movie", description: "zzzzMovie's description", director: "zzzMovie's director"
# }
# }
# end
#
# let (:bad_params) do
# {
# id: movie.id,
# movie: { name: "", description: "Movie's description", director: "Movie's director"
# }
# }
# end
#
# it "redirects to show page" do
# patch :update, good_params
# expect(subject).to redirect_to movie_path(movie)
# expect(Movie.find(movie.id).name).to eq "zzzTest Movie"
# end
#
# it "renders edit template on error" do
# patch :update, bad_params
# expect(subject).to render_template :edit
# expect(Movie.find(movie.id).name).to eq "Test Movie"
# end
# end
#
# describe "DELETE 'destroy'" do
# it "redirects to index page" do
18 changes: 18 additions & 0 deletions spec/support/medium_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -42,4 +42,22 @@
end
end

describe "PATCH 'update'" do
let (:medium) do
model.create(name: "Test")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're using this model.create code in a bunch of test, it makes sense to put it into a let statement as we have done here.
However I think if we moved this let so that it was nested directly under the shared_examples line at the beginning of this file, then the medium variable would be available to all of the tests.

end

it "redirects to show page" do
patch :update, good_params.merge({id: medium.id})
expect(subject).to redirect_to polymorphic_path(medium)
expect(model.all.last.name).to eq "zzzTest"
end

it "renders edit template on error" do
patch :update, bad_params.merge({id: medium.id})
expect(subject).to render_template :edit
expect(model.all.last.name).to eq "Test"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good that we're testing the actual changes resulting (or not) from calling patch :update, but we should probably split this (and line 53 above) out into separate tests.

end
end

end