Skip to content

Commit c56e399

Browse files
committed
Better error message on wrong API usage
1 parent 717959f commit c56e399

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/abstract_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def method_missing(*args, &block)
9797
comment_builder.content comment.content
9898
end
9999
100-
Received #{args.length - 1} argument#{'s' if args.length > 2} #{block ? "with a block" : "without a block"}.
100+
Received `#{args[0]}' with #{args.length - 1} argument#{'s' if args.length > 2} #{block ? "with a block" : "without a block"}.
101101
EOF
102102
end
103103
end

spec/abstract_builder_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@
240240
subject.people people, invalid_option: true do |builder, person|
241241
builder.name person.name
242242
end
243-
}.to raise_error(ArgumentError, /Expected 1 argument without a block, 0 arguments with a block or 1 argument with a block.+Received 2 arguments with a block./m)
243+
}.to raise_error(ArgumentError, /Expected 1 argument without a block, 0 arguments with a block or 1 argument with a block.+Received `people' with 2 arguments with a block./m)
244244
end
245245
end
246246

0 commit comments

Comments
 (0)