diff --git a/README.md b/README.md index cadceb2c096d2728fc2e3c79c756b59741a1aee0..89ea0ae194a7ee5d64ba9467ef6257efad319713 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ ## Commit Guidlines You are welcome to contribute, add and extend Diaspora however you see fit. We will do our best to incorporate everything that meets our guidelines. +We need you to fill out a [contributor agreement form](https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq) before we can accept your patches. The agreement gives Diaspora joint ownership of the patch so the copyright isn't scattered. You can find it [here](https://spreadsheets.google.com/a/joindiaspora.com/viewform?formkey=dGI2cHA3ZnNHLTJvbm10LUhXRTJjR0E6MQ&theme=0AX42CRMsmRFbUy1iOGYwN2U2Mi1hNWU0LTRlNjEtYWMyOC1lZmU4ODg1ODc1ODI&ifq). + All commits must be tested, and after each commit, all tests should be green before a pull request is sent. Please write your tests in Rspec or Test-Unit. GEMS: We would like to keep external dependencies unduplicated. We're using Nokogiri, and Mongomapper, and EM::HttpRequest as much as possible. We have a few gems in the project we'd rather not use, but if you can, use dependencies we already have. diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index 5a75616d1e5f88f43a2146fb2c089665c9842a6a..c4bab3d8a2ed0bf28cafe5660e34f6926cc109b0 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -46,7 +46,7 @@ class AlbumsController < ApplicationController end def update - @album = Album.find_params_by_id params[:id] + @album = Album.find_by_id params[:id] if @album.update_attributes params[:album] flash[:notice] = "Album #{@album.name} successfully edited." respond_with @album diff --git a/spec/controllers/albums_controller_spec.rb b/spec/controllers/albums_controller_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..ce2bd305df7a6711fd321318feefe32ee7356703 --- /dev/null +++ b/spec/controllers/albums_controller_spec.rb @@ -0,0 +1,23 @@ +# Copyright (c) 2010, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3. See +# the COPYRIGHT file. + + +require File.dirname(__FILE__) + '/../spec_helper' +include ApplicationHelper +describe AlbumsController do + render_views + before do + @user = Factory.create(:user) + @user.aspect(:name => "lame-os") + @album = Factory.create(:album) + sign_in :user, @user + end + + it "should update the name of an album" do + sign_in :user, @user + put :update, :id => @album._id, :album => { :name => "new_name"} + @album.reload.name.should eql("new_name") + end + +end diff --git a/spec/factories.rb b/spec/factories.rb index 918a210f2219346aee585d4e4e600131955d560a..4c59631d8b515c185cf0a521efaae125d956ee0e 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -22,6 +22,11 @@ Factory.define :person do |p| p.serialized_key OpenSSL::PKey::RSA.generate(1024).public_key.export end +Factory.define :album do |p| + p.name "my first album" + p.person { |a| Factory.create(:person) } +end + Factory.define :person_with_private_key, :parent => :person do |p| p.serialized_key OpenSSL::PKey::RSA.generate(1024).export end