Sha256: 24fead40223dd8ef25c50f79aebb2f14fd2812b6373e4bdee1730cc3c37b62a6
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
require 'helper' require 'cassanity/set_removal' describe Cassanity::SetRemoval do describe "self named helper method" do it "returns instance" do Cassanity::SetRemoval('foo').should eq(described_class.new('foo')) end end describe "#initialize" do context "with value" do before do @instance = described_class.new('foo') end it "sets value" do @instance.value.should eq(Set['foo']) end it "sets symbol" do @instance.symbol.should be(:-) end end context "with multiples values" do before do @instance = described_class.new('foo', 'bar') end it "sets values" do @instance.value.should eq(Set['foo', 'bar']) end end context "without value" do it "raises error" do expect { subject.value }.to raise_error(ArgumentError, "value cannot be nil") end end context "with nil" do it "raises error" do expect { described_class.new(nil) }.to raise_error(ArgumentError, "value cannot be nil") end end end shared_examples_for "set_removal equality" do |method_name| it "returns true for same class and value" do instance = described_class.new('foo') other = described_class.new('foo') instance.send(method_name, other).should be_true end it "returns false for same class and different value" do instance = described_class.new('foo') other = described_class.new('bar') instance.send(method_name, other).should be_false end it "returns false for different class" do instance = described_class.new('foo') other = Object.new instance.send(method_name, other).should be_false end end describe "#eql?" do include_examples "set_removal equality", :eql? end describe "#==" do include_examples "set_removal equality", :== end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cassanity-0.6.0 | spec/unit/cassanity/set_removal_spec.rb |