diff options
Diffstat (limited to 'spec/integration/knife/diff_spec.rb')
-rw-r--r-- | spec/integration/knife/diff_spec.rb | 232 |
1 files changed, 116 insertions, 116 deletions
diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb index b3bd23f48e..9e54558300 100644 --- a/spec/integration/knife/diff_spec.rb +++ b/spec/integration/knife/diff_spec.rb @@ -46,18 +46,18 @@ describe "knife diff", :workstation do end it "knife diff reports everything as deleted" do - knife("diff --name-status /").should_succeed <<EOM -D\t/clients/chef-validator.json -D\t/clients/chef-webui.json -D\t/clients/x.json -D\t/cookbooks/x -D\t/data_bags/x -D\t/environments/_default.json -D\t/environments/x.json -D\t/nodes/x.json -D\t/roles/x.json -D\t/users/admin.json -D\t/users/x.json + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients/chef-validator.json + D\t/clients/chef-webui.json + D\t/clients/x.json + D\t/cookbooks/x + D\t/data_bags/x + D\t/environments/_default.json + D\t/environments/x.json + D\t/nodes/x.json + D\t/roles/x.json + D\t/users/admin.json + D\t/users/x.json EOM end end @@ -92,16 +92,16 @@ EOM context "except the role file" do before do - file "roles/x.json", <<EOM -{ - "foo": "bar" -} + file "roles/x.json", <<~EOM + { + "foo": "bar" + } EOM end it "knife diff reports the role as different" do - knife("diff --name-status /").should_succeed <<EOM -M\t/roles/x.json + knife("diff --name-status /").should_succeed <<~EOM + M\t/roles/x.json EOM end end @@ -120,31 +120,31 @@ EOM end it "knife diff reports the new files as added" do - knife("diff --name-status /").should_succeed <<EOM -A\t/clients/y.json -A\t/cookbooks/x/blah.rb -A\t/cookbooks/y -A\t/data_bags/x/z.json -A\t/data_bags/y -A\t/environments/y.json -A\t/nodes/y.json -A\t/roles/y.json -A\t/users/y.json + knife("diff --name-status /").should_succeed <<~EOM + A\t/clients/y.json + A\t/cookbooks/x/blah.rb + A\t/cookbooks/y + A\t/data_bags/x/z.json + A\t/data_bags/y + A\t/environments/y.json + A\t/nodes/y.json + A\t/roles/y.json + A\t/users/y.json EOM end context "when cwd is the data_bags directory" do before { cwd "data_bags" } it "knife diff reports different data bags" do - knife("diff --name-status").should_succeed <<EOM -A\tx/z.json -A\ty + knife("diff --name-status").should_succeed <<~EOM + A\tx/z.json + A\ty EOM end it "knife diff * reports different data bags" do - knife("diff --name-status *").should_succeed <<EOM -A\tx/z.json -A\ty + knife("diff --name-status *").should_succeed <<~EOM + A\tx/z.json + A\ty EOM end end @@ -153,14 +153,14 @@ EOM when_the_repository "is empty" do it "knife diff reports everything as deleted" do - knife("diff --name-status /").should_succeed <<EOM -D\t/clients -D\t/cookbooks -D\t/data_bags -D\t/environments -D\t/nodes -D\t/roles -D\t/users + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients + D\t/cookbooks + D\t/data_bags + D\t/environments + D\t/nodes + D\t/roles + D\t/users EOM end end @@ -179,17 +179,17 @@ EOM end it "knife diff /cookbooks/x shows differences" do - knife("diff --name-status /cookbooks/x").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/onlyin1.0.1.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --name-status /cookbooks/x").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/onlyin1.0.1.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM end it "knife diff --diff-filter=MAT does not show deleted files" do - knife("diff --diff-filter=MAT --name-status /cookbooks/x").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --diff-filter=MAT --name-status /cookbooks/x").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM end end @@ -210,10 +210,10 @@ EOM end it "knife diff /cookbooks/x shows the differences" do - knife("diff --name-status /cookbooks/x").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/onlyin1.0.1.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --name-status /cookbooks/x").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/onlyin1.0.1.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM end end @@ -224,10 +224,10 @@ EOM end it "knife diff /cookbooks/x shows the differences" do - knife("diff --name-status /cookbooks/x").should_succeed <<EOM -M\t/cookbooks/x/metadata.rb -D\t/cookbooks/x/onlyin0.9.9.rb -A\t/cookbooks/x/onlyin1.0.0.rb + knife("diff --name-status /cookbooks/x").should_succeed <<~EOM + M\t/cookbooks/x/metadata.rb + D\t/cookbooks/x/onlyin0.9.9.rb + A\t/cookbooks/x/onlyin1.0.0.rb EOM end end @@ -247,7 +247,7 @@ EOM end when_the_chef_server "has an environment with a different value" do before { environment "x", { "description" => "hi" } } - it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do + it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do knife("diff /environments/x.json").should_succeed(/ { - "name": "x", @@ -277,7 +277,7 @@ EOM environment "x", {} end - it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do + it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do knife("diff /environments/x.json").should_succeed(/ { - "name": "x" @@ -291,7 +291,7 @@ EOM before do environment "x", { "description" => "lo" } end - it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do + it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do knife("diff /environments/x.json").should_succeed(/ { "name": "x", @@ -311,7 +311,7 @@ EOM it "knife diff reports an error and does a textual diff" do error_text = "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF" error_match = Regexp.new(Regexp.escape(error_text)) - knife("diff /environments/x.json").should_succeed(/- "name": "x"/, :stderr => error_match) + knife("diff /environments/x.json").should_succeed(/- "name": "x"/, stderr: error_match) end end end @@ -341,18 +341,18 @@ EOM end it "knife diff reports everything as deleted" do - knife("diff --name-status /").should_succeed <<EOM -D\t/clients/chef-validator.json -D\t/clients/chef-webui.json -D\t/clients/x.json -D\t/cookbooks/x-1.0.0 -D\t/data_bags/x -D\t/environments/_default.json -D\t/environments/x.json -D\t/nodes/x.json -D\t/roles/x.json -D\t/users/admin.json -D\t/users/x.json + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients/chef-validator.json + D\t/clients/chef-webui.json + D\t/clients/x.json + D\t/cookbooks/x-1.0.0 + D\t/data_bags/x + D\t/environments/_default.json + D\t/environments/x.json + D\t/nodes/x.json + D\t/roles/x.json + D\t/users/admin.json + D\t/users/x.json EOM end end @@ -386,16 +386,16 @@ EOM context "except the role file" do before do - file "roles/x.json", <<EOM -{ - "foo": "bar" -} + file "roles/x.json", <<~EOM + { + "foo": "bar" + } EOM end it "knife diff reports the role as different" do - knife("diff --name-status /").should_succeed <<EOM -M\t/roles/x.json + knife("diff --name-status /").should_succeed <<~EOM + M\t/roles/x.json EOM end end @@ -415,32 +415,32 @@ EOM end it "knife diff reports the new files as added" do - knife("diff --name-status /").should_succeed <<EOM -A\t/clients/y.json -A\t/cookbooks/x-1.0.0/blah.rb -A\t/cookbooks/x-2.0.0 -A\t/cookbooks/y-1.0.0 -A\t/data_bags/x/z.json -A\t/data_bags/y -A\t/environments/y.json -A\t/nodes/y.json -A\t/roles/y.json -A\t/users/y.json + knife("diff --name-status /").should_succeed <<~EOM + A\t/clients/y.json + A\t/cookbooks/x-1.0.0/blah.rb + A\t/cookbooks/x-2.0.0 + A\t/cookbooks/y-1.0.0 + A\t/data_bags/x/z.json + A\t/data_bags/y + A\t/environments/y.json + A\t/nodes/y.json + A\t/roles/y.json + A\t/users/y.json EOM end context "when cwd is the data_bags directory" do before { cwd "data_bags" } it "knife diff reports different data bags" do - knife("diff --name-status").should_succeed <<EOM -A\tx/z.json -A\ty + knife("diff --name-status").should_succeed <<~EOM + A\tx/z.json + A\ty EOM end it "knife diff * reports different data bags" do - knife("diff --name-status *").should_succeed <<EOM -A\tx/z.json -A\ty + knife("diff --name-status *").should_succeed <<~EOM + A\tx/z.json + A\ty EOM end end @@ -449,14 +449,14 @@ EOM when_the_repository "is empty" do it "knife diff reports everything as deleted" do - knife("diff --name-status /").should_succeed <<EOM -D\t/clients -D\t/cookbooks -D\t/data_bags -D\t/environments -D\t/nodes -D\t/roles -D\t/users + knife("diff --name-status /").should_succeed <<~EOM + D\t/clients + D\t/cookbooks + D\t/data_bags + D\t/environments + D\t/nodes + D\t/roles + D\t/users EOM end end @@ -475,8 +475,8 @@ EOM end it "knife diff /cookbooks shows differences" do - knife("diff --name-status /cookbooks").should_succeed <<EOM -D\t/cookbooks/x-1.0.1 + knife("diff --name-status /cookbooks").should_succeed <<~EOM + D\t/cookbooks/x-1.0.1 EOM end @@ -501,9 +501,9 @@ EOM end it "knife diff /cookbooks shows the differences" do - knife("diff --name-status /cookbooks").should_succeed <<EOM -D\t/cookbooks/x-1.0.1 -A\t/cookbooks/x-1.0.0 + knife("diff --name-status /cookbooks").should_succeed <<~EOM + D\t/cookbooks/x-1.0.1 + A\t/cookbooks/x-1.0.0 EOM end end @@ -514,9 +514,9 @@ EOM end it "knife diff /cookbooks shows the differences" do - knife("diff --name-status /cookbooks").should_succeed <<EOM -D\t/cookbooks/x-0.9.9 -A\t/cookbooks/x-1.0.0 + knife("diff --name-status /cookbooks").should_succeed <<~EOM + D\t/cookbooks/x-0.9.9 + A\t/cookbooks/x-1.0.0 EOM end end @@ -533,7 +533,7 @@ EOM end when_the_chef_server "has an environment with a different value" do before { environment "x", { "description" => "hi" } } - it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do + it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do knife("diff /environments/x.json").should_succeed(/ { - "name": "x", @@ -560,7 +560,7 @@ EOM end when_the_chef_server "has an environment with no value" do before { environment "x", {} } - it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do + it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do knife("diff /environments/x.json").should_succeed(/ { - "name": "x" @@ -574,7 +574,7 @@ EOM before do environment "x", { "description" => "lo" } end - it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do + it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do knife("diff /environments/x.json").should_succeed(/ { "name": "x", @@ -594,7 +594,7 @@ EOM it "knife diff reports an error and does a textual diff" do error_text = "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF" error_match = Regexp.new(Regexp.escape(error_text)) - knife("diff /environments/x.json").should_succeed(/- "name": "x"/, :stderr => error_match) + knife("diff /environments/x.json").should_succeed(/- "name": "x"/, stderr: error_match) end end end |