Alexandros Kosiaris has submitted this change and it was merged.
Change subject: wmflib: update spec to rspec 3.x
......................................................................
wmflib: update spec to rspec 3.x
The 'should' syntax is deprecated in favor of 'is_expected'. One
deprecation is left around in role_spec which is related to the
stubbing.
Change-Id: I1704db4936fb4921f25b6b79e909c90484e8d088
---
M modules/wmflib/spec/functions/ensure_mounted_spec.rb
M modules/wmflib/spec/functions/hash_deselect_re_spec.rb
M modules/wmflib/spec/functions/hash_select_re_spec.rb
3 files changed, 37 insertions(+), 25 deletions(-)
Approvals:
Hashar: Looks good to me, but someone else must approve
Alexandros Kosiaris: Verified; Looks good to me, approved
diff --git a/modules/wmflib/spec/functions/ensure_mounted_spec.rb
b/modules/wmflib/spec/functions/ensure_mounted_spec.rb
index a5d0fd5..0923893 100644
--- a/modules/wmflib/spec/functions/ensure_mounted_spec.rb
+++ b/modules/wmflib/spec/functions/ensure_mounted_spec.rb
@@ -2,35 +2,35 @@
describe "the ensure_mounted function" do
it "should exist" do
- Puppet::Parser::Functions.function("ensure_mounted").should ==
"function_ensure_mounted"
+ expect(Puppet::Parser::Functions.function("ensure_mounted")).to
eq("function_ensure_mounted")
end
it "should raise a ParseError if there are less than 1 arguments" do
- ->{ scope.function_ensure_mounted([]) }.should(raise_error(ArgumentError))
+ expect {
+ scope.function_ensure_mounted([])
+ }.to raise_error(ArgumentError)
end
it "should raise a ParseError if there are more than 1 arguments" do
- ->{ scope.function_ensure_mounted(['a', 'b'])
}.should(raise_error(ArgumentError))
+ expect {
+ scope.function_ensure_mounted(['a', 'b'])
+ }.to raise_error(ArgumentError)
end
it "should return 'mounted' for param 'present'" do
- result = scope.function_ensure_mounted(['present'])
- result.should(eq('mounted'))
+ expect(scope.function_ensure_mounted(['present'])).to eq('mounted')
end
it "should return 'mounted' for param 'true'" do
- result = scope.function_ensure_mounted([true])
- result.should(eq('mounted'))
+ expect(scope.function_ensure_mounted([true])).to eq('mounted')
end
it "should return 'absent' for param 'absent'" do
- result = scope.function_ensure_mounted(['absent'])
- result.should(eq('absent'))
+ expect(scope.function_ensure_mounted(['absent'])).to eq('absent')
end
it "should return 'false' for param 'false'" do
- result = scope.function_ensure_mounted([false])
- result.should(eq(false))
+ expect(scope.function_ensure_mounted([false])).to eq(false)
end
end
diff --git a/modules/wmflib/spec/functions/hash_deselect_re_spec.rb
b/modules/wmflib/spec/functions/hash_deselect_re_spec.rb
index 7cde398..805310c 100644
--- a/modules/wmflib/spec/functions/hash_deselect_re_spec.rb
+++ b/modules/wmflib/spec/functions/hash_deselect_re_spec.rb
@@ -2,24 +2,30 @@
describe "the hash_deselect_re function" do
it "should exist" do
- Puppet::Parser::Functions.function("hash_deselect_re").should ==
"function_hash_deselect_re"
+ expect(Puppet::Parser::Functions.function("hash_deselect_re")).to
eq("function_hash_deselect_re")
end
it "should raise a ParseError if there are less than 2 arguments" do
- ->{ scope.function_hash_deselect_re(['a'])
}.should(raise_error(Puppet::ParseError))
+ expect {
+ scope.function_hash_deselect_re(['a'])
+ }.to raise_error(Puppet::ParseError)
end
it "should raise a ParseError if there are more than 2 arguments" do
- ->{ scope.function_hash_deselect_re(['a', 'b', 'c'])
}.should(raise_error(Puppet::ParseError))
+ expect {
+ scope.function_hash_deselect_re(['a', 'b', 'c'])
+ }.to raise_error(Puppet::ParseError)
end
it "should select the right keys (simple)" do
- result = scope.function_hash_deselect_re(['^a', {'abc' => 1, 'def' => 2,
'asdf' => 3}])
- result.should(eq({'def' => 2}))
+ expect(
+ scope.function_hash_deselect_re(['^a', {'abc' => 1, 'def' => 2, 'asdf'
=> 3}])
+ ).to eq({'def' => 2})
end
it "should select the right keys (neg lookahead)" do
- result = scope.function_hash_deselect_re(['^(?!a)', {'abc' => 1, 'def' =>
2, 'asdf' => 3}])
- result.should(eq({'abc' => 1, 'asdf' => 3}))
+ expect(
+ scope.function_hash_deselect_re(['^(?!a)', {'abc' => 1, 'def' => 2,
'asdf' => 3}])
+ ).to eq({'abc' => 1, 'asdf' => 3})
end
end
diff --git a/modules/wmflib/spec/functions/hash_select_re_spec.rb
b/modules/wmflib/spec/functions/hash_select_re_spec.rb
index 9df67c0..cc86663 100644
--- a/modules/wmflib/spec/functions/hash_select_re_spec.rb
+++ b/modules/wmflib/spec/functions/hash_select_re_spec.rb
@@ -2,24 +2,30 @@
describe "the hash_select_re function" do
it "should exist" do
- Puppet::Parser::Functions.function("hash_select_re").should ==
"function_hash_select_re"
+ expect(Puppet::Parser::Functions.function("hash_select_re")).to
eq("function_hash_select_re")
end
it "should raise a ParseError if there are less than 2 arguments" do
- ->{ scope.function_hash_select_re(['a'])
}.should(raise_error(Puppet::ParseError))
+ expect {
+ scope.function_hash_select_re(['a'])
+ }.to raise_error(Puppet::ParseError)
end
it "should raise a ParseError if there are more than 2 arguments" do
- ->{ scope.function_hash_select_re(['a', 'b', 'c'])
}.should(raise_error(Puppet::ParseError))
+ expect {
+ scope.function_hash_select_re(['a', 'b', 'c'])
+ }.to raise_error(Puppet::ParseError)
end
it "should select the right keys (simple)" do
- result = scope.function_hash_select_re(['^a', {'abc' => 1, 'def' => 2,
'asdf' => 3}])
- result.should(eq({'abc' => 1, 'asdf' => 3}))
+ expect(
+ scope.function_hash_select_re(['^a', {'abc' => 1, 'def' => 2, 'asdf' =>
3}])
+ ).to eq({'abc' => 1, 'asdf' => 3})
end
it "should select the right keys (neg lookahead)" do
- result = scope.function_hash_select_re(['^(?!a)', {'abc' => 1, 'def' => 2,
'asdf' => 3}])
- result.should(eq({'def' => 2}))
+ expect(
+ scope.function_hash_select_re(['^(?!a)', {'abc' => 1, 'def' => 2, 'asdf'
=> 3}])
+ ).to eq({'def' => 2})
end
end
--
To view, visit https://gerrit.wikimedia.org/r/297132
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1704db4936fb4921f25b6b79e909c90484e8d088
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits