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/patches/work_packages_controller_pa...

66 lines
1.7 KiB

require 'spec_helper'
describe WorkPackagesController, "rendering to xls", :type => :controller do
let(:current_user) { FactoryGirl.create(:admin) }
let!(:work_package) { FactoryGirl.create(:work_package, :subject => '!SUBJECT!',
:description => '!DESCRIPTION!') }
before do
User.stub(:current).and_return current_user
end
describe "should respond with the xls if requested in the index" do
before do
get('index', :format => 'xls', :project_id => work_package.project_id)
end
it 'should respond with 200 OK' do
response.response_code.should == 200
end
it 'should have a length > 100 bytes' do
response.body.length.should > 100
end
it 'should not contain a description' do
response.body.should_not include('!DESCRIPTION!')
end
it 'should contain a subject' do
response.body.should include('!SUBJECT!')
end
context 'the mime type' do
it { response.header['Content-Type'].should == 'application/vnd.ms-excel' }
end
end
context 'with descriptions' do
before do
get('index', :format => 'xls',
:project_id => work_package.project_id,
:show_descriptions => 'true')
end
it 'should respond with 200 OK' do
response.response_code.should == 200
end
it 'should have a length > 100 bytes' do
response.body.length.should > 100
end
it 'should contain a description' do
response.body.should include('!DESCRIPTION!')
end
it 'should contain a subject' do
response.body.should include('!SUBJECT!')
end
context 'the mime type' do
it { response.header['Content-Type'].should == 'application/vnd.ms-excel' }
end
end
end