Sha256: a522867978bcd5233362c4389c1573b1006f724882357677dfc965b7f4708fb2
Contents?: true
Size: 1.44 KB
Versions: 7
Compression:
Stored size: 1.44 KB
Contents
require File.expand_path("#{File.dirname(__FILE__)}/test_helper") require 'cgi' module CRP describe GenderMapper do describe :to_code do describe "when the gender is unknown" do it "returns code 0" do GenderMapper.to_code(:unknown).must_equal(0) end end describe "when the gender is female" do it "returns code 1" do GenderMapper.to_code(:female).must_equal(1) end end describe "when the gender is male" do it "returns code 2" do GenderMapper.to_code(:male).must_equal(2) end end describe "when the gender is not :unknown, :female or :male" do it "returns code 0" do GenderMapper.to_code(:alien).must_equal(0) end end end describe :to_name do describe "when the code is 0" do it "returns unknown as gender" do GenderMapper.to_name(0).must_equal(:unknown) end end describe "when the code is 1" do it "returns female as gender" do GenderMapper.to_name(1).must_equal(:female) end end describe "when the code is 2" do it "returns male as gender" do GenderMapper.to_name(2).must_equal(:male) end end describe "when the code is not 0, 1 or 2" do it "returns :unknown as gender" do GenderMapper.to_name(99).must_equal(:unknown) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems