Sha256: 9dd19c58c8a6675d19053d5b7d92337c53d6669a41ce8fe705e476f3a7244721
Contents?: true
Size: 1.01 KB
Versions: 6
Compression:
Stored size: 1.01 KB
Contents
require "spec_helper" describe Clamp::Messages do describe "message" do before do Clamp.messages = { :too_many_arguments => "Way too many!", :custom_message => "Say %<what>s to %<whom>s" } end after do Clamp.clear_messages! end it "allows setting custom messages" do expect(Clamp.message(:too_many_arguments)).to eql "Way too many!" end it "fallbacks to a default message" do expect(Clamp.message(:no_value_provided)).to eql "no value provided" end it "formats the message" do expect(Clamp.message(:custom_message, :what => "hello", :whom => "Clamp")).to eql "Say hello to Clamp" end end describe "clear_messages!" do it "clears messages to the defualt state" do default_msg = Clamp.message(:too_many_arguments).clone Clamp.messages = { :too_many_arguments => "Way too many!" } Clamp.clear_messages! expect(Clamp.message(:too_many_arguments)).to eql default_msg end end end
Version data entries
6 entries across 6 versions & 1 rubygems