fix channel video_id validation when updating

This commit is contained in:
Lee Lawlor
2015-02-13 11:07:18 -05:00
parent 167f1ea6ae
commit c0bc92b7e2
4 changed files with 12 additions and 3 deletions

View File

@ -26,12 +26,20 @@ describe ChannelsController do
channel.windows.where(window_type: 'chart').count.should eq(2)
end
it 'should not allow channel to be updated with invalid parameters' do
@channel.update_attributes({video_type: nil, video_id: nil})
put :update, id: @channel, channel: {video_id: 'invalid_id'}
flash[:alert].should match /#{I18n.t(:channel_video_type_blank)}/
end
it "should allow a channel to be edited" do
@channel.public_flag = true
put :update, id: @channel, channel: {name: 'new name'}, tags: FactoryGirl.attributes_for(:tag)
@channel.reload
@channel.name.should eq('new name')
response.should redirect_to channel_path(@channel.id)
flash[:notice].should eq(I18n.t(:channel_update_success))
end
it "should allow a channel to be deleted " do