Retaining specs and line from robustdj's patch
This commit is contained in:
parent
a3ce5f1cd7
commit
bbd8cadc14
2 changed files with 15 additions and 1 deletions
|
|
@ -101,6 +101,7 @@ en:
|
|||
new_album: "New Album"
|
||||
create:
|
||||
success: "You've created an album called %{name}."
|
||||
failure: "Failed to create album."
|
||||
update:
|
||||
success: "Album %{name} successfully edited."
|
||||
failure: "Failed to edit album %{name}."
|
||||
|
|
|
|||
|
|
@ -22,6 +22,19 @@ describe AlbumsController do
|
|||
params = {"album" => {"name" => "Sunsets","to" => @aspect.id.to_s}}
|
||||
post :create, params
|
||||
end
|
||||
|
||||
context 'with invalid params' do
|
||||
it 'should render a flash error message when album name is blank' do
|
||||
params = {"album" => {"name" => "", "to" => "all"}}
|
||||
post :create, params
|
||||
flash[:error].should == "Failed to create album."
|
||||
end
|
||||
it 'should redirect back to album page for that given aspect' do
|
||||
params = {"album" => {"name" => "", "to" => "all"}}
|
||||
post :create, params
|
||||
response.should redirect_to albums_path(:aspect => "all")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#update" do
|
||||
|
|
@ -29,7 +42,7 @@ describe AlbumsController do
|
|||
put :update, :id => @album.id, :album => { :name => "new_name"}
|
||||
@album.reload.name.should eql("new_name")
|
||||
end
|
||||
|
||||
|
||||
it "doesn't overwrite random attributes" do
|
||||
new_user = make_user
|
||||
params = {:name => "Bruisers", :person_id => new_user.person.id}
|
||||
|
|
|
|||
Loading…
Reference in a new issue