Guest User

Untitled

a guest
Feb 18th, 2018
649
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. diff --git a/Gemfile b/Gemfile
  2. index 6c38390..e1f7d82 100644
  3. --- a/Gemfile
  4. +++ b/Gemfile
  5. @@ -28,6 +28,6 @@ gem 'sqlite3'
  6. # Bundle gems for the local environment. Make sure to
  7. # put test-only gems in this group so their generators
  8. # and rake tasks are available in development mode:
  9. -# group :development, :test do
  10. -# gem 'webrat'
  11. -# end
  12. +group :development, :test do
  13. + gem 'awesome_print', :require => 'ap'
  14. +end
  15. diff --git a/Gemfile.lock b/Gemfile.lock
  16. index 37fc417..b881d98 100644
  17. --- a/Gemfile.lock
  18. +++ b/Gemfile.lock
  19. @@ -29,6 +29,7 @@ GEM
  20. activesupport (= 3.0.9)
  21. activesupport (3.0.9)
  22. arel (2.0.10)
  23. + awesome_print (0.4.0)
  24. builder (2.1.2)
  25. crack (0.1.8)
  26. erubis (2.6.6)
  27. @@ -77,6 +78,7 @@ PLATFORMS
  28. ruby
  29.  
  30. DEPENDENCIES
  31. + awesome_print
  32. meta-spotify
  33. rails (= 3.0.9)
  34. sqlite3
  35. diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb
  36. index 56f0d30..1c86997 100644
  37. --- a/app/controllers/albums_controller.rb
  38. +++ b/app/controllers/albums_controller.rb
  39. @@ -8,10 +8,9 @@
  40. def show
  41. @album = Album.find(params[:id])
  42.  
  43. - @spotify = MetaSpotify::Album.lookup(@album.spotify_uri, :extras => "track")
  44. -
  45. - @tracks = @spotify.tracks
  46. + @spotify = MetaSpotify::Album.lookup("spotify:album:2A0S2YIT08e4k52C4I8yfL", :extras => "track")
  47.  
  48. + @tracks = @spotify.tracks.to_a
  49. end
  50.  
  51. # GET /albums/new
  52. @@ -36,7 +35,6 @@
  53. :artist => @spotify_album.artists.first.name,
  54. :released => @spotify_album.released,
  55. :spotify_uri => @spotify_uri
  56. -
  57. )
  58.  
  59. if @album.save
  60. diff --git a/app/views/albums/show.html.erb b/app/views/albums/show.html.erb
  61. index a0308d7..46ae305 100644
  62. --- a/app/views/albums/show.html.erb
  63. +++ b/app/views/albums/show.html.erb
  64. @@ -19,8 +19,9 @@
  65. <a href="<%= @album.spotify_uri %>">Afspil</a>
  66. </p>
  67.  
  68. +
  69. <% @tracks.each do |track| %>
  70. - <%= @track %><br /><br />
  71. + <%= track.name %></br>
  72. <% end %>
  73.  
  74. <%= link_to 'Edit', edit_album_path(@album) %> |
  75. diff --git a/test/functional/albums_controller_test.rb b/test/functional/albums_controller_test.rb
  76. index d236cdc..591fea6 100644
  77. --- a/test/functional/albums_controller_test.rb
  78. +++ b/test/functional/albums_controller_test.rb
  79. @@ -2,7 +2,7 @@ require 'test_helper'
  80.  
  81. class AlbumsControllerTest < ActionController::TestCase
  82. setup do
  83. - @album = albums(:one)
  84. + @album = Album.create(:spotify_uri => "spotify:album:2A0S2YIT08e4k52C4I8yfL")
  85. end
  86.  
  87. test "should get index" do
  88. @@ -26,6 +26,9 @@ class AlbumsControllerTest < ActionController::TestCase
  89.  
  90. test "should show album" do
  91. get :show, :id => @album.to_param
  92. +
  93. + tracks = assigns(:tracks)
  94. + ap tracks.first.name
  95. assert_response :success
  96. end
Add Comment
Please, Sign In to add comment