Commit 1daafa6278581d6556d53ce70c27a2de46ada063

Authored by Rafael Reggiani Manzo
1 parent 775afddc

Fix KalibroModule factories

KalibroClient now expectes granularity as a hash with key type.
app/helpers/kalibro_modules_helper.rb
... ... @@ -17,7 +17,7 @@ module KalibroModulesHelper
17 17 if (a.kalibro_module.granularity == b.kalibro_module.granularity)
18 18 a.kalibro_module.name <=> b.kalibro_module.name
19 19 else
20   - (ComparableGranularity.new(b.kalibro_module.granularity.to_sym) <=> ComparableGranularity.new(a.kalibro_module.granularity.to_sym))
  20 + (ComparableGranularity.new(b.kalibro_module.granularity.type) <=> ComparableGranularity.new(a.kalibro_module.granularity.type))
21 21 end
22 22 end
23 23 end
... ...
spec/factories/kalibro_modules.rb
1 1 FactoryGirl.define do
2 2 factory :kalibro_module, class: KalibroClient::Entities::Processor::KalibroModule do
3 3 name 'Qt-Calculator'
4   - granularity 'SOFTWARE'
  4 + granularity { {'type' => 'SOFTWARE'} }
5 5  
6 6 trait :package do
7   - granularity 'PACKAGE'
  7 + granularity { {'type' => 'PACKAGE'} }
8 8 end
9 9  
10 10 trait :class do
11   - granularity 'CLASS'
  11 + granularity { {'type' => 'CLASS'} }
12 12 end
13 13  
14 14 trait :function do
15   - granularity 'FUNCTION'
  15 + granularity { {'type' => 'FUNCTION'} }
16 16 end
17 17  
18 18 trait :method do
19   - granularity 'METHOD'
  19 + granularity { {'type' => 'METHOD'} }
20 20 end
21 21  
22 22 factory :kalibro_module_package, traits: [:package]
23 23 factory :kalibro_module_class, traits: [:class]
24 24 factory :kalibro_module_function, traits: [:function]
25 25 factory :kalibro_module_method, traits: [:method]
  26 +
  27 + initialize_with { KalibroClient::Entities::Processor::KalibroModule.new({granularity: granularity, name: name}.stringify_keys) }
26 28 end
27 29 end
... ...