Welcome to mirror list, hosted at ThFree Co, Russian Federation.

albums_controller_spec.rb « controllers « spec - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8bfcf61e5d33be564a8cc98446c9e43b0ac535e0 (plain)
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
33
34
35
36
37
38
39
40
41
#   Copyright (c) 2010, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

require 'spec_helper'

describe AlbumsController do
 render_views
  before do
    @user = Factory.create(:user)
    @aspect = @user.aspect(:name => "lame-os")
    @album = @user.post :album, :to => @aspect.id, :name => 'things on fire'
    sign_in :user, @user
  end

  describe '#create' do
    it 'all aspects' do
      params = {"album" => {"name" => "Sunsets","to" => "all"}}
      post :create, params
    end
    it 'one aspect' do
      params = {"album" => {"name" => "Sunsets","to" => @aspect.id.to_s}}
      post :create, params
    end
  end

  describe "#update" do
    it "should update the name of an album" 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 = Factory.create :user
      params = {:name => "Bruisers", :person_id => new_user.person.id}
      put('update', :id => @album.id, "album" => params)
      @album.reload.person_id.should == @user.person.id
      @album.name.should == 'Bruisers'
    end
  end
end