Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double snapshot creation error #547

Merged
merged 1 commit into from May 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/nanoc/base/compilation/item_rep_recorder_proxy.rb
Expand Up @@ -70,7 +70,7 @@ def snapshot(snapshot_name, params = {})

# Count
existing = Set.new
names = @rule_memory.select { |r| r[0] == :snapshot }.map { |r| r[2] }
names = @rule_memory.select { |r| r[0] == :snapshot }.map { |r| r[1] }
names.each do |n|
if existing.include?(n)
raise Nanoc::Errors::CannotCreateMultipleSnapshotsWithSameName.new(@item_rep, snapshot_name)
Expand Down
19 changes: 19 additions & 0 deletions test/base/test_item_rep_recorder_proxy.rb
@@ -0,0 +1,19 @@
# encoding: utf-8

class Nanoc::ItemRepRecorderProxyTest < Nanoc::TestCase
def test_double_names
proxy = Nanoc::ItemRepRecorderProxy.new(mock)

proxy.snapshot(:foo, stuff: :giraffe)
assert_raises(Nanoc::Errors::CannotCreateMultipleSnapshotsWithSameName) do
proxy.snapshot(:foo, stuff: :donkey)
end
end

def test_double_params
proxy = Nanoc::ItemRepRecorderProxy.new(mock)

proxy.snapshot(:foo)
proxy.snapshot(:bar)
end
end