public
Fork of sudara/alonetone
Description: alonetone - a damn fine musician's home. Upload mp3s, create playlists, track listens, get your widget on. (looking for dev help!)
Homepage: http://alonetone.com
Clone URL: git://github.com/taansen/alonetone.git
fix fixtures for playlists and specs for assets/playlists
sudara (author)
Mon Mar 17 09:04:30 -0700 2008
commit  f606d65e61011c86ae327775f8714677492bd11f
tree    f04802f257df25c657ba81197af0aa10bf45cbab
parent  13eb00a3ff4df6f146d5144c15d1802b3b7df47d
...
150
151
152
153
154
 
 
155
156
157
158
 
159
160
161
...
150
151
152
 
 
153
154
155
156
157
 
158
159
160
161
0
@@ -150,12 +150,12 @@ class PlaylistsController < ApplicationController
0
   end
0
   
0
   def find_playlists
0
- @playlist = @user.playlists.find_by_permalink(params[:permalink] || params[:id], :include =>[:tracks => :asset])
0
- @playlist = @user.playlists.find(params[:id], :include =>[:tracks => :asset]) if !@playlist && params[:id]
0
+ @playlist = @user.playlists.find_by_permalink(params[:permalink] || params[:id])
0
+ @playlist = @user.playlists.find(params[:id]) if !@playlist && params[:id]
0
   end
0
   
0
   def find_tracks
0
- @tracks = @playlist.tracks.find(:all, :order => :position, :include => :asset)
0
+ @tracks = @playlist.tracks.find(:all, :order => :position)
0
   end
0
   
0
 end
...
20
21
22
23
 
24
25
26
...
20
21
22
 
23
24
25
26
0
@@ -20,7 +20,7 @@ class Playlist < ActiveRecord::Base
0
   belongs_to :user, :counter_cache => true
0
   
0
   has_one :pic, :as => :picable, :dependent => :destroy
0
- has_many :tracks, :dependent => :destroy, :order => :position
0
+ has_many :tracks, :include => [:asset => :user], :dependent => :destroy, :order => :position
0
   has_many :assets, :through => :tracks #, :after_add =>
0
   
0
   validates_presence_of :title
...
2
3
4
5
6
7
8
9
10
11
12
13
...
2
3
4
 
 
 
 
 
 
5
6
7
0
@@ -2,12 +2,6 @@ require File.dirname(__FILE__) + '/../spec_helper'
0
 
0
 describe AssetsController do
0
   fixtures :assets, :users
0
-
0
- it 'should provide rss for flash player' do
0
- request.env["HTTP_ACCEPT"] = "application/rss+xml"
0
- get :show, :id => 'song1', :login => users(:sudara).login, :format => 'rss'
0
- response.should be_success
0
- end
0
   
0
   it 'should accept a mp3 extension and redirect to the amazon url' do
0
     request.env["HTTP_ACCEPT"] = "audio/mpeg"
...
1
2
3
4
 
 
5
6
7
8
9
 
 
10
11
12
13
14
 
 
15
16
17
18
19
20
 
 
21
22
23
24
25
 
 
26
27
28
29
30
 
 
31
32
...
1
2
 
 
3
4
5
6
7
 
 
8
9
10
11
12
 
 
13
14
15
 
16
17
 
 
18
19
20
21
22
 
 
23
24
25
26
27
 
 
28
29
30
31
0
@@ -1,31 +1,30 @@
0
 owp1:
0
   id: 1
0
- playlist: owp
0
- asset: valid_mp3
0
+ playlist_id: 1
0
+ asset_id: 1
0
   position: 1
0
 owp2:
0
   id: 2
0
- playlist: owp
0
- asset: valid_mp3
0
+ playlist_id: 1
0
+ asset_id: 1
0
   position: 2
0
 owp3:
0
   id: 3
0
- playlist: owp
0
- asset: valid_mp3
0
+ playlist_id: 1
0
+ asset_id: 1
0
   position: 3
0
-
0
 mix1:
0
   id: 4
0
- playlist: mix
0
- asset: valid_mp3
0
+ playlist_id: 4
0
+ asset_id: 1
0
   position: 1
0
 mix2:
0
   id: 5
0
- playlist: mix
0
- asset: valid_mp3
0
+ playlist_id: 4
0
+ asset_id: 1
0
   position: 2
0
 mix3:
0
   id: 6
0
- playlist: mix
0
- asset: valid_mp3
0
+ playlist_id: 4
0
+ asset_id: 4
0
   position: 3
0
\ No newline at end of file
...
24
25
26
27
 
28
29
30
...
33
34
35
 
 
 
 
 
36
37
...
24
25
26
 
27
28
29
30
...
33
34
35
36
37
38
39
40
41
42
0
@@ -24,7 +24,7 @@ describe Playlist do
0
   end
0
   
0
   it "should update a-ok" do
0
- @playlist = playlists(:mix)
0
+ @playlist = playlists(:mix)
0
     @playlist.save.should == true
0
   end
0
   
0
@@ -33,5 +33,10 @@ describe Playlist do
0
     @playlist.save
0
     @playlist.is_mix?.should == true
0
   end
0
+
0
+ it "should deliver its tracks in order of the position" do
0
+ playlists(:owp).tracks.first.position.should == 1
0
+ playlists(:owp).tracks[1].position.should == 2
0
+ end
0
   
0
 end

Comments

    No one has commented yet.