ridley 4.0.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/Gemfile +1 -1
  4. data/README.md +4 -4
  5. data/Rakefile +1 -0
  6. data/lib/ridley/chef/config.rb +5 -5
  7. data/lib/ridley/chef/cookbook/metadata.rb +59 -14
  8. data/lib/ridley/chef/cookbook/syntax_check.rb +57 -19
  9. data/lib/ridley/chef/cookbook.rb +1 -1
  10. data/lib/ridley/chef/digester.rb +3 -1
  11. data/lib/ridley/client.rb +6 -3
  12. data/lib/ridley/connection.rb +5 -4
  13. data/lib/ridley/errors.rb +1 -0
  14. data/lib/ridley/helpers.rb +10 -0
  15. data/lib/ridley/mixin/params_validate.rb +4 -0
  16. data/lib/ridley/resources/cookbook_resource.rb +14 -2
  17. data/lib/ridley/version.rb +1 -1
  18. data/ridley.gemspec +5 -5
  19. data/spec/acceptance/client_resource_spec.rb +12 -12
  20. data/spec/acceptance/cookbook_resource_spec.rb +15 -15
  21. data/spec/acceptance/data_bag_item_resource_spec.rb +14 -14
  22. data/spec/acceptance/data_bag_resource_spec.rb +4 -4
  23. data/spec/acceptance/environment_resource_spec.rb +14 -14
  24. data/spec/acceptance/node_resource_spec.rb +15 -15
  25. data/spec/acceptance/role_resource_spec.rb +14 -14
  26. data/spec/acceptance/sandbox_resource_spec.rb +3 -3
  27. data/spec/acceptance/search_resource_spec.rb +6 -6
  28. data/spec/acceptance/user_resource_spec.rb +21 -21
  29. data/spec/support/each_matcher.rb +2 -2
  30. data/spec/support/filepath_matchers.rb +2 -2
  31. data/spec/support/shared_examples/ridley_resource.rb +39 -39
  32. data/spec/unit/ridley/chef/cookbook/metadata_spec.rb +8 -8
  33. data/spec/unit/ridley/chef/cookbook/syntax_check_spec.rb +15 -15
  34. data/spec/unit/ridley/chef/cookbook_spec.rb +159 -114
  35. data/spec/unit/ridley/chef/digester_spec.rb +2 -2
  36. data/spec/unit/ridley/chef_object_spec.rb +35 -35
  37. data/spec/unit/ridley/chef_objects/client_object_spec.rb +2 -2
  38. data/spec/unit/ridley/chef_objects/cookbook_object_spec.rb +12 -12
  39. data/spec/unit/ridley/chef_objects/data_bag_item_object_spec.rb +7 -7
  40. data/spec/unit/ridley/chef_objects/data_bag_object_spec.rb +4 -1
  41. data/spec/unit/ridley/chef_objects/environment_object_spec.rb +10 -10
  42. data/spec/unit/ridley/chef_objects/node_object_spec.rb +28 -28
  43. data/spec/unit/ridley/chef_objects/role_object_spec.rb +10 -10
  44. data/spec/unit/ridley/chef_objects/sandbox_object_spec.rb +6 -6
  45. data/spec/unit/ridley/client_spec.rb +59 -21
  46. data/spec/unit/ridley/connection_spec.rb +7 -7
  47. data/spec/unit/ridley/errors_spec.rb +3 -3
  48. data/spec/unit/ridley/middleware/chef_auth_spec.rb +2 -2
  49. data/spec/unit/ridley/middleware/chef_response_spec.rb +29 -29
  50. data/spec/unit/ridley/middleware/parse_json_spec.rb +14 -14
  51. data/spec/unit/ridley/mixins/from_file_spec.rb +3 -3
  52. data/spec/unit/ridley/resource_spec.rb +5 -5
  53. data/spec/unit/ridley/resources/cookbook_resource_spec.rb +21 -21
  54. data/spec/unit/ridley/resources/data_bag_item_resource_spec.rb +1 -1
  55. data/spec/unit/ridley/resources/data_bag_resource_spec.rb +6 -3
  56. data/spec/unit/ridley/resources/environment_resource_spec.rb +4 -4
  57. data/spec/unit/ridley/resources/role_resource_spec.rb +1 -1
  58. data/spec/unit/ridley/resources/sandbox_resource_spec.rb +7 -7
  59. data/spec/unit/ridley/resources/search_resource_spec.rb +22 -22
  60. data/spec/unit/ridley/sandbox_uploader_spec.rb +3 -3
  61. data/spec/unit/ridley_spec.rb +6 -6
  62. metadata +62 -64
  63. data/.ruby-version +0 -1
  64. data/lib/ridley/middleware/gzip.rb +0 -18
  65. data/spec/unit/ridley/middleware/gzip_spec.rb +0 -59
@@ -11,30 +11,30 @@ describe "User API operations", type: "wip" do
11
11
  before { chef_user("reset", admin: false) }
12
12
 
13
13
  it "returns a UserObject" do
14
- connection.user.find("reset").should be_a(Ridley::UserObject)
14
+ expect(connection.user.find("reset")).to be_a(Ridley::UserObject)
15
15
  end
16
16
  end
17
17
 
18
18
  context "when the server does not have the user" do
19
19
  it "returns a nil value" do
20
- connection.user.find("not_there").should be_nil
20
+ expect(connection.user.find("not_there")).to be_nil
21
21
  end
22
22
  end
23
23
  end
24
24
 
25
25
  describe "creating a user" do
26
26
  it "returns a Ridley::UserObject" do
27
- connection.user.create(name: "reset").should be_a(Ridley::UserObject)
27
+ expect(connection.user.create(name: "reset")).to be_a(Ridley::UserObject)
28
28
  end
29
29
 
30
30
  it "adds a user to the chef server" do
31
31
  old = connection.user.all.length
32
32
  connection.user.create(name: "reset")
33
- connection.user.all.should have(old + 1).items
33
+ expect(connection.user.all.size).to eq(old + 1)
34
34
  end
35
35
 
36
36
  it "has a value for #private_key" do
37
- connection.user.create(name: "reset").private_key.should_not be_nil
37
+ expect(connection.user.create(name: "reset").private_key).not_to be_nil
38
38
  end
39
39
  end
40
40
 
@@ -42,13 +42,13 @@ describe "User API operations", type: "wip" do
42
42
  before { chef_user("reset", admin: false) }
43
43
 
44
44
  it "returns a Ridley::UserObject object" do
45
- connection.user.delete("reset").should be_a(Ridley::UserObject)
45
+ expect(connection.user.delete("reset")).to be_a(Ridley::UserObject)
46
46
  end
47
47
 
48
48
  it "removes the user from the server" do
49
49
  connection.user.delete("reset")
50
50
 
51
- connection.user.find("reset").should be_nil
51
+ expect(connection.user.find("reset")).to be_nil
52
52
  end
53
53
  end
54
54
 
@@ -59,12 +59,12 @@ describe "User API operations", type: "wip" do
59
59
  end
60
60
 
61
61
  it "returns an array of Ridley::UserObject objects" do
62
- connection.user.delete_all.should each be_a(Ridley::UserObject)
62
+ expect(connection.user.delete_all).to each be_a(Ridley::UserObject)
63
63
  end
64
64
 
65
65
  it "deletes all users from the remote" do
66
66
  connection.user.delete_all
67
- connection.user.all.should have(0).users
67
+ expect(connection.user.all.size).to eq(0)
68
68
  end
69
69
  end
70
70
 
@@ -75,11 +75,11 @@ describe "User API operations", type: "wip" do
75
75
  end
76
76
 
77
77
  it "returns an array of Ridley::UserObject objects" do
78
- connection.user.all.should each be_a(Ridley::UserObject)
78
+ expect(connection.user.all).to each be_a(Ridley::UserObject)
79
79
  end
80
80
 
81
81
  it "returns all of the users on the server" do
82
- connection.user.all.should have(3).items
82
+ expect(connection.user.all.size).to eq(3)
83
83
  end
84
84
  end
85
85
 
@@ -87,7 +87,7 @@ describe "User API operations", type: "wip" do
87
87
  before { chef_user("reset", admin: false) }
88
88
 
89
89
  it "returns a Ridley::UserObject object with a value for #private_key" do
90
- connection.user.regenerate_key("reset").private_key.should match(/^-----BEGIN RSA PRIVATE KEY-----/)
90
+ expect(connection.user.regenerate_key("reset").private_key).to match(/^-----BEGIN RSA PRIVATE KEY-----/)
91
91
  end
92
92
  end
93
93
 
@@ -95,20 +95,20 @@ describe "User API operations", type: "wip" do
95
95
  before { chef_user('reset', password: 'swordfish') }
96
96
 
97
97
  it "returns true when given valid username & password" do
98
- expect(connection.user.authenticate('reset', 'swordfish')).to be_true
98
+ expect(connection.user.authenticate('reset', 'swordfish')).to be_truthy
99
99
  end
100
100
 
101
101
  it "returns false when given valid username & invalid password" do
102
- expect(connection.user.authenticate('reset', "not a swordfish")).to be_false
102
+ expect(connection.user.authenticate('reset', "not a swordfish")).to be_falsey
103
103
  end
104
104
 
105
105
  it "returns false when given invalid username & valid password" do
106
- expect(connection.user.authenticate("someone-else", 'swordfish')).to be_false
106
+ expect(connection.user.authenticate("someone-else", 'swordfish')).to be_falsey
107
107
  end
108
108
 
109
109
  it "works also on a User object level" do
110
- expect(connection.user.find('reset').authenticate('swordfish')).to be_true
111
- expect(connection.user.find('reset').authenticate('not a swordfish')).to be_false
110
+ expect(connection.user.find('reset').authenticate('swordfish')).to be_truthy
111
+ expect(connection.user.find('reset').authenticate('not a swordfish')).to be_falsey
112
112
  end
113
113
  end
114
114
 
@@ -117,14 +117,14 @@ describe "User API operations", type: "wip" do
117
117
  subject { connection.user.find('reset') }
118
118
 
119
119
  it "changes the password with which user can authenticate" do
120
- expect(subject.authenticate('swordfish')).to be_true
121
- expect(subject.authenticate('salmon')).to be_false
120
+ expect(subject.authenticate('swordfish')).to be_truthy
121
+ expect(subject.authenticate('salmon')).to be_falsey
122
122
 
123
123
  subject.password = 'salmon'
124
124
  subject.save
125
125
 
126
- expect(subject.authenticate('swordfish')).to be_false
127
- expect(subject.authenticate('salmon')).to be_true
126
+ expect(subject.authenticate('swordfish')).to be_falsey
127
+ expect(subject.authenticate('salmon')).to be_truthy
128
128
  end
129
129
  end
130
130
  end
@@ -2,11 +2,11 @@ RSpec::Matchers.define :each do |check|
2
2
  match do |actual|
3
3
  actual.each_with_index do |index, o|
4
4
  @object = o
5
- index.should check
5
+ expect(index).to check
6
6
  end
7
7
  end
8
8
 
9
- failure_message_for_should do |actual|
9
+ failure_message do |actual|
10
10
  "at[#{@object}] #{check.failure_message_for_should}"
11
11
  end
12
12
  end
@@ -9,11 +9,11 @@ RSpec::Matchers.define :be_relative_path do
9
9
  end
10
10
  end
11
11
 
12
- failure_message_for_should do |given|
12
+ failure_message do |given|
13
13
  "Expected '#{given}' to be a relative path but got an absolute path."
14
14
  end
15
15
 
16
- failure_message_for_should_not do |given|
16
+ failure_message_when_negated do |given|
17
17
  "Expected '#{given}' to not be a relative path but got an absolute path."
18
18
  end
19
19
  end
@@ -9,8 +9,8 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
9
9
 
10
10
  describe "::all" do
11
11
  it "sends a get request for the class' resource_path using the given client" do
12
- response.stub(:body) { Hash.new }
13
- client.connection.should_receive(:get).with(subject.resource_path).and_return(response)
12
+ allow(response).to receive(:body) { Hash.new }
13
+ expect(client.connection).to receive(:get).with(subject.resource_path).and_return(response)
14
14
 
15
15
  subject.all(client)
16
16
  end
@@ -19,8 +19,8 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
19
19
  describe "::find" do
20
20
  it "sends a get request to the given client to the resource_path of the class for the given chef_id" do
21
21
  chef_id = "ridley_test"
22
- response.stub(:body) { Hash.new }
23
- client.connection.should_receive(:get).with("#{subject.resource_path}/#{chef_id}").and_return(response)
22
+ allow(response).to receive(:body) { Hash.new }
23
+ expect(client.connection).to receive(:get).with("#{subject.resource_path}/#{chef_id}").and_return(response)
24
24
 
25
25
  subject.find(client, chef_id)
26
26
  end
@@ -33,8 +33,8 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
33
33
  last_name: "winsor"
34
34
  }
35
35
 
36
- response.stub(:body) { attrs }
37
- client.connection.should_receive(:post).with(subject.resource_path, duck_type(:to_json)).and_return(response)
36
+ allow(response).to receive(:body) { attrs }
37
+ expect(client.connection).to receive(:post).with(subject.resource_path, duck_type(:to_json)).and_return(response)
38
38
 
39
39
  subject.create(client, attrs)
40
40
  end
@@ -42,17 +42,17 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
42
42
 
43
43
  describe "::delete" do
44
44
  it "sends a delete request to the given client using the includer's resource_path for the given string" do
45
- response.stub(:body) { Hash.new }
46
- client.connection.should_receive(:delete).with("#{subject.resource_path}/ridley-test").and_return(response)
45
+ allow(response).to receive(:body) { Hash.new }
46
+ expect(client.connection).to receive(:delete).with("#{subject.resource_path}/ridley-test").and_return(response)
47
47
 
48
48
  subject.delete(client, "ridley-test")
49
49
  end
50
50
 
51
51
  it "accepts an object that responds to 'chef_id'" do
52
52
  object = double("obj")
53
- object.stub(:chef_id) { "hello" }
54
- response.stub(:body) { Hash.new }
55
- client.connection.should_receive(:delete).with("#{subject.resource_path}/#{object.chef_id}").and_return(response)
53
+ allow(object).to receive(:chef_id) { "hello" }
54
+ allow(response).to receive(:body) { Hash.new }
55
+ expect(client.connection).to receive(:delete).with("#{subject.resource_path}/#{object.chef_id}").and_return(response)
56
56
 
57
57
  subject.delete(client, object)
58
58
  end
@@ -60,17 +60,17 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
60
60
 
61
61
  describe "::delete_all" do
62
62
  it "sends a delete request for every object in the collection" do
63
- pending
63
+ skip
64
64
  end
65
65
  end
66
66
 
67
67
  describe "::update" do
68
68
  it "sends a put request to the given client using the includer's resource_path with the given object" do
69
- subject.stub(:chef_id) { :name }
69
+ allow(subject).to receive(:chef_id) { :name }
70
70
  subject.attribute(:name)
71
71
  object = subject.new(name: "hello")
72
- response.stub(:body) { Hash.new }
73
- client.connection.should_receive(:put).with("#{subject.resource_path}/#{object.chef_id}", duck_type(:to_json)).and_return(response)
72
+ allow(response).to receive(:body) { Hash.new }
73
+ expect(client.connection).to receive(:put).with("#{subject.resource_path}/#{object.chef_id}", duck_type(:to_json)).and_return(response)
74
74
 
75
75
  subject.update(client, object)
76
76
  end
@@ -81,12 +81,12 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
81
81
 
82
82
  describe "#save" do
83
83
  context "when the object is valid" do
84
- before(:each) { subject.stub(:valid?).and_return(true) }
84
+ before(:each) { allow(subject).to receive(:valid?).and_return(true) }
85
85
 
86
86
  it "sends a create message to the implementing class" do
87
87
  updated = double('updated')
88
- updated.stub(:_attributes_).and_return(Hash.new)
89
- subject.class.should_receive(:create).with(client, subject).and_return(updated)
88
+ allow(updated).to receive(:_attributes_).and_return(Hash.new)
89
+ expect(subject.class).to receive(:create).with(client, subject).and_return(updated)
90
90
 
91
91
  subject.save
92
92
  end
@@ -94,10 +94,10 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
94
94
  context "when there is an HTTPConflict" do
95
95
  it "sends the update message to self" do
96
96
  updated = double('updated')
97
- updated.stub(:[]).and_return(Hash.new)
98
- updated.stub(:_attributes_).and_return(Hash.new)
99
- subject.class.should_receive(:create).and_raise(Ridley::Errors::HTTPConflict.new(updated))
100
- subject.should_receive(:update).and_return(updated)
97
+ allow(updated).to receive(:[]).and_return(Hash.new)
98
+ allow(updated).to receive(:_attributes_).and_return(Hash.new)
99
+ expect(subject.class).to receive(:create).and_raise(Ridley::Errors::HTTPConflict.new(updated))
100
+ expect(subject).to receive(:update).and_return(updated)
101
101
 
102
102
  subject.save
103
103
  end
@@ -105,12 +105,12 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
105
105
  end
106
106
 
107
107
  context "when the object is invalid" do
108
- before(:each) { subject.stub(:valid?).and_return(false) }
108
+ before(:each) { allow(subject).to receive(:valid?).and_return(false) }
109
109
 
110
110
  it "raises an InvalidResource error" do
111
- lambda {
111
+ expect {
112
112
  subject.save
113
- }.should raise_error(Ridley::Errors::InvalidResource)
113
+ }.to raise_error(Ridley::Errors::InvalidResource)
114
114
  end
115
115
  end
116
116
  end
@@ -119,31 +119,31 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
119
119
  context "when the object is valid" do
120
120
  let(:updated) do
121
121
  updated = double('updated')
122
- updated.stub(:[]).and_return(Hash.new)
123
- updated.stub(:_attributes_).and_return(Hash.new)
122
+ allow(updated).to receive(:[]).and_return(Hash.new)
123
+ allow(updated).to receive(:_attributes_).and_return(Hash.new)
124
124
  updated
125
125
  end
126
126
 
127
- before(:each) { subject.stub(:valid?).and_return(true) }
127
+ before(:each) { allow(subject).to receive(:valid?).and_return(true) }
128
128
 
129
129
  it "sends an update message to the implementing class" do
130
- subject.class.should_receive(:update).with(anything, subject).and_return(updated)
130
+ expect(subject.class).to receive(:update).with(anything, subject).and_return(updated)
131
131
  subject.update
132
132
  end
133
133
 
134
134
  it "returns true" do
135
- subject.class.should_receive(:update).with(anything, subject).and_return(updated)
136
- subject.update.should eql(true)
135
+ expect(subject.class).to receive(:update).with(anything, subject).and_return(updated)
136
+ expect(subject.update).to eql(true)
137
137
  end
138
138
  end
139
139
 
140
140
  context "when the object is invalid" do
141
- before(:each) { subject.stub(:valid?).and_return(false) }
141
+ before(:each) { allow(subject).to receive(:valid?).and_return(false) }
142
142
 
143
143
  it "raises an InvalidResource error" do
144
- lambda {
144
+ expect {
145
145
  subject.update
146
- }.should raise_error(Ridley::Errors::InvalidResource)
146
+ }.to raise_error(Ridley::Errors::InvalidResource)
147
147
  end
148
148
  end
149
149
  end
@@ -151,10 +151,10 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
151
151
  describe "#chef_id" do
152
152
  it "returns the value of the chef_id attribute" do
153
153
  subject.class.attribute(:name)
154
- subject.class.stub(:chef_id) { :name }
154
+ allow(subject.class).to receive(:chef_id) { :name }
155
155
  subject.mass_assign(name: "reset")
156
156
 
157
- subject.chef_id.should eql("reset")
157
+ expect(subject.chef_id).to eql("reset")
158
158
  end
159
159
  end
160
160
 
@@ -163,17 +163,17 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
163
163
 
164
164
  before(:each) do
165
165
  subject.class.attribute(:fake_attribute)
166
- subject.class.stub(:find).with(client, subject).and_return(updated_subject)
166
+ allow(subject.class).to receive(:find).with(client, subject).and_return(updated_subject)
167
167
  end
168
168
 
169
169
  it "returns itself" do
170
- subject.reload.should eql(subject)
170
+ expect(subject.reload).to eql(subject)
171
171
  end
172
172
 
173
173
  it "sets the attributes of self to include those of the reloaded object" do
174
174
  subject.reload
175
175
 
176
- subject.get_attribute(:fake_attribute).should eql("some_value")
176
+ expect(subject.get_attribute(:fake_attribute)).to eql("some_value")
177
177
  end
178
178
  end
179
179
  end
@@ -17,36 +17,36 @@ describe Ridley::Chef::Cookbook::Metadata do
17
17
  :choice => [ "test1", "test2" ],
18
18
  :default => "test1"
19
19
  }
20
- lambda {
20
+ expect {
21
21
  subject.attribute("test_cookbook/test", options)
22
- }.should_not raise_error
22
+ }.not_to raise_error
23
23
 
24
24
  options = {
25
25
  :type => "boolean",
26
26
  :choice => [ true, false ],
27
27
  :default => true
28
28
  }
29
- lambda {
29
+ expect {
30
30
  subject.attribute("test_cookbook/test", options)
31
- }.should_not raise_error
31
+ }.not_to raise_error
32
32
 
33
33
  options = {
34
34
  :type => "numeric",
35
35
  :choice => [ 1337, 420 ],
36
36
  :default => 1337
37
37
  }
38
- lambda {
38
+ expect {
39
39
  subject.attribute("test_cookbook/test", options)
40
- }.should_not raise_error
40
+ }.not_to raise_error
41
41
 
42
42
  options = {
43
43
  :type => "numeric",
44
44
  :choice => [ true, "false" ],
45
45
  :default => false
46
46
  }
47
- lambda {
47
+ expect {
48
48
  subject.attribute("test_cookbook/test", options)
49
- }.should raise_error
49
+ }.to raise_error
50
50
  end
51
51
  end
52
52
  end
@@ -12,7 +12,7 @@ describe Ridley::Chef::Cookbook::SyntaxCheck do
12
12
  subject { syntax_check }
13
13
 
14
14
  before(:each) do
15
- subject.stub(:chefignore) { chefignore }
15
+ allow(subject).to receive(:chefignore) { chefignore }
16
16
  end
17
17
 
18
18
  describe "#ruby_files" do
@@ -55,7 +55,7 @@ describe Ridley::Chef::Cookbook::SyntaxCheck do
55
55
  it "checks if a file has already been validated" do
56
56
  valid_template_file = cookbook_dir.join("templates/default/temp.txt.erb").to_s
57
57
  subject.validated(valid_template_file)
58
- expect(subject.validated?(valid_template_file)).to be_true
58
+ expect(subject.validated?(valid_template_file)).to be_truthy
59
59
  end
60
60
  end
61
61
 
@@ -63,7 +63,7 @@ describe Ridley::Chef::Cookbook::SyntaxCheck do
63
63
  let(:validated_files) { double('validated_files') }
64
64
 
65
65
  before(:each) do
66
- subject.stub(:validated_files) { validated_files }
66
+ allow(subject).to receive(:validated_files) { validated_files }
67
67
  end
68
68
 
69
69
  it "records a file as validated" do
@@ -77,35 +77,35 @@ describe Ridley::Chef::Cookbook::SyntaxCheck do
77
77
 
78
78
  describe "#validate_ruby_files" do
79
79
  it "asks #untested_ruby_files for a list of files and calls #validate_ruby_file on each" do
80
- subject.stub(:validate_ruby_file).with(anything()).exactly(9).times { true }
81
- expect(subject.validate_ruby_files).to be_true
80
+ allow(subject).to receive(:validate_ruby_file).with(anything()).exactly(9).times { true }
81
+ expect(subject.validate_ruby_files).to be_truthy
82
82
  end
83
83
 
84
84
  it "marks the successfully validated ruby files" do
85
- subject.stub(:validated).with(anything()).exactly(9).times
86
- expect(subject.validate_ruby_files).to be_true
85
+ allow(subject).to receive(:validated).with(anything()).exactly(9).times
86
+ expect(subject.validate_ruby_files).to be_truthy
87
87
  end
88
88
 
89
89
  it "returns false if any ruby file fails to validate" do
90
- subject.stub(:validate_ruby_file).with(/\.rb$/) { false }
91
- expect(subject.validate_ruby_files).to be_false
90
+ allow(subject).to receive(:validate_ruby_file).with(/\.rb$/) { false }
91
+ expect(subject.validate_ruby_files).to be_falsey
92
92
  end
93
93
  end
94
94
 
95
95
  describe "#validate_templates" do
96
96
  it "asks #untested_template_files for a list of erb files and calls #validate_template on each" do
97
- subject.stub(:validate_template).with(anything()).exactly(9).times { true }
98
- expect(subject.validate_templates).to be_true
97
+ allow(subject).to receive(:validate_template).with(anything()).exactly(9).times { true }
98
+ expect(subject.validate_templates).to be_truthy
99
99
  end
100
100
 
101
101
  it "marks the successfully validated erb files" do
102
- subject.stub(:validated).with(anything()).exactly(9).times
103
- expect(subject.validate_templates).to be_true
102
+ allow(subject).to receive(:validated).with(anything()).exactly(9).times
103
+ expect(subject.validate_templates).to be_truthy
104
104
  end
105
105
 
106
106
  it "returns false if any erb file fails to validate" do
107
- subject.stub(:validate_template).with(/\.erb$/) { false }
108
- expect(subject.validate_templates).to be_false
107
+ allow(subject).to receive(:validate_template).with(/\.erb$/) { false }
108
+ expect(subject.validate_templates).to be_falsey
109
109
  end
110
110
  end
111
111