Commit 30d5fdc56916db773e54ea0cd979d18b82d5fb20
1 parent
24b0e1eb
Exists in
staging
and in
42 other branches
Fix for Noosfero::Factory throwing Exception when 'defaults_for' wasn't found
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
test/factories.rb
| @@ -44,7 +44,9 @@ module Noosfero::Factory | @@ -44,7 +44,9 @@ module Noosfero::Factory | ||
| 44 | end | 44 | end |
| 45 | 45 | ||
| 46 | def defaults_for(name) | 46 | def defaults_for(name) |
| 47 | - send('defaults_for_' + name.to_s.underscore) || {} | 47 | + send('defaults_for_' + name.to_s.underscore) |
| 48 | + rescue | ||
| 49 | + {} | ||
| 48 | end | 50 | end |
| 49 | 51 | ||
| 50 | def self.num_seq | 52 | def self.num_seq |
| @@ -457,4 +459,12 @@ module Noosfero::Factory | @@ -457,4 +459,12 @@ module Noosfero::Factory | ||
| 457 | { :name => 'Production cost ' + factory_num_seq.to_s } | 459 | { :name => 'Production cost ' + factory_num_seq.to_s } |
| 458 | end | 460 | end |
| 459 | 461 | ||
| 462 | + ############################################### | ||
| 463 | + # National Region | ||
| 464 | + ############################################### | ||
| 465 | + | ||
| 466 | + def defaults_for_national_region | ||
| 467 | + { :name => 'National region ' + factory_num_seq.to_s } | ||
| 468 | + end | ||
| 469 | + | ||
| 460 | end | 470 | end |