test/base/test_dependency_tracker.rb in nanoc-3.8.0 vs test/base/test_dependency_tracker.rb in nanoc-4.0.0a1
- old
+ new
@@ -1,14 +1,14 @@
# encoding: utf-8
-class Nanoc::DependencyTrackerTest < Nanoc::TestCase
+class Nanoc::Int::DependencyTrackerTest < Nanoc::TestCase
def test_initialize
# Mock items
items = [mock, mock]
# Create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Verify no dependencies yet
assert_empty tracker.objects_causing_outdatedness_of(items[0])
assert_empty tracker.objects_causing_outdatedness_of(items[1])
end
@@ -16,11 +16,11 @@
def test_record_dependency
# Mock items
items = [mock, mock]
# Create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Record some dependencies
tracker.record_dependency(items[0], items[1])
# Verify dependencies
@@ -30,11 +30,11 @@
def test_record_dependency_no_self
# Mock items
items = [mock, mock]
# Create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Record some dependencies
tracker.record_dependency(items[0], items[0])
tracker.record_dependency(items[0], items[1])
@@ -45,11 +45,11 @@
def test_record_dependency_no_doubles
# Mock items
items = [mock, mock]
# Create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Record some dependencies
tracker.record_dependency(items[0], items[1])
tracker.record_dependency(items[0], items[1])
tracker.record_dependency(items[0], items[1])
@@ -61,11 +61,11 @@
def test_objects_causing_outdatedness_of
# Mock items
items = [mock, mock, mock]
# Create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Record some dependencies
tracker.record_dependency(items[0], items[1])
tracker.record_dependency(items[1], items[2])
@@ -76,11 +76,11 @@
def test_objects_outdated_due_to
# Mock items
items = [mock, mock, mock]
# Create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Record some dependencies
tracker.record_dependency(items[0], items[1])
tracker.record_dependency(items[1], items[2])
@@ -91,18 +91,18 @@
def test_start_and_stop
# Mock items
items = [mock, mock]
# Create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Start, do something and stop
tracker.start
- Nanoc::NotificationCenter.post(:visit_started, items[0])
- Nanoc::NotificationCenter.post(:visit_started, items[1])
- Nanoc::NotificationCenter.post(:visit_ended, items[1])
- Nanoc::NotificationCenter.post(:visit_ended, items[0])
+ Nanoc::Int::NotificationCenter.post(:visit_started, items[0])
+ Nanoc::Int::NotificationCenter.post(:visit_started, items[1])
+ Nanoc::Int::NotificationCenter.post(:visit_ended, items[1])
+ Nanoc::Int::NotificationCenter.post(:visit_ended, items[0])
tracker.stop
# Verify dependencies
assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
assert_empty tracker.objects_causing_outdatedness_of(items[1])
@@ -116,26 +116,26 @@
items[1].stubs(:reference).returns([:item, '/bbb/'])
items[2].stubs(:reference).returns([:item, '/ccc/'])
items[3].stubs(:reference).returns([:item, '/ddd/'])
# Create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Record some dependencies
tracker.record_dependency(items[0], items[1])
tracker.record_dependency(items[1], items[2])
tracker.record_dependency(items[1], items[3])
# Store
- tracker.store_graph
+ tracker.store
assert File.file?(tracker.filename)
# Re-create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Load
- tracker.load_graph
+ tracker.load
# Check loaded graph
assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
assert_contains_exactly [items[2], items[3]], tracker.objects_causing_outdatedness_of(items[1])
assert_empty tracker.objects_causing_outdatedness_of(items[2])
@@ -154,26 +154,26 @@
# Create new and old lists
old_items = [items[0], items[1], items[2], items[3]]
new_items = [items[0], items[1], items[2]]
# Create
- tracker = Nanoc::DependencyTracker.new(old_items)
+ tracker = Nanoc::Int::DependencyTracker.new(old_items)
# Record some dependencies
tracker.record_dependency(old_items[0], old_items[1])
tracker.record_dependency(old_items[1], old_items[2])
tracker.record_dependency(old_items[1], old_items[3])
# Store
- tracker.store_graph
+ tracker.store
assert File.file?(tracker.filename)
# Re-create
- tracker = Nanoc::DependencyTracker.new(new_items)
+ tracker = Nanoc::Int::DependencyTracker.new(new_items)
# Load
- tracker.load_graph
+ tracker.load
# Check loaded graph
assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
assert_contains_exactly [items[2], nil], tracker.objects_causing_outdatedness_of(items[1])
assert_empty tracker.objects_causing_outdatedness_of(items[2])
@@ -186,25 +186,25 @@
items[0].stubs(:reference).returns([:item, '/aaa/'])
items[1].stubs(:reference).returns([:item, '/bbb/'])
items[2].stubs(:reference).returns([:item, '/ccc/'])
# Create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Record some dependencies
tracker.record_dependency(items[0], items[1])
tracker.record_dependency(items[1], nil)
# Store
- tracker.store_graph
+ tracker.store
assert File.file?(tracker.filename)
# Re-create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Load
- tracker.load_graph
+ tracker.load
# Check loaded graph
assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
assert_contains_exactly [nil], tracker.objects_causing_outdatedness_of(items[1])
end
@@ -216,25 +216,25 @@
items[0].stubs(:reference).returns([:item, '/aaa/'])
items[1].stubs(:reference).returns([:item, '/bbb/'])
items[2].stubs(:reference).returns([:item, '/ccc/'])
# Create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Record some dependencies
tracker.record_dependency(items[0], items[1])
tracker.record_dependency(nil, items[2])
# Store
- tracker.store_graph
+ tracker.store
assert File.file?(tracker.filename)
# Re-create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Load
- tracker.load_graph
+ tracker.load
# Check loaded graph
assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])
assert_empty tracker.objects_causing_outdatedness_of(items[1])
end
@@ -242,10 +242,10 @@
def test_forget_dependencies_for
# Mock items
items = [mock, mock, mock]
# Create
- tracker = Nanoc::DependencyTracker.new(items)
+ tracker = Nanoc::Int::DependencyTracker.new(items)
# Record some dependencies
tracker.record_dependency(items[0], items[1])
tracker.record_dependency(items[1], items[2])
assert_contains_exactly [items[1]], tracker.objects_causing_outdatedness_of(items[0])