-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: rename file according to test content
- Loading branch information
Showing
2 changed files
with
56 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,33 @@ | ||
require "spec_helper" | ||
|
||
describe "global_resource" do | ||
context "just a class" do | ||
let(:code) { "class test { file { 'file': } }" } | ||
|
||
it "should not detect any problems" do | ||
expect(problems).to have(0).problems | ||
end | ||
end | ||
|
||
context "just a define" do | ||
let(:code) { "define test ($param = undef) { file { 'file': } }" } | ||
|
||
it "should not detect any problems" do | ||
expect(problems).to have(0).problems | ||
describe "global_function" do | ||
context "just a function" do | ||
let(:code) do | ||
<<-EOS | ||
class test { | ||
ensure_packages(['wordpress']); | ||
} | ||
EOS | ||
end | ||
end | ||
|
||
context "allow node resources" do | ||
let(:code) { "node 'test' { file { 'file': } }" } | ||
|
||
it "should not detect any problems" do | ||
expect(problems).to have(0).problems | ||
end | ||
end | ||
|
||
context "global file" do | ||
let(:code) do | ||
"file { 'file': } define test ($param = undef) { file { 'file': } }" | ||
end | ||
|
||
it "should detect a problem" do | ||
expect(problems).to have(1).problems | ||
end | ||
end | ||
|
||
context "global includes" do | ||
let(:code) { "class test { file { 'file': } } \ninclude testclass" } | ||
|
||
it "should detect a problem" do | ||
expect(problems).to have(1).problems | ||
end | ||
end | ||
|
||
context "global defaults" do | ||
context "global functions" do | ||
let(:code) do | ||
<<-EOS | ||
Exec { | ||
path => '/usr/bin:/usr/sbin/:/bin:/sbin', | ||
class test { | ||
ensure_packages(['wordpress']); | ||
} | ||
ensure_packages(['wordpress']); | ||
EOS | ||
end | ||
|
||
it "should not detect any problems" do | ||
expect(problems).to have(0).problems | ||
it "should detect a problem" do | ||
expect(problems).to have(1).problems | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,59 @@ | ||
require "spec_helper" | ||
|
||
describe "global_function" do | ||
context "just a function" do | ||
let(:code) do | ||
<<-EOS | ||
class test { | ||
ensure_packages(['wordpress']); | ||
} | ||
EOS | ||
describe "global_resource" do | ||
context "just a class" do | ||
let(:code) { "class test { file { 'file': } }" } | ||
|
||
it "should not detect any problems" do | ||
expect(problems).to have(0).problems | ||
end | ||
end | ||
|
||
context "just a define" do | ||
let(:code) { "define test ($param = undef) { file { 'file': } }" } | ||
|
||
it "should not detect any problems" do | ||
expect(problems).to have(0).problems | ||
end | ||
end | ||
|
||
context "global functions" do | ||
context "allow node resources" do | ||
let(:code) { "node 'test' { file { 'file': } }" } | ||
|
||
it "should not detect any problems" do | ||
expect(problems).to have(0).problems | ||
end | ||
end | ||
|
||
context "global file" do | ||
let(:code) do | ||
<<-EOS | ||
class test { | ||
ensure_packages(['wordpress']); | ||
} | ||
"file { 'file': } define test ($param = undef) { file { 'file': } }" | ||
end | ||
|
||
ensure_packages(['wordpress']); | ||
EOS | ||
it "should detect a problem" do | ||
expect(problems).to have(1).problems | ||
end | ||
end | ||
|
||
context "global includes" do | ||
let(:code) { "class test { file { 'file': } } \ninclude testclass" } | ||
|
||
it "should detect a problem" do | ||
expect(problems).to have(1).problems | ||
end | ||
end | ||
|
||
context "global defaults" do | ||
let(:code) do | ||
<<-EOS | ||
Exec { | ||
path => '/usr/bin:/usr/sbin/:/bin:/sbin', | ||
} | ||
EOS | ||
end | ||
|
||
it "should not detect any problems" do | ||
expect(problems).to have(0).problems | ||
end | ||
end | ||
end |