refactor channel rankings
This commit is contained in:
		@@ -135,6 +135,7 @@ describe ChannelsController do
 | 
			
		||||
      end
 | 
			
		||||
      it 'returns JSON' do
 | 
			
		||||
        post :create, {:key => @user.api_key, :name => 'mychannel', :format => 'json'}
 | 
			
		||||
        Channel.last.ranking.should_not be_blank
 | 
			
		||||
        JSON.parse(response.body)['name'].should eq("mychannel")
 | 
			
		||||
      end
 | 
			
		||||
      it 'returns XML' do
 | 
			
		||||
@@ -154,6 +155,7 @@ describe ChannelsController do
 | 
			
		||||
      end
 | 
			
		||||
      it 'returns JSON' do
 | 
			
		||||
        post :update, {:id => @channel.id, :key => @user.api_key, :name => 'newname', :format => 'json'}
 | 
			
		||||
        Channel.last.ranking.should_not be_blank
 | 
			
		||||
        JSON.parse(response.body)['name'].should eq("newname")
 | 
			
		||||
      end
 | 
			
		||||
      it 'returns XML' do
 | 
			
		||||
 
 | 
			
		||||
@@ -59,6 +59,13 @@ describe Channel do
 | 
			
		||||
    channel.should be_valid
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "should set ranking correctly" do
 | 
			
		||||
    channel = Channel.create
 | 
			
		||||
    channel.set_ranking.should eq(15)
 | 
			
		||||
    channel.description = "foo"
 | 
			
		||||
    channel.set_ranking.should eq(35)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it "should accept utf8" do
 | 
			
		||||
    channel = Channel.create(:name => "ǎ")
 | 
			
		||||
    channel.reload
 | 
			
		||||
@@ -128,3 +135,4 @@ describe Channel do
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user