Commit 5b0dc61529def50f19c72d6b2ee206a72e7c1dc6

Authored by Heitor
1 parent 9cc28192

Add a better step to check for ruby metric results

Signed off by: Diego Araújo <diegoamc90@gmail.com>
features/repository/show/metric_results.feature
... ... @@ -65,6 +65,7 @@ Feature: Repository metric results
65 65 When I visit the repository show page
66 66 And I click the "Tree Metric Results" h3
67 67 Then I should see the sample metric's name
  68 + And I should see the ruby metric results
68 69  
69 70 # TODO: Scenario: Should show the graphic of a given metric
70 71 # It was getting really difficult to test this because of Poltergeist's timeouts
... ...
features/step_definitions/repository_steps.rb
... ... @@ -103,10 +103,6 @@ Given(/^I ask for the hotspot metric results of the given module result$/) do
103 103 @metric_results = @module_result.hotspot_metric_results
104 104 end
105 105  
106   -Given(/^I should see the sample metric's name$/) do
107   - expect(page).to have_content(@metric_results.first.metric_configuration.metric.name)
108   -end
109   -
110 106 Given(/^I own that repository$/) do
111 107 FactoryGirl.create(:repository_attributes, {repository_id: @repository.id, user_id: @user.id})
112 108 end
... ... @@ -154,6 +150,16 @@ When(/^I get the Creation Date information as &quot;(.*?)&quot;$/) do |variable|
154 150 eval ("@#{variable} = DateTime.parse('#{val}')")
155 151 end
156 152  
  153 +Then(/^I should see the sample metric's name$/) do
  154 + expect(page).to have_content(@metric_results.first.metric_configuration.metric.name)
  155 +end
  156 +
  157 +Then(/^I should see the ruby metric results$/) do
  158 + @metric_results.each do |metric_result|
  159 + expect(find('#metric_results')).to have_content(format('%.2f', metric_result.value))
  160 + end
  161 +end
  162 +
157 163 Then(/^I should see the sample repository name$/) do
158 164 expect(page).to have_content(@repository.name)
159 165 end
... ...