File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,12 @@ def initialize(*paths)
44 end
55
66 def prepend ( *paths )
7- @paths . unshift ( * parse ( *paths ) )
7+ @paths = parse ( *paths , * @paths )
88 self
99 end
1010
1111 def append ( *paths )
12- @paths . concat ( parse ( *paths ) )
12+ @paths = parse ( *@ paths, * paths )
1313 self
1414 end
1515
Original file line number Diff line number Diff line change 1313 it "splits an existing PATH" do
1414 expect ( described_class . new ( "/path1:/path2" ) ) . to eq ( [ "/path1" , "/path2" ] )
1515 end
16+
17+ it "removes duplicates" do
18+ expect ( described_class . new ( "/path1" , "/path1" ) ) . to eq ( "/path1" )
19+ end
1620 end
1721
1822 describe "#to_ary" do
3135 it "prepends a path to a PATH" do
3236 expect ( described_class . new ( "/path1" ) . prepend ( "/path2" ) . to_str ) . to eq ( "/path2:/path1" )
3337 end
38+
39+ it "removes duplicates" do
40+ expect ( described_class . new ( "/path1" ) . prepend ( "/path1" ) . to_str ) . to eq ( "/path1" )
41+ end
3442 end
3543
3644 describe "#append" do
3745 it "prepends a path to a PATH" do
3846 expect ( described_class . new ( "/path1" ) . append ( "/path2" ) . to_str ) . to eq ( "/path1:/path2" )
3947 end
48+
49+ it "removes duplicates" do
50+ expect ( described_class . new ( "/path1" ) . append ( "/path1" ) . to_str ) . to eq ( "/path1" )
51+ end
4052 end
4153
4254 describe "#validate" do
You can’t perform that action at this time.
0 commit comments