2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../spec_helper'
|
2017-05-07 08:04:49 -04:00
|
|
|
require 'set'
|
|
|
|
|
|
|
|
describe "Set#^" do
|
|
|
|
before :each do
|
|
|
|
@set = Set[1, 2, 3, 4]
|
|
|
|
end
|
|
|
|
|
2019-02-07 11:35:33 -05:00
|
|
|
it "returns a new Set containing elements that are not in both self and the passed Enumerable" do
|
2017-05-07 08:04:49 -04:00
|
|
|
(@set ^ Set[3, 4, 5]).should == Set[1, 2, 5]
|
|
|
|
(@set ^ [3, 4, 5]).should == Set[1, 2, 5]
|
|
|
|
end
|
|
|
|
|
|
|
|
it "raises an ArgumentError when passed a non-Enumerable" do
|
2019-07-27 06:40:09 -04:00
|
|
|
-> { @set ^ 3 }.should raise_error(ArgumentError)
|
|
|
|
-> { @set ^ Object.new }.should raise_error(ArgumentError)
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|
|
|
|
end
|