Skip to content

Commit 62d9f5f

Browse files
committed
Migrate to rspec3 matchers
1 parent ed97faf commit 62d9f5f

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

spec/unit/provider/oratab/parsed_spec.rb

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,88 +16,88 @@
1616
:ensure => :present,
1717
:home => '/u01/app/oracle/product/9.2.0.1.0',
1818
:atboot => :yes,
19-
:description => 'managed by puppet',
19+
:description => 'managed by puppet'
2020
)
2121
end
2222

2323
[:destroy, :create, :exists?].each do |method|
2424
it "should respond to #{method}" do
25-
provider.should respond_to method
25+
expect(provider).to respond_to method
2626
end
2727
end
2828

2929
[:home, :atboot, :description].each do |property|
3030
it "should have getter and setter for property #{property}" do
31-
provider.should respond_to property
32-
provider.should respond_to "#{property}=".intern
31+
expect(provider).to respond_to property
32+
expect(provider).to respond_to "#{property}=".intern
3333
end
3434
end
3535

3636
describe "when parsing a line" do
3737

3838
describe "with no description" do
3939
it "should capture the name" do
40-
described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:N')[:name].should == 'TEST'
41-
described_class.parse_line('TEST_01:/app/oracle/db/11.2/db_1:N')[:name].should == 'TEST_01'
40+
expect(described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:N')[:name]).to eq('TEST')
41+
expect(described_class.parse_line('TEST_01:/app/oracle/db/11.2/db_1:N')[:name]).to eq('TEST_01')
4242
end
4343

4444
it "should capture the home directory" do
45-
described_class.parse_line('TEST:/db_1:N')[:home].should == '/db_1'
46-
described_class.parse_line('TEST:/db_1:Y')[:home].should == '/db_1'
47-
described_class.parse_line('TEST_01:/app/oracle/db/11.2/db_1:Y')[:home].should == '/app/oracle/db/11.2/db_1'
45+
expect(described_class.parse_line('TEST:/db_1:N')[:home]).to eq('/db_1')
46+
expect(described_class.parse_line('TEST:/db_1:Y')[:home]).to eq('/db_1')
47+
expect(described_class.parse_line('TEST_01:/app/oracle/db/11.2/db_1:Y')[:home]).to eq('/app/oracle/db/11.2/db_1')
4848
end
4949

5050
it "should capture the atboot flag" do
51-
described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:N')[:atboot].should == :no
52-
described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:Y')[:atboot].should == :yes
51+
expect(described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:N')[:atboot]).to eq(:no)
52+
expect(described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:Y')[:atboot]).to eq(:yes)
5353
end
5454
end
5555

5656
describe "with a description" do
5757
it "should capture the name" do
58-
described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:N # fancy comment')[:name].should == 'TEST'
59-
described_class.parse_line('TEST_01:/app/oracle/db/11.2/db_1:N # even ## fancier')[:name].should == 'TEST_01'
58+
expect(described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:N # fancy comment')[:name]).to eq('TEST')
59+
expect(described_class.parse_line('TEST_01:/app/oracle/db/11.2/db_1:N # even ## fancier')[:name]).to eq('TEST_01')
6060
end
6161
it "should capture the home directory" do
62-
described_class.parse_line('TEST:/db_1:N # fancy comment')[:home].should == '/db_1'
63-
described_class.parse_line('TEST_01:/app/oracle/db/11.2/db_1:Y# even ## fancier')[:home].should == '/app/oracle/db/11.2/db_1'
62+
expect(described_class.parse_line('TEST:/db_1:N # fancy comment')[:home]).to eq('/db_1')
63+
expect(described_class.parse_line('TEST_01:/app/oracle/db/11.2/db_1:Y# even ## fancier')[:home]).to eq('/app/oracle/db/11.2/db_1')
6464
end
6565
it "should capture the atboot flag" do
66-
described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:N # fancy comment')[:atboot].should == :no
67-
described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:Y## even ## fancier')[:atboot].should == :yes
66+
expect(described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:N # fancy comment')[:atboot]).to eq(:no)
67+
expect(described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:Y## even ## fancier')[:atboot]).to eq(:yes)
6868
end
6969
it "should capture the description" do
70-
described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:N # fancy comment')[:description].should == 'fancy comment'
71-
described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:Y## even ## fancier')[:description].should == '# even ## fancier'
70+
expect(described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:N # fancy comment')[:description]).to eq('fancy comment')
71+
expect(described_class.parse_line('TEST:/app/oracle/db/11.2/db_1:Y## even ## fancier')[:description]).to eq('# even ## fancier')
7272
end
7373
end
7474
end
7575

7676
describe "when calling instances" do
7777
before :each do
7878
@instances = described_class.instances
79-
@instances.size.should == 3
79+
expect(@instances.size).to eq(3)
8080
end
8181

8282
it "should be able to get the first entry" do
83-
@instances[0].get(:name).should == 'TEST'
84-
@instances[0].get(:home).should == '/app/oracle/db/11.2/db_1'
85-
@instances[0].get(:atboot).should == :no
86-
@instances[0].get(:description).should == 'line added by Agent'
83+
expect(@instances[0].get(:name)).to eq('TEST')
84+
expect(@instances[0].get(:home)).to eq('/app/oracle/db/11.2/db_1')
85+
expect(@instances[0].get(:atboot)).to eq(:no)
86+
expect(@instances[0].get(:description)).to eq('line added by Agent')
8787
end
8888

8989
it "should be able to get the second entry" do
90-
@instances[1].get(:name).should == 'PROD'
91-
@instances[1].get(:home).should == '/app/oracle/db/11.2/db_2'
92-
@instances[1].get(:atboot).should == :yes
93-
@instances[1].get(:description).should == :absent
90+
expect(@instances[1].get(:name)).to eq('PROD')
91+
expect(@instances[1].get(:home)).to eq('/app/oracle/db/11.2/db_2')
92+
expect(@instances[1].get(:atboot)).to eq(:yes)
93+
expect(@instances[1].get(:description)).to eq(:absent)
9494
end
9595

9696
it "should be able to get the third entry" do
97-
@instances[2].get(:name).should == 'DR'
98-
@instances[2].get(:home).should == '/app/oracle/db/11.2/db_4'
99-
@instances[2].get(:atboot).should == :no
100-
@instances[2].get(:description).should == 'i am still # an inline comment'
97+
expect(@instances[2].get(:name)).to eq('DR')
98+
expect(@instances[2].get(:home)).to eq('/app/oracle/db/11.2/db_4')
99+
expect(@instances[2].get(:atboot)).to eq(:no)
100+
expect(@instances[2].get(:description)).to eq('i am still # an inline comment')
101101
end
102102
end
103103

spec/unit/type/oratab_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
describe Puppet::Type.type(:oratab) do
66

77
it "should have :name as its keyattribute" do
8-
described_class.key_attributes.should == [:name]
8+
expect(described_class.key_attributes).to eq([:name])
99
end
1010

1111
describe "when validating attributes" do
1212
[:name, :provider].each do |param|
1313
it "should have a #{param} parameter" do
14-
described_class.attrtype(param).should == :param
14+
expect(described_class.attrtype(param)).to eq(:param)
1515
end
1616
end
1717

1818
[:ensure, :home, :atboot, :description, :target].each do |property|
1919
it "should have a #{property} property" do
20-
described_class.attrtype(property).should == :property
20+
expect(described_class.attrtype(property)).to eq(:property)
2121
end
2222
end
2323
end
@@ -82,10 +82,10 @@
8282
expect { described_class.new(:name => 'TEST01E', :atboot => :N) }.to_not raise_error
8383
end
8484
it "should alias Y to yes" do
85-
described_class.new(:name => 'TEST01E', :atboot => :Y)[:atboot].should == :yes
85+
expect(described_class.new(:name => 'TEST01E', :atboot => :Y)[:atboot]).to eq(:yes)
8686
end
8787
it "should alias N to no" do
88-
described_class.new(:name => 'TEST01E', :atboot => :N)[:atboot].should == :no
88+
expect(described_class.new(:name => 'TEST01E', :atboot => :N)[:atboot]).to eq(:no)
8989
end
9090
it "should not support other values" do
9191
expect { described_class.new(:name => 'TEST01E', :atboot => :yess) }.to raise_error(Puppet::Error, /Invalid value/)

0 commit comments

Comments
 (0)