Fixes some controller specs.

planning_element_type factory will be removed shortly.
pull/1203/head
Martin Czuchra 11 years ago
parent 6ecb51606c
commit 64fee4bb0a
  1. 22
      spec/controllers/api/v2/planning_element_types_controller_spec.rb
  2. 8
      spec/models/planning_element_type_color_spec.rb
  3. 24
      spec/views/api/v2/planning_element_types/_planning_element_type_api_rsb_spec.rb
  4. 2
      spec/views/api/v2/planning_element_types/show_api_rsb_spec.rb

@ -55,9 +55,9 @@ describe Api::V2::PlanningElementTypesController do
describe 'with 3 planning element types available' do
before do
@created_planning_element_types = [
FactoryGirl.create(:planning_element_type),
FactoryGirl.create(:planning_element_type),
FactoryGirl.create(:planning_element_type)
FactoryGirl.create(:type),
FactoryGirl.create(:type),
FactoryGirl.create(:type)
]
@created_planning_element_types.each do |type|
@ -67,7 +67,7 @@ describe Api::V2::PlanningElementTypesController do
# Creating one PlanningElemenType which is not assigned to any
# Project and should therefore not show up in projects with a project
# type
FactoryGirl.create(:planning_element_type)
FactoryGirl.create(:type)
end
it 'assigns an array with all planning element types' do
@ -84,7 +84,7 @@ describe Api::V2::PlanningElementTypesController do
describe 'show.xml' do
def fetch
@available_type = FactoryGirl.create(:planning_element_type, :id => '1337')
@available_type = FactoryGirl.create(:type, :id => '1337')
enable_type(project, @available_type)
get 'show', :project_id => project.identifier, :id => '1337', :format => 'xml'
@ -109,7 +109,7 @@ describe Api::V2::PlanningElementTypesController do
describe 'with an planning element type, which is not enabled in the project' do
before do
FactoryGirl.create(:planning_element_type, :id => '1337')
FactoryGirl.create(:type, :id => '1337')
end
it 'raises ActiveRecord::RecordNotFound errors' do
@ -121,7 +121,7 @@ describe Api::V2::PlanningElementTypesController do
describe 'with an available planning element type' do
before do
@available_planning_element_type = FactoryGirl.create(:planning_element_type,
@available_planning_element_type = FactoryGirl.create(:type,
:id => '1337')
enable_type(project, @available_planning_element_type)
@ -162,9 +162,9 @@ describe Api::V2::PlanningElementTypesController do
describe 'with 3 planning element types available' do
before do
@created_planning_element_types = [
FactoryGirl.create(:planning_element_type),
FactoryGirl.create(:planning_element_type),
FactoryGirl.create(:planning_element_type)
FactoryGirl.create(:type),
FactoryGirl.create(:type),
FactoryGirl.create(:type)
]
end
@ -206,7 +206,7 @@ describe Api::V2::PlanningElementTypesController do
describe 'with an available planning element type' do
before do
@available_planning_element_type = FactoryGirl.create(:planning_element_type, :id => '1337')
@available_planning_element_type = FactoryGirl.create(:type, :id => '1337')
end
def fetch

@ -16,8 +16,8 @@ describe PlanningElementTypeColor do
describe '#planning_element_types' do
it 'can read planning_element_types w/ the help of the has_many association' do
color = FactoryGirl.create(:color)
planning_element_type = FactoryGirl.create(:planning_element_type,
:color_id => color.id)
planning_element_type = FactoryGirl.create(:type,
:color_id => color.id)
color.reload
@ -27,8 +27,8 @@ describe PlanningElementTypeColor do
it 'nullifies dependent planning_element_types' do
color = FactoryGirl.create(:color)
planning_element_type = FactoryGirl.create(:planning_element_type,
:color_id => color.id)
planning_element_type = FactoryGirl.create(:type,
:color_id => color.id)
color.reload
color.destroy

@ -23,18 +23,20 @@ describe 'api/v2/planning_element_types/_planning_element_type.api' do
end
describe 'with an assigned planning_element_type' do
let(:planning_element_type) { FactoryGirl.build(:planning_element_type,
:id => 1,
:name => 'Awesometastic Planning Element Type',
let(:planning_element_type) {
FactoryGirl.build(:type,
:id => 1,
:name => 'Awesometastic Planning Element Type',
:in_aggregation => false,
:is_milestone => true,
:is_default => true,
:in_aggregation => false,
:is_milestone => true,
:is_default => true,
:position => 100,
:position => 100,
:created_at => Time.parse('Thu Jan 06 12:35:00 +0100 2011'),
:updated_at => Time.parse('Fri Jan 07 12:35:00 +0100 2011')) }
:created_at => Time.parse('Thu Jan 06 12:35:00 +0100 2011'),
:updated_at => Time.parse('Fri Jan 07 12:35:00 +0100 2011'))
}
it 'renders a planning_element_type node' do
render
@ -102,8 +104,8 @@ describe 'api/v2/planning_element_types/_planning_element_type.api' do
describe 'with a planning element type having a color' do
let(:color) { FactoryGirl.create(:color_white, :id => 1338) }
let(:planning_element_type) { FactoryGirl.build(:planning_element_type,
:color_id => color.id) }
let(:planning_element_type) { FactoryGirl.build(:type,
:color_id => color.id) }
describe 'planning_element_type node' do
it 'contains a color element with name, id and hexcode attributes' do

@ -21,7 +21,7 @@ describe 'api/v2/planning_element_types/show.api.rsb' do
end
describe 'with an assigned planning element type' do
let(:planning_element_type) { FactoryGirl.build(:planning_element_type) }
let(:planning_element_type) { FactoryGirl.build(:type) }
before do
assign(:planning_element_type, planning_element_type)

Loading…
Cancel
Save