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/versions_controller_spec.rb

39 lines
1.2 KiB

require 'spec_helper'
describe VersionsController do
before do
@controller.stub(:authorize)
11 years ago
# Create a version assigned to a project
@version = FactoryGirl.create(:version)
@oldVersionName = @version.name
@newVersionName = "NewVersionName"
11 years ago
# Create another project
@project = FactoryGirl.create(:project)
11 years ago
# Create params to update version
@params = {}
@params[:id] = @version.id
@params[:version] = { :name => @newVersionName }
end
describe 'update' do
it 'does not allow to update versions from different projects' do
@params[:project_id] = @project.id
put 'update', @params
@version.reload
response.should redirect_to :controller => '/projects', :action => 'settings', :tab => 'versions', :id => @project
@version.name.should == @oldVersionName
end
it 'allows to update versions from the version project' do
@params[:project_id] = @version.project.id
put 'update', @params
@version.reload
response.should redirect_to :controller => '/projects', :action => 'settings', :tab => 'versions', :id => @version.project
@version.name.should == @newVersionName
end
end
end