Skip to content

Commit

Permalink
finally fix cukes..?
Browse files Browse the repository at this point in the history
  • Loading branch information
josemigallas committed Dec 23, 2021
1 parent 9d1466d commit 12db602
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
25 changes: 17 additions & 8 deletions features/api/metrics/create.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,27 @@ Feature: Product > Integration > Metrics > New
When I fill in "Friendly name" with "Cotoletta 2"
And I fill in "System name" with "cotoletta"
And I press "Create Method"
Then the provider should not have a metric "Cotoletta 2"
Then I should see "Has already been taken"
And the provider should not have a method "Cotoletta 2"

Scenario: Create a method with an existing friendly name
Given a method "Cotoletta" of the provider
When I fill in "Friendly name" with "Cotoletta"
And I fill in "System name" with "cotoletta_2"
And I press "Create Method"
Then the provider should have a metric with system name "cotoletta_2"
Then I should see "Has already been taken"
And the provider should not have a method with system name "cotoletta_2"

Scenario: Create a method from the index page
When I fill in "Friendly name" with "Cotto e Funghi"
And I fill in "System name" with "cotto_funghi"
And I fill in "Description" with "The number of times this dish has been served"
And I press "Create Method"
Then I should see "Cotto e Funghi"
And the provider should have a metric "Cotto e Funghi"
And the provider should have a method "Cotto e Funghi"
And method "Cotto e Funghi" should have the following attributes:
| Friendly name | Cotto e Funghi |
| Unit | hit |
| System name | cotto_funghi |
| Description | The number of times this dish has been served |

Rule: Tab metrics
Expand All @@ -45,16 +49,20 @@ Feature: Product > Integration > Metrics > New
Scenario: Create a metrics with an existing system name
Given a metric "Carni" of the provider
When I fill in "Friendly name" with "Carni 2"
And I fill in "System name" with "carni"
And I fill in "System name" with "Carnipoexit"
And I fill in "Unit" with "servings"
And I press "Create Metric"
Then the provider should not have a metric "Carni 2"
Then I should see "Has already been taken"
And the provider should not have a metric "Carni 2"

Scenario: Create a metric with an existing friendly name
Given a metric "Carni" of the provider
When I fill in "Friendly name" with "Carni"
And I fill in "System name" with "carni_2"
When I fill in "System name" with "carni_2"
And I fill in "Unit" with "servings"
And I press "Create Metric"
Then the provider should have a metric with system_name "carni_2"
Then I should see "Has already been taken"
Then the provider should not have a metric with system name "carni_2"

Scenario: Create a metric from the index page
When I fill in "Friendly name" with "Antipasti"
Expand All @@ -66,5 +74,6 @@ Feature: Product > Integration > Metrics > New
And the provider should have a metric "Antipasti"
And metric "Antipasti" should have the following attributes:
| Friendly name | Antipasti |
| System name | antipasti |
| Unit | order |
| Description | The number of antipasti dishes ordered |
8 changes: 8 additions & 0 deletions features/step_definitions/metric_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,18 @@
assert_equal should, provider.metrics.find_by(friendly_name: metric_name).present?
end

Then "{provider} {should} have (a )method {string}" do |provider, should, metric_name|
assert_equal should, provider.metrics.hits.children.find_by(friendly_name: metric_name).present?
end

Then "{provider} {should} have (a )metric with system name {string}" do |provider, should, system_name|
assert_equal should, provider.metrics.find_by(system_name: system_name).present?
end

Then "{provider} {should} have (a )method with system name {string}" do |provider, should, system_name|
assert_equal should, provider.metrics.hits.children.find_by(system_name: system_name).present?
end

Then "{metric} should have the following attributes:" do |metric, table|
check_metric_attributes(metric, table)
end
Expand Down

0 comments on commit 12db602

Please sign in to comment.