aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib
diff options
context:
space:
mode:
authorRobert2017-05-02 18:17:04 +0200
committerRobert2017-05-02 18:17:04 +0200
commit7ce3dfa2770b2022f909164a0f24f8f38d8d8fb2 (patch)
tree93e383c98aba285eed180bb2c3cd9c0893f6ec95 /spec/lib
parenta305b724d52320adb304209b52924a29cfb81ab2 (diff)
downloadchouette-core-7ce3dfa2770b2022f909164a0f24f8f38d8d8fb2.tar.bz2
Refs #3178; Simplecov bogus config (almost) fixed
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/range_ext_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/lib/range_ext_spec.rb b/spec/lib/range_ext_spec.rb
new file mode 100644
index 000000000..0e2365b5e
--- /dev/null
+++ b/spec/lib/range_ext_spec.rb
@@ -0,0 +1,17 @@
+RSpec.describe Range do
+ context "intersection" do
+ it "is nil (sic) for two distinct ranges" do
+ expect( (1..2).intersection(3..4) ).to be_nil
+ end
+
+ it "is the smaller of two if one is part of the other" do
+ expect( (1..2).intersection(0..3) ).to eq 1..2
+ expect( (0..2).intersection(1..2) ).to eq 1..2
+ end
+
+ it "is the intersection otherwise" do
+ expect( (1..3) & (2..4) ).to eq 2..3
+ expect( (2..4) & (1..3) ).to eq 2..3
+ end
+ end
+end