Fix reference to budget form

pull/6827/head
Oliver Günther 8 years ago
parent e6e0b666c9
commit 51db2278f9
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 64
      features/manage_budget.feature
  2. 40
      spec/controllers/costlog_controller_spec.rb
  3. 2
      spec/controllers/hourly_rates_controller_spec.rb
  4. 3
      spec/support/pages/edit_budget.rb
  5. 3
      spec/support/pages/new_budget.rb

@ -1,64 +0,0 @@
#-- copyright
# OpenProject Costs Plugin
#
# Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#++
Feature: Managing Budgets
Background:
Given there is 1 User with:
| Login | testuser |
| firstname | Chuck |
| lastname | Testa |
| default rate | 37 |
And there is 1 Project with the following:
| name | project1 |
| identifier | project1 |
And there is a role "manager"
And the role "manager" may have the following rights:
| edit_cost_objects |
| view_cost_rates |
| view_hourly_rates |
And there is 1 cost type with the following:
| name | cost_type_1 |
| unit | single_unit |
| unit_plural | multi_unit |
| cost_rate | 40 |
And the user "testuser" is a "manager" in the project "project1"
And I am already logged in as "testuser"
@javascript
Scenario: Budgets can be copied
Given there is a budget with the following:
| subject | budget1 |
| author | testuser |
| project | project1 |
And the budget "budget1" has the following material items:
| units | comment | cost_type |
| 10 | materialtestcomment | cost_type_1 |
| 6 | materialtestcomment2 | cost_type_1 |
And the budget "budget1" has the following labor items:
| hours | comment | user |
| 8 | labortestcomment | testuser |
| 5 | labortestcomment2 | testuser |
And I go to the show page of the budget "budget1"
When I click on "Copy"
Then I should see "New budget"
And the planned material costs in row 1 should be "400.00 EUR"
And the planned labor costs in row 1 should be "296.00 EUR"
And the planned material costs in row 2 should be "240.00 EUR"
And the planned labor costs in row 2 should be "185.00 EUR"

@ -57,13 +57,15 @@ describe CostlogController, type: :controller do
end
shared_examples_for 'assigns' do
it { expect(assigns(:cost_entry).project).to eq(expected_project) }
it { expect(assigns(:cost_entry).work_package).to eq(expected_work_package) }
it { expect(assigns(:cost_entry).user).to eq(expected_user) }
it { expect(assigns(:cost_entry).spent_on).to eq(expected_spent_on) }
it { expect(assigns(:cost_entry).cost_type).to eq(expected_cost_type) }
it { expect(assigns(:cost_entry).units).to eq(expected_units) }
it { expect(assigns(:cost_entry).overridden_costs).to eq(expected_overridden_costs) }
it do
expect(assigns(:cost_entry).project).to eq(expected_project)
expect(assigns(:cost_entry).work_package).to eq(expected_work_package)
expect(assigns(:cost_entry).user).to eq(expected_user)
expect(assigns(:cost_entry).spent_on).to eq(expected_spent_on)
expect(assigns(:cost_entry).cost_type).to eq(expected_cost_type)
expect(assigns(:cost_entry).units).to eq(expected_units)
expect(assigns(:cost_entry).overridden_costs).to eq(expected_overridden_costs)
end
end
before do
@ -88,7 +90,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'successful new' do
before do
get :new, params: { params }
get :new, params: params
end
it { expect(response).to be_success }
@ -98,7 +100,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'forbidden new' do
before do
get :new, params: { params }
get :new, params: params
end
it { expect(response.response_code).to eq(403) }
@ -152,7 +154,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'successful edit' do
before do
get :edit, params: { params }
get :edit, params: params
end
it { expect(response).to be_success }
@ -163,7 +165,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'forbidden edit' do
before do
get :edit, params: { params }
get :edit, params: params
end
it { expect(response.response_code).to eq(403) }
@ -239,7 +241,7 @@ describe CostlogController, type: :controller do
params['id'] = (cost_entry.id + 1).to_s
get :edit, params: { params }
get :edit, params: params
end
it { expect(response.response_code).to eq(404) }
@ -276,7 +278,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'successful create' do
before do
post :create, params: { params }
post :create, params: params
end
# is this really usefull, shouldn't it redirect to the creating work_package by default?
@ -288,7 +290,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'invalid create' do
before do
post :create, params: { params }
post :create, params: params
end
it { expect(response).to be_success }
@ -298,7 +300,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'forbidden create' do
before do
post :create, params: { params }
post :create, params: params
end
it { expect(response.response_code).to eq(403) }
@ -502,7 +504,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'successful update' do
before do
put :update, params: { params }
put :update, params: params
end
it { expect(response).to redirect_to(controller: 'costlog', action: 'index', project_id: project) }
@ -513,7 +515,9 @@ describe CostlogController, type: :controller do
end
shared_examples_for 'invalid update' do
before { put :update, params: { params } }
before do
put :update, params: params
end
it_should_behave_like 'assigns'
it { expect(response).to be_success }
@ -522,7 +526,7 @@ describe CostlogController, type: :controller do
shared_examples_for 'forbidden update' do
before do
put :update, params: { params }
put :update, params: params
end
it { expect(response.response_code).to eq(403) }

@ -34,7 +34,7 @@ describe HourlyRatesController do
}
before do
as_logged_in_user admin do
post :update, params: { params }
post :update, params: params
end
end

@ -27,10 +27,11 @@
#++
require 'support/pages/page'
require_relative 'budget_form'
module Pages
class EditBudget < Page
include BudgetForm
include ::Pages::BudgetForm
attr_reader :cost_object_id # cost_object == budget

@ -27,10 +27,11 @@
#++
require 'support/pages/page'
require_relative 'budget_form'
module Pages
class NewBudget < Page
include BudgetForm
include ::Pages::BudgetForm
attr_reader :project_identifier

Loading…
Cancel
Save