Merge pull request #76 from ulferts/fix/rails_4_finders_and_test_updates

Fix/rails 4 finders and test updates
pull/6827/head
ulferts 9 years ago
commit 5c769560bd
  1. 2
      app/models/cost_query/custom_field_mixin.rb
  2. 11
      features/links.feature
  3. 125
      features/permission_variations.feature
  4. 2
      lib/widget/entry_table.rb

@ -47,7 +47,7 @@ module CostQuery::CustomFieldMixin
end
def generate_subclasses
WorkPackageCustomField.all(conditions: "field_format in ('#{SQL_TYPES.keys.join('\',\'')}')").map do |field|
WorkPackageCustomField.where("field_format in ('#{SQL_TYPES.keys.join('\',\'')}')").map do |field|
class_name = "CustomField#{field.id}"
parent.send(:remove_const, class_name) if parent.const_defined? class_name
parent.const_set class_name, Class.new(self)

@ -28,12 +28,16 @@ Feature: Cost Reporting Linkage
And I am already logged in as "controller"
And I am on the Cost Reports page for the project called "Some Project"
When I choose "Cash value"
And I send the query
Then I should see "User"
# And I should see "<< me >>"
# And I should see "me"
And I should see "No data to display"
And I should not see "0.00"
@javascript
Scenario: Coming to the cost report for the first time, I should see my entries
Given there is a standard cost control project named "Standard Project"
And the user "manager" has:
@ -54,12 +58,15 @@ Feature: Cost Reporting Linkage
And I am already logged in as "manager"
And I am on the Cost Reports page for the project called "Standard Project"
When I choose "Cash value"
And I send the query
# 100 EUR (labour cost) + 7.07 EUR (words)
Then I should see "107.07"
And I should not see "No data to display"
@javascript
Scenario: If
Scenario: Deleting the cost entry
Given there is a standard cost control project named "Standard Project"
And the user "manager" has 1 issue with:
| subject | manager work_package |
@ -77,7 +84,9 @@ Feature: Cost Reporting Linkage
And I am on the Cost Reports page for the project called "Standard Project"
When I click on "Clear"
And I choose "Cash value"
And I send the query
# 7.07 EUR (words)
Then I should see "7.07"
And I delete the cost entry "7.07"

@ -39,6 +39,7 @@ Feature: Permissions
Then I should see "Login"
And I should see "Password"
@javascript
Scenario: Admin sees everything
Given there is a standard permission test project named "Permission_Test"
And there is 1 user with:
@ -48,8 +49,10 @@ Feature: Permissions
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I should not see "No data to display"
And I choose "Cash value"
And I click "Apply"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "11.11 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -63,6 +66,7 @@ Feature: Permissions
# other
And I should see "1.0 ten"
@javascript
Scenario: User who has all rights sees everything
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -76,9 +80,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "11.11 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -101,6 +107,7 @@ Feature: Permissions
# permission denied
Then I should see "403"
@javascript
Scenario: User who may only see own cost entries, only sees his own cost entries without costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -108,9 +115,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should not see "11.11 EUR" within ".result"
And I should see "-" within ".result"
# TimeEntries
@ -124,6 +133,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who may only see cost entries, sees them without costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -131,9 +141,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should not see "11.11 EUR" within ".result"
And I should see "-" within ".result"
# TimeEntries
@ -147,6 +159,7 @@ Feature: Permissions
# other
And I should see "1.0 ten"
@javascript
Scenario: User who may only see his own time entries, only sees them without costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -154,9 +167,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should not see "11.11 EUR" within ".result"
And I should see "-" within ".result"
# TimeEntries
@ -170,6 +185,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who may only see time entries, only sees them without costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -177,9 +193,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should not see "11.11 EUR" within ".result"
And I should see "-" within ".result"
# TimeEntries
@ -193,6 +211,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who may only see own time and cost entries, only sees them without costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -201,9 +220,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should not see "11.11 EUR" within ".result"
And I should see "-" within ".result"
# TimeEntries
@ -217,6 +238,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who may only see own time entries, but all cost entries, sees them without costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -225,9 +247,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should not see "11.11 EUR" within ".result"
And I should see "-" within ".result"
# TimeEntries
@ -241,6 +265,7 @@ Feature: Permissions
# other
And I should see "1.0 ten"
@javascript
Scenario: User who may only see own cost entries, but all time entries, sees them without costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -249,9 +274,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should not see "11.11 EUR" within ".result"
And I should see "-" within ".result"
# TimeEntries
@ -265,6 +292,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who my see all time and cost entries, sees them without costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -273,9 +301,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should not see "11.11 EUR" within ".result"
And I should see "-" within ".result"
# TimeEntries
@ -298,6 +328,7 @@ Feature: Permissions
# access denied
Then I should see "403"
@javascript
Scenario: User who may see own costs and own cost entries, sees them with costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -306,9 +337,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should not see "11.11 EUR" within ".result"
And I should see "-" within ".result"
# TimeEntries
@ -322,6 +355,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who may see own costs and all cost entries, sees all cost entries, but own costs only
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -330,9 +364,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should not see "11.11 EUR" within ".result"
And I should see "-" within ".result"
# TimeEntries
@ -346,6 +382,7 @@ Feature: Permissions
# other
And I should see "1.0 ten"
@javascript
Scenario: User who may see own costs and own time entries, sees his entries with own costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -354,9 +391,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "0.01 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -370,6 +409,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: A user who may see own costs, own time entries and own cost entries, sees then with costs (as they are his costs)
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -379,9 +419,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "0.01 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -395,6 +437,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who may see own costs, own time entries and all cost entries, only sees those entries and only own entries with costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -404,9 +447,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "0.01 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -420,6 +465,7 @@ Feature: Permissions
# other
And I should see "1.0 ten"
@javascript
Scenario: User who may see own costs and time entries, only sees own time entries with costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -428,9 +474,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "0.01 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -444,6 +492,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who can see own costs, all time entries and only his own cost entries, see only the requested entries where costs are only visible on own entries
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -453,9 +502,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "0.01 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -469,6 +520,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who may see own costs and all entries, only sees his own entries attached with costs
# ATTENTION: there is no right to see own CostEntry costs - so no costs for cost entries are visible after all
Given there is a standard permission test project named "Permission_Test"
@ -479,9 +531,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "0.01 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -504,6 +558,7 @@ Feature: Permissions
And I am on the overall Cost Reports page without filters or groups
Then I should see "403" #access denied
@javascript
Scenario: User wh can see all costs and his own cost entries, only sees own cost entries with costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -513,9 +568,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "1.00 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -529,6 +586,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who may see all costs and all cost entries, sees all cost entries with costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -538,9 +596,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "11.00 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -554,6 +614,7 @@ Feature: Permissions
# other
And I should see "1.0 ten"
@javascript
Scenario: User who may see all costs and own time entries, sees them with costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -563,9 +624,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "0.01 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -579,6 +642,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who may see all costs, own time- and cost- entries, sees his own entires with costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -589,9 +653,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "1.01 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -605,6 +671,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who may see all costs, own time entries and all cost entries, only sees them with costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -615,9 +682,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "11.01 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -631,6 +700,7 @@ Feature: Permissions
# other
And I should see "1.0 ten"
@javascript
Scenario: User who may see all costs and all time entries, sees them with costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -640,9 +710,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "0.11 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries
@ -656,6 +728,7 @@ Feature: Permissions
# other
And I should not see "1.0 ten"
@javascript
Scenario: User who may see all costs, all time entries and his own cost entries, sees them with costs
Given there is a standard permission test project named "Permission_Test"
And the role "Testuser" may have the following rights:
@ -666,9 +739,11 @@ Feature: Permissions
And I am already logged in as "testuser"
And I am on the overall Cost Reports page without filters or groups
Then I should see "Cost Report" within "#content"
And I choose "Cash value"
And I click "Apply"
And I should not see "No data to display"
# Costs
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 11.00 [other, cost])
# costs (0.01 [own, time] + 0.10 [other, time] + 1.00 [own, cost] + 10.00 [other, cost])
And I should see "1.11 EUR" within ".result"
And I should not see "-" within ".result"
# TimeEntries

@ -145,7 +145,7 @@ class Widget::Table::EntryTable < Widget::Table
(action_for(result, action: 'destroy')
.reverse_merge(authenticity_token: form_authenticity_token)),
title: l(:button_edit),
confirm: l(:text_are_you_sure),
data: { confirm: l(:text_are_you_sure) },
method: :delete,
class: 'no-decoration-on-hover',
title: l(:button_delete))

Loading…
Cancel
Save