3 class PipelineInstanceTest < ActiveSupport::TestCase
4 def attribute_editable_for?(token_name, pi_name, attr_name, ever=nil)
6 find_fixture(PipelineInstance, pi_name).attribute_editable?(attr_name, ever)
9 test "admin can edit name" do
10 assert(attribute_editable_for?(:admin, "new_pipeline_in_subproject",
12 "admin not allowed to edit pipeline instance name")
15 test "project owner can edit name" do
16 assert(attribute_editable_for?(:active, "new_pipeline_in_subproject",
18 "project owner not allowed to edit pipeline instance name")
21 test "project admin can edit name" do
22 assert(attribute_editable_for?(:subproject_admin,
23 "new_pipeline_in_subproject", "name"),
24 "project admin not allowed to edit pipeline instance name")
27 test "project viewer cannot edit name" do
28 refute(attribute_editable_for?(:project_viewer,
29 "new_pipeline_in_subproject", "name"),
30 "project viewer allowed to edit pipeline instance name")
33 test "name editable on completed pipeline" do
34 assert(attribute_editable_for?(:active, "has_component_with_completed_jobs",
36 "name not editable on complete pipeline")
39 test "components editable on new pipeline" do
40 assert(attribute_editable_for?(:active, "new_pipeline", "components"),
41 "components not editable on new pipeline")
44 test "components not editable on completed pipeline" do
45 refute(attribute_editable_for?(:active, "has_component_with_completed_jobs",
47 "components not editable on new pipeline")