require File.expand_path("#{File.dirname(__FILE__)}/test_helper") require 'cgi' module CRP describe ResultMapper do describe :to_message do describe "when result code is 1" do it "returns the approved message" do ResultMapper.to_message(1).must_equal("Approved") end end describe "when result code is 2" do it "returns the updated message" do ResultMapper.to_message(2).must_equal("Updated") end end describe "when result code is 3" do it "returns the denied message" do ResultMapper.to_message(3).must_equal("Denied") end end describe "when result code is 31" do it "returns the deletion requested message" do ResultMapper.to_message(31).must_equal("Deletion requested") end end describe "when result code is 32" do it "returns the underaged message" do ResultMapper.to_message(32).must_equal("Underaged") end end describe "when result code is 33" do it "returns the angry customer message" do ResultMapper.to_message(33).must_equal("Angry customer") end end describe "when result code is 34" do it "returns the commercial message" do ResultMapper.to_message(34).must_equal("Commercial") end end describe "when result code is 61" do it "returns the G-rated message" do ResultMapper.to_message(61).must_equal("G-rated") end end describe "when result code is 62" do it "returns the sexual message" do ResultMapper.to_message(62).must_equal("Sexual") end end describe "when result code is 63" do it "returns the explicit message" do ResultMapper.to_message(63).must_equal("Explicit") end end describe "when result code is 64" do it "returns the hardcore message" do ResultMapper.to_message(64).must_equal("Hardcore") end end describe "when result code is 99" do it "returns the irrelevant message" do ResultMapper.to_message(99).must_equal("Irrelevant") end end describe "when no code is given" do it "returns an empty string" do ResultMapper.to_message(nil).must_equal("") end end end end end