[refs #442] Merge master into 442-mass_build

This commit is contained in:
konstantin.grabar 2012-06-29 16:40:54 +04:00
commit 6507ad280f
25 changed files with 313 additions and 94 deletions

View File

@ -11,14 +11,13 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
before_filter :find_product_build_list, :only => [:status_build]
def create
@product.product_build_lists.create! :base_url => "http://#{request.host_with_port}", :notified_at => Time.current
@product.product_build_lists.create! :base_url => "http://#{request.host_with_port}"
flash[:notice] = t('flash.product.build_started')
redirect_to [@platform, @product]
end
def status_build
@product_build_list.status = params[:status].to_i # ProductBuildList::BUILD_COMPLETED : ProductBuildList::BUILD_FAILED)
@product_build_list.notified_at = Time.current
@product_build_list.save!
render :nothing => true
end
@ -46,7 +45,8 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
end
def authenticate_product_builder!
unless APP_CONFIG['product_builder_ip'].values.include?(request.remote_ip)
# FIXME: Rails(?) interpret the internal IP as 127.0.0.1
unless (APP_CONFIG['product_builder_ip'].values + ["127.0.0.1"]).include?(request.remote_ip)
render :nothing => true, :status => 403
end
end

View File

@ -148,21 +148,16 @@ class Ability
relations.actor_type = 'Group' AND relations.actor_id IN (?)))", parent.classify, @user, @user.group_ids]
end
def relation_exists_for(target, roles)
target.relations.exists?(:actor_id => @user.id, :actor_type => 'User', :role => roles) or
target.relations.exists?(:actor_id => @user.group_ids, :actor_type => 'Group', :role => roles)
end
def local_reader?(target)
relation_exists_for(target, %w{reader writer admin}) or owner?(target)
%w{reader writer admin}.include? @user.best_role(target)
end
def local_writer?(target)
relation_exists_for(target, %w{writer admin}) or owner?(target)
%w{writer admin}.include? @user.best_role(target)
end
def local_admin?(target)
relation_exists_for(target, 'admin') or owner?(target)
@user.best_role(target) == 'admin'
end
def owner?(target)

View File

@ -103,11 +103,16 @@ class BuildList < ActiveRecord::Base
state_machine :status, :initial => :waiting_for_response do
around_transition do |build_list, transition, block|
if build_list.mass_build
MassBuild.decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id if MassBuild::COUNT_STATUSES.include?(build_list.status)
block.call
MassBuild.increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id if MassBuild::COUNT_STATUSES.include?(build_list.status)
# WTF? around_transition -> infinite loop
before_transition do |build_list, transition|
if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(build_list.status)
MassBuild.decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
end
end
after_transition do |build_list, transition|
if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(build_list.status)
MassBuild.increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
end
end
@ -180,6 +185,8 @@ class BuildList < ActiveRecord::Base
def set_version_and_tag
pkg = self.packages.where(:package_type => 'source', :project_id => self.project_id).first
# TODO: remove 'return' after deployment ABF kernel 2.0
return if pkg.nil? # For old client that does not sends data about packages
self.package_version = "#{pkg.platform.name}-#{pkg.version}-#{pkg.release}"
system("cd #{self.project.git_repository.path} && git tag #{self.package_version} #{self.commit_hash}") # TODO REDO through grit
save
@ -187,7 +194,7 @@ class BuildList < ActiveRecord::Base
#TODO: Share this checking on product owner.
def can_cancel?
[BUILD_PENDING, BuildServer::PLATFORM_PENDING].include? status && bs_id
[BUILD_PENDING, BuildServer::PLATFORM_PENDING].include?(status) && bs_id
end
def can_publish?

View File

@ -20,11 +20,11 @@ class ProductBuildList < ActiveRecord::Base
validates :status, :inclusion => { :in => [BUILD_STARTED, BUILD_COMPLETED, BUILD_FAILED] }
attr_accessor :base_url
attr_accessible :status, :notified_at, :base_url
attr_accessible :status, :base_url
attr_readonly :product_id
scope :default_order, order('notified_at DESC')
scope :default_order, order('updated_at DESC')
scope :for_status, lambda {|status| where(:status => status) }
scope :for_user, lambda { |user| where(:user_id => user.id) }
scope :scoped_to_product_name, lambda {|product_name| joins(:product).where('products.name LIKE ?', "%#{product_name}%")}

View File

@ -129,4 +129,28 @@ class User < ActiveRecord::Base
false
end
end
def best_role target
roles = target_roles(target)
return nil if roles.count == 0
%w(admin writer reader).each {|role| return role if roles.include?(role)}
raise "unknown user #{self.uname} roles #{roles}"
end
protected
def target_roles target
rel, gr, roles = target.relations, self.groups, []
if target.owner.class == Group
owner_group = self.groups.where(:id => target.owner.id).first
roles += owner_group.actors.where(:actor_id => self) if owner_group# user group is owner
gr = gr.where('groups.id != ?', target.owner.id) # exclude target owner group from users group list
end
roles += rel.where(:actor_id => self.id, :actor_type => 'User') # user is member
roles += rel.where(:actor_id => gr, :actor_type => 'Group') # user group is member
roles.map(&:role).uniq
end
end

View File

@ -3,6 +3,5 @@
%td= product_build_list.human_status
%td= link_to nil, product_build_list.container_path
%td= link_to product_build_list.product.name, platform_product_path(product_build_list.product.platform, product_build_list.product)
-#%td= link_to product_build_list.user.try(:fullname), product_build_list.user
%td= link_to image_tag('x.png'), platform_product_product_build_list_path(product_build_list.product.platform, product_build_list.product, product_build_list), :method => :delete, :confirm => t("layout.confirm") if can? :destroy, product_build_list
%td= l(product_build_list.notified_at, :format => :long)
%td= l(product_build_list.updated_at, :format => :long)

View File

@ -6,7 +6,6 @@
%th.lpadding16= t("activerecord.attributes.product_build_list.status")
%th.lpadding16= t("activerecord.attributes.product_build_list.container_path")
%th.lpadding16= t("activerecord.attributes.product_build_list.product")
-#%th.lpadding16= t("activerecord.attributes.product_build_list.user")
%th= t("layout.product_build_lists.action")
%th.lpadding16= t("activerecord.attributes.product_build_list.notified_at")
%tbody= render :partial => 'platforms/product_build_lists/product_build_list', :collection => @product_build_lists

View File

@ -6,5 +6,5 @@
%td= link_to build_list.project_version, "#"
%td= build_list.arch.name
%td= link_to build_list.user.try(:fullname), build_list.user
%td= link_to image_tag('x.png', :class => 'delete-row', :id => "delete-row#{build_list_counter}"), cancel_build_list_path(build_list), :method => :put, :confirm => t('layout.confirm') if build_list.can_cancel? and can?(:cancel, build_list)
%td= link_to image_tag('x.png', :class => 'delete-row', :id => "delete-row#{build_list_counter}"), cancel_build_list_path(build_list), :method => :put, :confirm => t('layout.confirm') if can?(:cancel, build_list)
%td= build_list.updated_at

View File

@ -11,7 +11,7 @@
%td
- c = participant_class(alone_member, project)
%span{:class => c, :title => t("layout.relations.#{c}")}
= t("layout.collaborators.role_names.#{project.relations.by_user_through_groups(current_user).first.role}")
= t("layout.collaborators.role_names.#{current_user.best_role project}")
%td.td5
- unless project.owner == current_user or !alone_member
= link_to remove_user_project_path(project), :method => :delete, :confirm => t("layout.confirm") do

View File

@ -5,7 +5,7 @@ json.project do |proj|
proj.description project.description
proj.link project_path(project)
proj.role t("layout.collaborators.role_names.#{project.relations.by_user_through_groups(current_user).first.role}").force_encoding(Encoding::UTF_8)
proj.role t("layout.collaborators.role_names.#{current_user.best_role project}").force_encoding(Encoding::UTF_8)
proj.leave_link remove_user_project_path(project) unless project.owner == current_user or !alone_member? project
proj.rights_class participant_class(alone_member?(project), project)

View File

@ -10,7 +10,7 @@ en:
'2': 'build in progress'
build_failed: Build failed
build_started: Build in progress
build_completed: Build
build_completed: Builded
ownership:
header: Build list ownership

View File

@ -3,5 +3,5 @@ ru:
relations:
user_owner: Я - владелец
group_owner: Я состою в группе-владельце
user: Я участник
user: Я - участник
group: Я состою в группе-участнике

View File

@ -75,6 +75,7 @@ Rosa::Application.routes.draw do
match '/private/:platform_name/*file_path' => 'privates#show'
resources :product_build_lists, :only => [:index]
match 'product_status', :to => 'product_build_lists#status_build'
end
scope :module => 'users' do
@ -118,7 +119,6 @@ Rosa::Application.routes.draw do
match 'build_lists/pre_build', :to => "build_lists#pre_build"
match 'build_lists/circle_build', :to => "build_lists#circle_build"
match 'build_lists/new_bbdt', :to => "build_lists#new_bbdt"
match 'product_status', :to => 'product_build_lists#status_build'
resources :build_lists, :only => [:index, :show, :update] do
member do

View File

@ -0,0 +1,9 @@
class RemoveProductNotifiedAt < ActiveRecord::Migration
def up
remove_column :product_build_lists, :notified_at
end
def down
add_column :product_build_lists, :notified_at, :datetime
end
end

View File

@ -11,14 +11,14 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120628142723) do
ActiveRecord::Schema.define(:version => 20120628165702) do
create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false
t.string "kind"
t.text "data"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "advisories", :force => true do |t|
@ -224,7 +224,7 @@ ActiveRecord::Schema.define(:version => 20120628142723) do
t.string "owner_type"
t.string "visibility", :default => "open", :null => false
t.string "platform_type", :default => "main", :null => false
t.string "distrib_type"
t.string "distrib_type", :null => false
end
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
@ -240,8 +240,7 @@ ActiveRecord::Schema.define(:version => 20120628142723) do
create_table "product_build_lists", :force => true do |t|
t.integer "product_id"
t.integer "status", :default => 2, :null => false
t.datetime "notified_at"
t.integer "status", :default => 2, :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
@ -295,25 +294,27 @@ ActiveRecord::Schema.define(:version => 20120628142723) do
t.text "description"
t.string "ancestry"
t.boolean "has_issues", :default => true
t.boolean "has_wiki", :default => false
t.string "srpm_file_name"
t.string "srpm_content_type"
t.integer "srpm_file_size"
t.datetime "srpm_updated_at"
t.boolean "has_wiki", :default => false
t.string "default_branch", :default => "master"
t.boolean "is_package", :default => true, :null => false
t.integer "average_build_time", :default => 0, :null => false
t.integer "build_count", :default => 0, :null => false
end
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true
create_table "register_requests", :force => true do |t|
t.string "name"
t.string "email"
t.string "token"
t.boolean "approved", :default => false
t.boolean "rejected", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "interest"
t.text "more"
end
@ -367,7 +368,6 @@ ActiveRecord::Schema.define(:version => 20120628142723) do
t.string "name"
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "password_salt", :default => "", :null => false
t.string "reset_password_token"
t.datetime "remember_created_at"
t.datetime "created_at"
@ -375,11 +375,8 @@ ActiveRecord::Schema.define(:version => 20120628142723) do
t.string "uname"
t.string "role"
t.string "language", :default => "en"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.integer "own_projects_count", :default => 0, :null => false
t.datetime "reset_password_sent_at"
t.integer "own_projects_count", :default => 0, :null => false
t.text "professional_experience"
t.string "site"
t.string "company"
@ -391,6 +388,9 @@ ActiveRecord::Schema.define(:version => 20120628142723) do
t.integer "failed_attempts", :default => 0
t.string "unlock_token"
t.datetime "locked_at"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "authentication_token"
t.integer "build_priority", :default => 50
end

View File

@ -20,8 +20,8 @@ Capistrano::Configuration.instance(:must_exist).load do
end
def stop_workers
run "kill -QUIT `ps aux | grep resque | grep -v grep | awk '{ print $2 }'`"
# run "kill -QUIT `ps aux | grep resque | grep -v grep | awk '{ print $2 }'` > /dev/null 2>&1 &"
ps = 'ps aux | grep resque | grep -v grep'
run "#{ps} && kill -QUIT `#{ps} | awk '{ print $2 }'` || echo 'Workers already stopped!'"
end
def start_workers

View File

@ -13,23 +13,14 @@
<!--Main menu-->
<menu>
<div class="logo">
<a href="#"><img src="/pics/logo-mini.png" alt="Logo"></a>
<a href="/"><img src="/pics/logo-mini.png" alt="Logo"></a>
</div>
<ul>
<li>
<a href="/">Main</a>
</li>
<li>
<a href="/projects">Projects</a>
</li>
<li>
<a href="/groups">Groups</a>
</li>
<li>
<a href="/build_lists">Monitoring</a>
</li>
<li>
<a href="/platforms">Platforms</a>
<a href="/advisories">Advisories</a>
</li>
</ul>
</menu>
@ -41,7 +32,7 @@
</form>
</div>
</div>
</div>
<div class="right">
</div>
@ -51,12 +42,12 @@
<div class="both">
</div>
<!--Page-->
<article>
<!--Single page content-->
<div class="all error404">
<h1>Error <span>404</span></h1>
<h2>Page not found</h2>
<p class="pages">
@ -66,9 +57,9 @@
Or use the search.
</p>
<div class="both"></div>
</div>
<div class="both">
</div>
</article>

View File

@ -13,23 +13,14 @@
<!--Main menu-->
<menu>
<div class="logo">
<a href="#"><img src="/pics/logo-mini.png" alt="Logo"></a>
<a href="/"><img src="/pics/logo-mini.png" alt="Logo"></a>
</div>
<ul>
<li>
<a href="/">Main</a>
</li>
<li>
<a href="/projects">Projects</a>
</li>
<li>
<a href="/groups">Groups</a>
</li>
<li>
<a href="/build_lists">Monitoring</a>
</li>
<li>
<a href="/platforms">Platforms</a>
<a href="/advisories">Advisories</a>
</li>
</ul>
</menu>
@ -41,7 +32,7 @@
</form>
</div>
</div>
</div>
<div class="right">
</div>
@ -51,12 +42,12 @@
<div class="both">
</div>
<!--Page-->
<article>
<!--Single page content-->
<div class="all error500">
<h1>Error <span>500</span></h1>
<h2>Something went wrong.<br>
We've been notified about this issue<br>
@ -68,9 +59,9 @@
Or use the search.
</p>
<div class="both"></div>
</div>
<div class="both">
</div>
</article>

View File

@ -177,7 +177,7 @@ describe Projects::BuildListsController do
before(:each) do
@owner_group = FactoryGirl.create(:group)
@owner_user = FactoryGirl.create(:user)
@owner_group.actors.create :role => 'reader', :actor_id => @owner_user.id, :actor_type => 'User'
@owner_group.actors.create :role => 'admin', :actor_id => @owner_user.id, :actor_type => 'User'
@member_group = FactoryGirl.create(:group)
@member_user = FactoryGirl.create(:user)
@member_group.actors.create :role => 'reader', :actor_id => @member_user.id, :actor_type => 'User'

View File

@ -102,6 +102,8 @@ describe Projects::CommentsController do
context 'for project owner user' do
before(:each) do
@project.update_attribute(:owner, @user)
@project.relations.destroy_all
@project.relations.create :actor_id => @project.owner.id, :actor_type => @project.owner.class.to_s, :role => 'admin'
@create_params[:owner_name] = @user.uname; @update_params[:owner_name] = @user.uname
end

View File

@ -79,6 +79,7 @@ describe Projects::ProjectsController do
end
it_should_behave_like 'projects user with reader rights'
it_should_behave_like 'user without update rights'
end
context 'for writer user' do
@ -136,20 +137,115 @@ describe Projects::ProjectsController do
response.should redirect_to(forbidden_path)
end
it 'should not be able to edit project' do
description = @project.description
put :update, :project=>{:description =>"hack"}, :owner_name => @project.owner.uname, :project_name => @project.name
response.should redirect_to(forbidden_path)
Project.find(@project.id).description.should == description
it_should_behave_like 'user without update rights'
end
context 'for group' do
before(:each) do
@group = FactoryGirl.create(:group)
@group_user = FactoryGirl.create(:user)
@project.relations.destroy_all
set_session_for(@group_user)
end
it 'should not be able to edit project sections' do
has_wiki, has_issues = @project.has_wiki, @project.has_issues
post :sections, :project =>{:has_wiki => !has_wiki, :has_issues => !has_issues}, :owner_name => @project.owner.uname, :project_name => @project.name
response.should redirect_to(forbidden_path)
project = Project.find(@project.id)
project.has_wiki.should == has_wiki
project.has_issues.should == has_issues
context 'owner of the project' do
before(:each) do
@project.update_attribute :owner, @group
@project.relations.create :actor_id => @project.owner.id, :actor_type => @project.owner.class.to_s, :role => 'admin'
end
context 'reader user' do
before(:each) do
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'reader')
end
it_should_behave_like 'projects user with reader rights'
it_should_behave_like 'user without update rights'
it 'should has reader role to group project' do
@group_user.best_role(@project).should eql('reader') # Need this?
end
context 'user should has best role' do
before(:each) do
@project.relations.create :actor_id => @group_user.id, :actor_type => @group_user.class.to_s, :role => 'admin'
end
it_should_behave_like 'projects user with admin rights'
end
end
context 'admin user' do
before(:each) do
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'admin')
end
it_should_behave_like 'projects user with admin rights'
it_should_behave_like 'projects user with reader rights'
end
end
context 'member of the project' do
context 'with admin rights' do
before(:each) do
@project.relations.create :actor_id => @group.id, :actor_type => @group.class.to_s, :role => 'admin'
end
context 'reader user' do
before(:each) do
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'reader')
end
it_should_behave_like 'projects user with reader rights'
it_should_behave_like 'projects user with admin rights'
context 'user should has best role' do
before(:each) do
@project.relations.create :actor_id => @group_user.id, :actor_type => @group_user.class.to_s, :role => 'reader'
end
it_should_behave_like 'projects user with admin rights'
end
end
context 'admin user' do
before(:each) do
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'admin')
end
it_should_behave_like 'projects user with admin rights'
it_should_behave_like 'projects user with reader rights'
end
end
context 'with reader rights' do
before(:each) do
@project.relations.create :actor_id => @group.id, :actor_type => @group.class.to_s, :role => 'reader'
end
context 'reader user' do
before(:each) do
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'reader')
end
it_should_behave_like 'projects user with reader rights'
it_should_behave_like 'user without update rights'
context 'user should has best role' do
before(:each) do
@project.relations.create :actor_id => @group_user.id, :actor_type => @group_user.class.to_s, :role => 'admin'
end
it_should_behave_like 'projects user with admin rights'
end
end
context 'admin user' do
before(:each) do
@group.actors.create(:actor_id => @group_user.id, :actor_type => 'User', :role => 'admin')
end
it_should_behave_like 'projects user with reader rights'
it_should_behave_like 'user without update rights'
end
end
end
end
end

View File

@ -208,6 +208,7 @@ describe CanCan do
context 'with owner rights' do
before(:each) do
@project.update_attribute(:owner, @user)
@project.relations.create!(:actor_id => @user.id, :actor_type => 'User', :role => 'admin')
@issue.project.reload
end

View File

@ -21,7 +21,6 @@ describe ProductBuildList do
it { should_not allow_mass_assignment_of(:product_id) }
it { should allow_mass_assignment_of(:status) }
it { should allow_mass_assignment_of(:notified_at) }
it { should allow_mass_assignment_of(:base_url) }
end

View File

@ -1,6 +1,93 @@
# -*- encoding : utf-8 -*-
require 'spec_helper'
#describe User do
# pending "add some examples to (or delete) #{__FILE__}"
#end
describe User do
before { stub_symlink_methods }
before(:each) do
@project = FactoryGirl.create(:project)
@group = FactoryGirl.create(:group)
@user = FactoryGirl.create(:user)
end
context 'for own project' do
it 'should have admin role' do
@project.owner.best_role(@project).should == 'admin'
end
end
context 'other user' do
it 'should have not right to project' do
other_user = FactoryGirl.create(:user)
other_user.best_role(@project).should == nil
end
end
%w(reader writer admin).each do |group_role|
context "for group with #{group_role} role in project" do
before(:each) do
@project.relations.create :actor_id => @group.id, :actor_type => @group.class.to_s, :role => group_role
end
%w(reader writer admin).each do |role|
context "for user with #{role} role in group" do
before(:each) do
@group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => role)
end
it "should have #{group_role} role to project" do
@user.best_role(@project).should == group_role
end
end
end
end
end
context 'for group project' do
before(:each) do
@project.relations.destroy_all
@project.update_attribute :owner, @group
@project.relations.create :actor_id => @project.owner.id, :actor_type => @project.owner.class.to_s, :role => 'admin'
end
%w(reader writer admin).each do |role|
context "for user with #{role} role in group" do
before(:each) do
@group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => role)
end
it "should have #{role} role to project" do
@user.best_role(@project).should == role
end
end
end
%w(reader writer admin).each do |role|
context "for user with #{role} role in project" do
before(:each) do
@project.relations.create(:actor_id => @user.id, :actor_type => 'User', :role => role)
end
it "should have #{role} role to project" do
@user.best_role(@project).should == role
end
end
end
context "for user with reader role in group and writer role in project" do
it "should have writer best role to project" do
@group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'reader')
@project.relations.create(:actor_id => @user.id, :actor_type => 'User', :role => 'writer')
@user.best_role(@project).should == 'writer'
end
end
context "for user with admin role in group and reader role in project" do
it "should have admin best role to project" do
@group.actors.create(:actor_id => @user.id, :actor_type => 'User', :role => 'admin')
@project.relations.create(:actor_id => @user.id, :actor_type => 'User', :role => 'reader')
@user.best_role(@project).should == 'admin'
end
end
end
end

View File

@ -1,11 +1,12 @@
# -*- encoding : utf-8 -*-
shared_examples_for 'projects user with reader rights' do
it_should_behave_like 'user with rights to view projects'
include_examples 'user with rights to view projects' # nested shared_examples_for dont work
it 'should be able to fork project' do
post :fork, :owner_name => @project.owner.uname, :project_name => @project.name
response.should redirect_to(project_path(Project.last))
end
end
shared_examples_for 'projects user with admin rights' do
@ -21,3 +22,21 @@ shared_examples_for 'user with rights to view projects' do
response.should render_template(:index)
end
end
shared_examples_for 'user without update rights' do
it 'should not be able to edit project' do
description = @project.description
put :update, :project=>{:description =>"hack"}, :owner_name => @project.owner.uname, :project_name => @project.name
Project.find(@project.id).description.should == description
response.should redirect_to(forbidden_path)
end
it 'should not be able to edit project sections' do
has_wiki, has_issues = @project.has_wiki, @project.has_issues
post :sections, :project =>{:has_wiki => !has_wiki, :has_issues => !has_issues}, :owner_name => @project.owner.uname, :project_name => @project.name
project = Project.find(@project.id)
project.has_wiki.should == has_wiki
project.has_issues.should == has_issues
response.should redirect_to(forbidden_path)
end
end