OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/spec/controllers/members_controller_spec.rb

43 lines
1.1 KiB

require 'spec_helper'
describe MembersController do
let(:user) { FactoryGirl.create(:user) }
let(:project) { FactoryGirl.create(:project) }
let(:role) { FactoryGirl.create(:role) }
let(:member) { FactoryGirl.create(:member, :project => project,
:user => user,
:roles => [role]) }
before do
User.stub!(:current).and_return(user)
end
describe :autocomplete_for_member do
let(:params) { ActionController::Parameters.new({ "id" => project.identifier.to_s }) }
describe "WHEN the user is authorized
WHEN a project is provided" do
before do
role.permissions << :manage_members
role.save!
member
post :autocomplete_for_member, params, :format => :xhr
end
it "should be success" do
response.should be_success
end
end
describe "WHEN the user is not authorized" do
before do
post :autocomplete_for_member, params, :format => :xhr
end
it "should be forbidden" do
response.response_code.should == 403
end
end
end
end