diff options
Diffstat (limited to 'spec/integration/knife/raw_spec.rb')
-rw-r--r-- | spec/integration/knife/raw_spec.rb | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/spec/integration/knife/raw_spec.rb b/spec/integration/knife/raw_spec.rb index 75fc8fa55e..92b972b87b 100644 --- a/spec/integration/knife/raw_spec.rb +++ b/spec/integration/knife/raw_spec.rb @@ -15,12 +15,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -require 'support/shared/integration/integration_helper' -require 'support/shared/context/config' -require 'chef/knife/raw' -require 'chef/knife/show' +require "support/shared/integration/integration_helper" +require "support/shared/context/config" +require "chef/knife/raw" +require "chef/knife/show" -describe 'knife raw', :workstation do +describe "knife raw", :workstation do include IntegrationSupport include KnifeSupport include AppServerSupport @@ -29,17 +29,17 @@ describe 'knife raw', :workstation do when_the_chef_server "has one of each thing" do before do - client 'x', '{}' - cookbook 'x', '1.0.0' - data_bag 'x', { 'y' => '{}' } - environment 'x', '{}' - node 'x', '{}' - role 'x', '{}' - user 'x', '{}' + client "x", "{}" + cookbook "x", "1.0.0" + data_bag "x", { "y" => "{}" } + environment "x", "{}" + node "x", "{}" + role "x", "{}" + user "x", "{}" end - it 'knife raw /nodes/x returns the node', :skip => (RUBY_VERSION < "1.9") do - knife('raw /nodes/x').should_succeed <<EOM + it "knife raw /nodes/x returns the node", :skip => (RUBY_VERSION < "1.9") do + knife("raw /nodes/x").should_succeed <<EOM { "name": "x", "json_class": "Chef::Node", @@ -64,12 +64,12 @@ describe 'knife raw', :workstation do EOM end - it 'knife raw /blarghle returns 404' do - knife('raw /blarghle').should_fail(/ERROR: Server responded with error 404 "Not Found\s*"/) + it "knife raw /blarghle returns 404" do + knife("raw /blarghle").should_fail(/ERROR: Server responded with error 404 "Not Found\s*"/) end - it 'knife raw -m DELETE /roles/x succeeds', :skip => (RUBY_VERSION < "1.9") do - knife('raw -m DELETE /roles/x').should_succeed <<EOM + it "knife raw -m DELETE /roles/x succeeds", :skip => (RUBY_VERSION < "1.9") do + knife("raw -m DELETE /roles/x").should_succeed <<EOM { "name": "x", "description": "", @@ -89,11 +89,11 @@ EOM } } EOM - knife('show /roles/x.json').should_fail "ERROR: /roles/x.json: No such file or directory\n" + knife("show /roles/x.json").should_fail "ERROR: /roles/x.json: No such file or directory\n" end - it 'knife raw -m PUT -i blah.txt /roles/x succeeds', :skip => (RUBY_VERSION < "1.9") do - Tempfile.open('raw_put_input') do |file| + it "knife raw -m PUT -i blah.txt /roles/x succeeds", :skip => (RUBY_VERSION < "1.9") do + Tempfile.open("raw_put_input") do |file| file.write <<EOM { "name": "x", @@ -136,7 +136,7 @@ EOM } } EOM - knife('show /roles/x.json').should_succeed <<EOM + knife("show /roles/x.json").should_succeed <<EOM /roles/x.json: { "name": "x", @@ -146,8 +146,8 @@ EOM end end - it 'knife raw -m POST -i blah.txt /roles succeeds', :skip => (RUBY_VERSION < "1.9") do - Tempfile.open('raw_put_input') do |file| + it "knife raw -m POST -i blah.txt /roles succeeds", :skip => (RUBY_VERSION < "1.9") do + Tempfile.open("raw_put_input") do |file| file.write <<EOM { "name": "y", @@ -172,7 +172,7 @@ EOM "uri": "#{Chef::Config.chef_server_url}/roles/y" } EOM - knife('show /roles/y.json').should_succeed <<EOM + knife("show /roles/y.json").should_succeed <<EOM /roles/y.json: { "name": "y", @@ -182,11 +182,11 @@ EOM end end - context 'When a server returns raw json' do + context "When a server returns raw json" do before :each do Chef::Config.chef_server_url = "http://localhost:9018" app = lambda do |env| - [200, {'Content-Type' => 'application/json' }, ['{ "x": "y", "a": "b" }'] ] + [200, {"Content-Type" => "application/json" }, ['{ "x": "y", "a": "b" }'] ] end @raw_server, @raw_server_thread = start_app_server(app, 9018) end @@ -196,8 +196,8 @@ EOM @raw_server_thread.kill if @raw_server_thread end - it 'knife raw /blah returns the prettified json', :skip => (RUBY_VERSION < "1.9") do - knife('raw /blah').should_succeed <<EOM + it "knife raw /blah returns the prettified json", :skip => (RUBY_VERSION < "1.9") do + knife("raw /blah").should_succeed <<EOM { "x": "y", "a": "b" @@ -205,18 +205,18 @@ EOM EOM end - it 'knife raw --no-pretty /blah returns the raw json' do - knife('raw --no-pretty /blah').should_succeed <<EOM + it "knife raw --no-pretty /blah returns the raw json" do + knife("raw --no-pretty /blah").should_succeed <<EOM { "x": "y", "a": "b" } EOM end end - context 'When a server returns text' do + context "When a server returns text" do before :each do Chef::Config.chef_server_url = "http://localhost:9018" app = lambda do |env| - [200, {'Content-Type' => 'text' }, ['{ "x": "y", "a": "b" }'] ] + [200, {"Content-Type" => "text" }, ['{ "x": "y", "a": "b" }'] ] end @raw_server, @raw_server_thread = start_app_server(app, 9018) end @@ -226,14 +226,14 @@ EOM @raw_server_thread.kill if @raw_server_thread end - it 'knife raw /blah returns the raw text' do - knife('raw /blah').should_succeed(<<EOM) + it "knife raw /blah returns the raw text" do + knife("raw /blah").should_succeed(<<EOM) { "x": "y", "a": "b" } EOM end - it 'knife raw --no-pretty /blah returns the raw text' do - knife('raw --no-pretty /blah').should_succeed(<<EOM) + it "knife raw --no-pretty /blah returns the raw text" do + knife("raw --no-pretty /blah").should_succeed(<<EOM) { "x": "y", "a": "b" } EOM end |