Commit bfe651dd1748593f7dba77607f5f30a90003d79f

Authored by Rafael Manzo
1 parent e41cf657

Fixed let behaviour on ModulesController spec

Signed off by: Guilherme Rojas V. de Lima <guilhermehrojas@gmail.com>
Showing 1 changed file with 1 additions and 6 deletions   Show diff stats
spec/controllers/modules_controller_spec.rb
@@ -18,10 +18,9 @@ describe ModulesController do @@ -18,10 +18,9 @@ describe ModulesController do
18 let (:metric_name ){ FactoryGirl.build(:loc).name } 18 let (:metric_name ){ FactoryGirl.build(:loc).name }
19 let (:date ){ DateTime.parse("2011-10-20T18:26:43.151+00:00") } 19 let (:date ){ DateTime.parse("2011-10-20T18:26:43.151+00:00") }
20 let (:metric_result){ FactoryGirl.build(:metric_result) } 20 let (:metric_result){ FactoryGirl.build(:metric_result) }
21 - let (:module_result){ FactoryGirl.build(:module_result) } 21 + let! (:module_result){ FactoryGirl.build(:module_result) }
22 22
23 before :each do 23 before :each do
24 - module_result #TODO discover why this line is fundamental, without this line the test generates a nil object for module_result  
25 ModuleResult.expects(:new).at_least_once.with({id: module_result.id.to_s}).returns(module_result) 24 ModuleResult.expects(:new).at_least_once.with({id: module_result.id.to_s}).returns(module_result)
26 module_result.expects(:metric_history).with(metric_name).returns({date => metric_result.value}) 25 module_result.expects(:metric_history).with(metric_name).returns({date => metric_result.value})
27 end 26 end
@@ -46,9 +45,5 @@ describe ModulesController do @@ -46,9 +45,5 @@ describe ModulesController do
46 @graphic.labels.first[1].should eq date.strftime("%Y/%m/%d") 45 @graphic.labels.first[1].should eq date.strftime("%Y/%m/%d")
47 end 46 end
48 end 47 end
49 -  
50 -  
51 -  
52 -  
53 end 48 end
54 end 49 end
55 \ No newline at end of file 50 \ No newline at end of file