public
Description: Generic dependencies resolver in Ruby
Clone URL: git://github.com/samleb/dependencies_resolver.git
Search Repo:
better tests
samleb (author)
Thu May 08 12:32:05 -0700 2008
commit  5d8cfb8e3ecedc271de011addce3cc41173d9746
tree    98b67923363fa502f830dfda4293a23d1103936e
parent  7a5c2681629361abc6eb3b8390fe12e4032ac76f
...
3
4
5
6
 
 
 
 
 
7
8
9
...
12
13
14
15
 
16
17
18
19
20
 
21
22
23
24
25
 
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
40
41
...
3
4
5
 
6
7
8
9
10
11
12
13
...
16
17
18
 
19
20
21
22
23
 
24
25
26
27
28
 
29
30
31
32
33
 
 
 
 
 
 
 
 
 
 
34
35
36
0
@@ -3,7 +3,11 @@ require 'test/unit'
0
 
0
 class DependenciesTest < Test::Unit::TestCase
0
   def setup
0
- @resolver = Dependencies[dependencies]
0
+ @resolver = Dependencies[
0
+ :a => [:b, :c, :d],
0
+ :b => :d,
0
+ :c => :e
0
+ ]
0
   end
0
   
0
   def test_build_should_include_wanted_objects
0
@@ -12,30 +16,21 @@ class DependenciesTest < Test::Unit::TestCase
0
   end
0
   
0
   def test_build_should_include_dependencies
0
- assert_equal [:e, :f, :b], @resolver.resolve([:b])
0
+ assert_equal [:d, :b], @resolver.resolve([:b])
0
   end
0
   
0
   def test_build_should_contain_unique_objects
0
     assert_equal [:f], @resolver.resolve([:f, :f])
0
- assert_equal [:e, :f, :b, :d, :c], @resolver.resolve([:b, :c])
0
+ assert_equal [:d, :b, :e, :c], @resolver.resolve([:b, :c])
0
   end
0
   
0
   def test_should_raise_on_circular_dependency
0
     assert_raise(Dependencies::CircularDependencyError) do
0
- Dependencies[:a => :b, :b => :a].resolve([:a])
0
+ Dependencies.resolve(:a => :b, :b => :a)
0
     end
0
   end
0
   
0
   def test_should_fully_resolve_with_no_argument
0
- assert_equal [:e, :f, :b, :d, :c, :a], @resolver.resolve
0
- end
0
-
0
- def dependencies
0
- {
0
- :a => [:b, :c, :d],
0
- :b => [:e, :f],
0
- :c => [:e, :d],
0
- :f => nil
0
- }
0
+ assert_equal [:d, :b, :e, :c, :a], @resolver.resolve
0
   end
0
 end

Comments

    No one has commented yet.