kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
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.
115 lines
2.9 KiB
115 lines
2.9 KiB
9 years ago
|
require 'spec_helper'
|
||
|
|
||
|
describe 'form configuration: ', js: true do
|
||
|
describe 'showing the work package' do
|
||
|
let(:user) { FactoryGirl.create :admin }
|
||
|
let(:type) { work_package.type }
|
||
|
|
||
|
let(:version) do
|
||
|
FactoryGirl.create :version, name: '42.0', project: work_package.project
|
||
|
end
|
||
|
|
||
|
let(:work_package) { FactoryGirl.create :work_package, author: user }
|
||
|
let(:wp_page) { Pages::FullWorkPackage.new work_package }
|
||
|
|
||
|
before do
|
||
|
login_as user
|
||
|
end
|
||
|
|
||
|
describe 'with version having no visibility configured' do
|
||
|
it 'shows the version field if one is set (default behaviour)' do
|
||
|
work_package.update! fixed_version: version
|
||
|
|
||
|
wp_page.visit!
|
||
|
wp_page.ensure_page_loaded
|
||
|
|
||
|
wp_page.expect_attributes Version: '42.0'
|
||
|
end
|
||
|
|
||
|
it 'hides the version field if none is set (default behaviour)' do
|
||
|
work_package.update! fixed_version: nil
|
||
|
|
||
|
wp_page.visit!
|
||
|
wp_page.ensure_page_loaded
|
||
|
|
||
|
wp_page.expect_attribute_hidden 'Version'
|
||
|
end
|
||
|
end
|
||
|
|
||
|
describe 'with version having its visibility set to default' do
|
||
|
before do
|
||
|
type.attribute_visibility['version'] = 'default'
|
||
|
type.save!
|
||
|
end
|
||
|
|
||
|
it 'shows the version field if one is set' do
|
||
|
work_package.update! fixed_version: version
|
||
|
|
||
|
wp_page.visit!
|
||
|
wp_page.ensure_page_loaded
|
||
|
|
||
|
wp_page.expect_attributes Version: '42.0'
|
||
|
end
|
||
|
|
||
|
it 'hides the version field if none is set' do
|
||
|
work_package.update! fixed_version: nil
|
||
|
|
||
|
wp_page.visit!
|
||
|
wp_page.ensure_page_loaded
|
||
|
|
||
|
wp_page.expect_attribute_hidden 'Version'
|
||
|
end
|
||
|
end
|
||
|
|
||
|
describe 'with version having its visibility set to hidden' do
|
||
|
before do
|
||
|
type.attribute_visibility['version'] = 'hidden'
|
||
|
type.save!
|
||
|
end
|
||
|
|
||
|
it 'hides the version field even if one is set' do
|
||
|
work_package.update! fixed_version: version
|
||
|
|
||
|
wp_page.visit!
|
||
|
wp_page.ensure_page_loaded
|
||
|
|
||
|
wp_page.expect_attribute_hidden 'Version'
|
||
|
end
|
||
|
|
||
|
it 'hides the version field if none is set' do
|
||
|
work_package.update! fixed_version: nil
|
||
|
|
||
|
wp_page.visit!
|
||
|
wp_page.ensure_page_loaded
|
||
|
|
||
|
wp_page.expect_attribute_hidden 'Version'
|
||
|
end
|
||
|
end
|
||
|
|
||
|
describe 'with version having its visibility set to visible' do
|
||
|
before do
|
||
|
type.attribute_visibility['version'] = 'visible'
|
||
|
type.save!
|
||
|
end
|
||
|
|
||
|
it 'shows the version field if one is set' do
|
||
|
work_package.update! fixed_version: version
|
||
|
|
||
|
wp_page.visit!
|
||
|
wp_page.ensure_page_loaded
|
||
|
|
||
|
wp_page.expect_attributes Version: '42.0'
|
||
|
end
|
||
|
|
||
|
it 'shows the version field even if none is set' do
|
||
|
work_package.update! fixed_version: nil
|
||
|
|
||
|
wp_page.visit!
|
||
|
wp_page.ensure_page_loaded
|
||
|
|
||
|
wp_page.expect_attributes Version: nil
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|