Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Commit

Permalink
Piston::WorkingCopy#recall returns saved values.
Browse files Browse the repository at this point in the history
  • Loading branch information
francois committed Apr 17, 2008
1 parent b6776ee commit e90f935
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/piston/working_copy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def after_remember(path)
end

# Recalls a Hash of values from the working copy.
# The expected keys are passed as parameters.
def recall(keys)
def recall
YAML.load(File.read(yaml_path))
end

def finalize
Expand All @@ -110,4 +110,3 @@ def yaml_path
end
end
end

7 changes: 7 additions & 0 deletions test/unit/test_working_copy_rememberance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,11 @@ def test_remember_with_two_args_remembers_handler_values_separately
actual = YAML.load((@wcdir + ".piston.yml").read)
assert_equal values.merge("format" => 1, "handler" => handler_values), actual
end

def test_recall_returns_hash_of_values
values = {"a" => "b", "handler" => {"b" => "c"}}
File.expects(:read).with(@wcdir + ".piston.yml").returns(:data)
YAML.expects(:load).with(:data).returns(values)
assert_equal values, @wc.recall
end
end

0 comments on commit e90f935

Please sign in to comment.