Commit 45299b9e4f1c8269ec94263df294f720dd07feac

Authored by Rafael Manzo
1 parent 822a81f5

Using -INF and INF to represent range infinite baginnings and ends

app/models/mezuro_range.rb
... ... @@ -14,10 +14,10 @@ class MezuroRange < KalibroGatekeeperClient::Entities::Range
14 14 private
15 15  
16 16 def non_infinite_end?
17   - !(self.end == '-INF' || self.end == '+INF')
  17 + !(self.end == '-INF' || self.end == 'INF')
18 18 end
19 19  
20 20 def non_infinite_beginning?
21   - val = !(self.beginning == '-INF' || self.beginning == '+INF')
  21 + val = !(self.beginning == '-INF' || self.beginning == 'INF')
22 22 end
23 23 end
... ...
features/repository/show/metric_results.feature
... ... @@ -3,7 +3,7 @@ Feature: Repository metric results
3 3 As a regular user
4 4 I should see the metric results table with its graphics
5 5  
6   - @kalibro_restart @javascript @wip
  6 + @kalibro_restart @javascript
7 7 Scenario: Should show the message when the graphic of the given metric have only a single point
8 8 Given I am a regular user
9 9 And I am signed in
... ...
features/step_definitions/repository_steps.rb
... ... @@ -7,17 +7,17 @@ Given(/^I have a sample configuration with native metrics$/) do
7 7 metric: FactoryGirl.build(:loc),
8 8 reading_group_id: reading_group.id,
9 9 configuration_id: @configuration.id})
10   - range = FactoryGirl.build(:mezuro_range, {id: nil, reading_id: reading.id, beginning: '-INF', :end => '+INF', metric_configuration_id: metric_configuration.id})
  10 + range = FactoryGirl.build(:mezuro_range, {id: nil, reading_id: reading.id, beginning: '-INF', :end => 'INF', metric_configuration_id: metric_configuration.id})
11 11 range.save
12 12 end
13 13  
14 14 Given(/^I have a sample repository within the sample project$/) do
15   - @repository = FactoryGirl.create(:repository, {project_id: @project.id,
  15 + @repository = FactoryGirl.create(:repository, {project_id: @project.id,
16 16 configuration_id: @configuration.id, id: nil})
17 17 end
18 18  
19 19 Given(/^I have a sample repository within the sample project named "(.+)"$/) do |name|
20   - @repository = FactoryGirl.create(:repository, {project_id: @project.id,
  20 + @repository = FactoryGirl.create(:repository, {project_id: @project.id,
21 21 configuration_id: @configuration.id, id: nil, name: name})
22 22 end
23 23  
... ... @@ -128,8 +128,8 @@ Then(/^I wait for "(.*?)" seconds or until I see "(.*?)"$/) do |timeout, text|
128 128 while(page.html.match(text).nil?)
129 129 break if (Time.now - start_time) >= timeout.to_f
130 130 sleep 1
131   - end
132   -
  131 + end
  132 +
133 133 page.should have_content(text)
134 134 end
135 135  
... ...
spec/models/mezuro_range_spec.rb
... ... @@ -16,18 +16,28 @@ describe MezuroRange do
16 16 it { should validate_presence_of(:beginning) }
17 17 it { should validate_presence_of(:end) }
18 18  
19   - it 'should allow -INF and +INF to beginning' do
  19 + it 'should allow -INF and INF to beginning' do
20 20 subject.beginning = '-INF'
21 21 subject.save
22 22  
23 23 subject.errors.messages.should be_empty
  24 +
  25 + subject.beginning = 'INF'
  26 + subject.save
  27 +
  28 + subject.errors.messages.should be_empty
24 29 end
25 30  
26   - it 'should allow -INF and +INF to end' do
  31 + it 'should allow -INF and INF to end' do
27 32 subject.end = '-INF'
28 33 subject.save
29 34  
30 35 subject.errors.messages.should be_empty
  36 +
  37 + subject.end = 'INF'
  38 + subject.save
  39 +
  40 + subject.errors.messages.should be_empty
31 41 end
32 42 end
33 43 end
... ...