require "test_helper" describe ObjectIdentifier::Deidentifier do describe ".deidentify" do it "returns the object, GIVEN just an :id attribute" do subject = OpenStruct.new(id: 1) result = ObjectIdentifier::Deidentifier.deidentify(subject.identify) result.must_be_kind_of OpenStruct result.must_equal subject end end describe "#determine_class" do it "returns the class string" do subject = "TheClass[id: 1]" result = ObjectIdentifier::Deidentifier.new("").send(:determine_class, subject) result.must_equal "TheClass" end end describe "#extract_attributes" do it "returns the class string" do subject = "TheClass[id: 1]" result = ObjectIdentifier::Deidentifier.new("").send(:extract_attributes, subject) result.must_equal({ id: 1 }.stringify_keys) end end end