stacker_bee 2.1.1.pre252 → 2.1.1.pre263

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +8 -8
  2. data/.rubocop.yml +0 -3
  3. data/Rakefile +1 -1
  4. data/bin/stacker_bee +10 -10
  5. data/lib/stacker_bee/api.rb +4 -4
  6. data/lib/stacker_bee/client.rb +24 -24
  7. data/lib/stacker_bee/configuration.rb +13 -7
  8. data/lib/stacker_bee/connection.rb +5 -5
  9. data/lib/stacker_bee/http_middleware/detokenizer.rb +2 -2
  10. data/lib/stacker_bee/http_middleware/signed_query.rb +3 -3
  11. data/lib/stacker_bee/middleware/adapter.rb +1 -1
  12. data/lib/stacker_bee/middleware/base.rb +1 -1
  13. data/lib/stacker_bee/middleware/clean_response.rb +2 -2
  14. data/lib/stacker_bee/middleware/cloud_stack_api.rb +2 -2
  15. data/lib/stacker_bee/middleware/dictionary_flattener.rb +3 -3
  16. data/lib/stacker_bee/middleware/endpoint_normalizer.rb +2 -2
  17. data/lib/stacker_bee/middleware/error_message.rb +3 -3
  18. data/lib/stacker_bee/middleware/log_response.rb +1 -1
  19. data/lib/stacker_bee/middleware/raise_on_http_error.rb +1 -1
  20. data/lib/stacker_bee/middleware/remove_nils.rb +1 -1
  21. data/lib/stacker_bee/rash.rb +3 -3
  22. data/lib/stacker_bee/version.rb +1 -1
  23. data/lib/stacker_bee.rb +2 -2
  24. data/spec/integration/configure_middleware_spec.rb +12 -12
  25. data/spec/integration/console_spec.rb +4 -4
  26. data/spec/integration/request_spec.rb +46 -46
  27. data/spec/spec_helper.rb +4 -4
  28. data/spec/support/vcr.rb +4 -4
  29. data/spec/units/stacker_bee/api_spec.rb +11 -11
  30. data/spec/units/stacker_bee/client_spec.rb +19 -19
  31. data/spec/units/stacker_bee/configuration_spec.rb +28 -28
  32. data/spec/units/stacker_bee/connection_spec.rb +18 -18
  33. data/spec/units/stacker_bee/middleware/adapter_spec.rb +7 -7
  34. data/spec/units/stacker_bee/middleware/base_spec.rb +17 -17
  35. data/spec/units/stacker_bee/middleware/cloudstack_api_spec.rb +9 -9
  36. data/spec/units/stacker_bee/middleware/console_access_spec.rb +10 -10
  37. data/spec/units/stacker_bee/middleware/dictionary_flattener_spec.rb +22 -22
  38. data/spec/units/stacker_bee/middleware/endpoint_normalizer_spec.rb +4 -4
  39. data/spec/units/stacker_bee/middleware/error_message_spec.rb +6 -6
  40. data/spec/units/stacker_bee/middleware/format_keys_spec.rb +2 -2
  41. data/spec/units/stacker_bee/middleware/format_values_spec.rb +2 -2
  42. data/spec/units/stacker_bee/middleware/http_status_spec.rb +2 -2
  43. data/spec/units/stacker_bee/middleware/log_response_spec.rb +15 -15
  44. data/spec/units/stacker_bee/middleware/remove_empty_strings_spec.rb +4 -4
  45. data/spec/units/stacker_bee/middleware/remove_nils_spec.rb +1 -1
  46. data/spec/units/stacker_bee/rash_spec.rb +41 -41
  47. data/spec/units/stacker_bee/request_error_spec.rb +7 -7
  48. data/spec/units/stacker_bee/utilities_spec.rb +30 -30
  49. data/spec/units/stacker_bee_spec.rb +2 -2
  50. data/stacker_bee.gemspec +24 -22
  51. metadata +4 -4
@@ -13,20 +13,20 @@ describe StackerBee::Middleware::Base do
13
13
  let(:subclass) { Class.new(described_class, &subclass_body) }
14
14
  let(:subclass_body) { proc {} }
15
15
 
16
- describe "#call" do
16
+ describe '#call' do
17
17
  before do
18
18
  middleware.call env
19
19
  end
20
20
 
21
21
  def self.it_calls_its_app_with_the_env
22
- it "calls its app with the env" do
22
+ it 'calls its app with the env' do
23
23
  app.should have_received(:call).with(env)
24
24
  end
25
25
  end
26
26
 
27
27
  it_calls_its_app_with_the_env
28
28
 
29
- context "when overriding #before" do
29
+ context 'when overriding #before' do
30
30
  let(:subclass_body) do
31
31
  proc do
32
32
  def before(env)
@@ -37,12 +37,12 @@ describe StackerBee::Middleware::Base do
37
37
 
38
38
  it_calls_its_app_with_the_env
39
39
 
40
- it "runs the before hook" do
40
+ it 'runs the before hook' do
41
41
  env.before_was_run.should be_true
42
42
  end
43
43
  end
44
44
 
45
- context "when overriding #after" do
45
+ context 'when overriding #after' do
46
46
  let(:subclass_body) do
47
47
  proc do
48
48
  def after(env)
@@ -53,12 +53,12 @@ describe StackerBee::Middleware::Base do
53
53
 
54
54
  it_calls_its_app_with_the_env
55
55
 
56
- it "runs the after hook" do
56
+ it 'runs the after hook' do
57
57
  env.after_was_run.should be_true
58
58
  end
59
59
  end
60
60
 
61
- context "when overriding #content_types" do
61
+ context 'when overriding #content_types' do
62
62
  let(:subclass_body) do
63
63
  proc do
64
64
  def after(env)
@@ -73,22 +73,22 @@ describe StackerBee::Middleware::Base do
73
73
 
74
74
  it_calls_its_app_with_the_env
75
75
 
76
- context "when it matches the content type" do
76
+ context 'when it matches the content type' do
77
77
  let(:content_type) { 'text/html; uft-8' }
78
- it "runs the after hook" do
78
+ it 'runs the after hook' do
79
79
  env.after_was_run.should be_true
80
80
  end
81
81
  end
82
82
 
83
83
  context "when it doesn't match the content type" do
84
84
  let(:content_type) { 'text/javascript; uft-8' }
85
- it "runs the after hook" do
85
+ it 'runs the after hook' do
86
86
  env.after_was_run.should be_nil
87
87
  end
88
88
  end
89
89
  end
90
90
 
91
- context "when overriding #params" do
91
+ context 'when overriding #params' do
92
92
  let(:subclass_body) do
93
93
  proc do
94
94
  def transform_params(params)
@@ -97,17 +97,17 @@ describe StackerBee::Middleware::Base do
97
97
  end
98
98
  end
99
99
 
100
- it "changes the params" do
100
+ it 'changes the params' do
101
101
  env.request.params[:params_merged?].should be_true
102
102
  end
103
103
  end
104
104
  end
105
105
 
106
- describe "#endpoint_name_for" do
106
+ describe '#endpoint_name_for' do
107
107
  let(:endpoint_name) { double }
108
108
  let(:normalized_endpoint_name) { double }
109
109
 
110
- it "delegates to its app" do
110
+ it 'delegates to its app' do
111
111
  app.should_receive(:endpoint_name_for)
112
112
  .with(endpoint_name)
113
113
  .and_return(normalized_endpoint_name)
@@ -117,10 +117,10 @@ describe StackerBee::Middleware::Base do
117
117
  end
118
118
  end
119
119
 
120
- describe "#matches_content_type?" do
121
- describe "by default" do
120
+ describe '#matches_content_type?' do
121
+ describe 'by default' do
122
122
  before { env.response.content_type = '$8^02(324' }
123
- it "matches anything" do
123
+ it 'matches anything' do
124
124
  middleware.matches_content_type?(env).should be_true
125
125
  end
126
126
  end
@@ -7,31 +7,31 @@ describe StackerBee::Middleware::CloudStackAPI do
7
7
  path: path
8
8
  )
9
9
  end
10
- let(:middleware) { described_class.new(api_key: "API-KEY", params: {}) }
10
+ let(:middleware) { described_class.new(api_key: 'API-KEY', params: {}) }
11
11
  let(:path) { nil }
12
12
 
13
13
  before do
14
14
  middleware.before(env)
15
15
  end
16
16
 
17
- describe "request" do
17
+ describe 'request' do
18
18
  subject { env.request }
19
19
 
20
- context "when the path is not set" do
20
+ context 'when the path is not set' do
21
21
  let(:path) { nil }
22
22
  its(:path) { should == described_class::DEFAULT_PATH }
23
23
  end
24
24
 
25
- context "when the path is already set" do
26
- let(:path) { "already set" }
25
+ context 'when the path is already set' do
26
+ let(:path) { 'already set' }
27
27
  its(:path) { should == path }
28
28
  end
29
29
  end
30
30
 
31
- describe "params" do
31
+ describe 'params' do
32
32
  subject { env.request.params }
33
- its([:api_key]) { should eq "API-KEY" }
34
- its([:response]) { should eq "json" }
35
- its([:command]) { should eq "endpoint-name" }
33
+ its([:api_key]) { should eq 'API-KEY' }
34
+ its([:response]) { should eq 'json' }
35
+ its([:command]) { should eq 'endpoint-name' }
36
36
  end
37
37
  end
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe StackerBee::Middleware::ConsoleAccess do
4
4
  let(:env) do
@@ -8,15 +8,15 @@ describe StackerBee::Middleware::ConsoleAccess do
8
8
  let(:middleware) { described_class.new(app: app) }
9
9
  let(:app) { double(:app) }
10
10
 
11
- context "when it matches the endpoint" do
11
+ context 'when it matches the endpoint' do
12
12
  let(:endpoint_name) { described_class::ENDPOINT }
13
13
 
14
- it "adds its path to the env" do
14
+ it 'adds its path to the env' do
15
15
  middleware.before(env)
16
16
  env.request.path.should == described_class::PATH
17
17
  end
18
18
 
19
- it "adds cmd to the parameters" do
19
+ it 'adds cmd to the parameters' do
20
20
  env.request.params.should_not include described_class::PARAMS
21
21
  end
22
22
  end
@@ -35,22 +35,22 @@ describe StackerBee::Middleware::ConsoleAccess do
35
35
  end
36
36
  end
37
37
 
38
- it "matches html content typtes" do
39
- middleware.content_types.should =~ "text/html; charset=utf-8"
38
+ it 'matches html content typtes' do
39
+ middleware.content_types.should =~ 'text/html; charset=utf-8'
40
40
  end
41
41
 
42
- describe "#endpoint_name_for" do
43
- context "given names it reponds to" do
42
+ describe '#endpoint_name_for' do
43
+ context 'given names it reponds to' do
44
44
  %w(consoleAccess console_access CONSOLEACCESS).each do |name|
45
45
  subject { middleware.endpoint_name_for(name) }
46
46
  it { should eq described_class::ENDPOINT }
47
47
  end
48
48
  end
49
49
 
50
- context "for other names" do
50
+ context 'for other names' do
51
51
  before { app.stub :endpoint_name_for, &:upcase }
52
52
 
53
- it "delegates for other names" do
53
+ it 'delegates for other names' do
54
54
  middleware.endpoint_name_for('other-name').should == 'OTHER-NAME'
55
55
  end
56
56
  end
@@ -3,20 +3,20 @@ require 'spec_helper'
3
3
  describe StackerBee::Middleware::DictionaryFlattener do
4
4
  let(:lb) { described_class::LB }
5
5
  let(:rb) { described_class::RB }
6
- let(:string) { "cool[0].name%21" }
6
+ let(:string) { 'cool[0].name%21' }
7
7
  let(:tokenized_string) { "cool#{lb}0#{rb}.name%21" }
8
8
 
9
- describe ".detokenize" do
9
+ describe '.detokenize' do
10
10
  subject { described_class.detokenize(tokenized_string) }
11
11
  it { should eq string }
12
12
  end
13
13
 
14
- describe ".tokenize" do
14
+ describe '.tokenize' do
15
15
  subject { described_class.tokenize(string) }
16
16
  it { should eq tokenized_string }
17
17
  end
18
18
 
19
- describe ".new" do
19
+ describe '.new' do
20
20
  subject { described_class.new.transform_params(params) }
21
21
 
22
22
  def param(number)
@@ -24,38 +24,38 @@ describe StackerBee::Middleware::DictionaryFlattener do
24
24
  end
25
25
 
26
26
  let(:params) do
27
- { "time" => "long ago",
28
- "rebels" => {
29
- "r2" => "d2",
30
- "blank" => "",
31
- "falsey" => "false",
32
- "false" => false,
33
- "droid" => true } }
27
+ { 'time' => 'long ago',
28
+ 'rebels' => {
29
+ 'r2' => 'd2',
30
+ 'blank' => '',
31
+ 'falsey' => 'false',
32
+ 'false' => false,
33
+ 'droid' => true } }
34
34
  end
35
35
 
36
- it "flattens objects in the manner that cloudstack expects" do
37
- subject["#{param(0)}.name"].should eq "r2"
38
- subject["#{param(0)}.key"].should eq "r2"
39
- subject["#{param(0)}.value"].should eq "d2"
36
+ it 'flattens objects in the manner that cloudstack expects' do
37
+ subject["#{param(0)}.name"].should eq 'r2'
38
+ subject["#{param(0)}.key"].should eq 'r2'
39
+ subject["#{param(0)}.value"].should eq 'd2'
40
40
  end
41
41
 
42
- it "does not flatten empty hashes" do
42
+ it 'does not flatten empty hashes' do
43
43
  subject.should_not have_key "#{param(2)}.name"
44
44
  end
45
45
 
46
- it "handles true booleans" do
47
- subject["#{param(1)}.name"].should eq "droid"
46
+ it 'handles true booleans' do
47
+ subject["#{param(1)}.name"].should eq 'droid'
48
48
  subject["#{param(1)}.value"].should be_true
49
49
  end
50
50
 
51
- it "removes original map params" do
52
- subject.should_not have_key "rebels"
51
+ it 'removes original map params' do
52
+ subject.should_not have_key 'rebels'
53
53
  end
54
54
 
55
- it "doesnt send false to CloudStack" do
55
+ it 'doesnt send false to CloudStack' do
56
56
  # This assumption is based on CloudStack UI behavior
57
57
  subject.values.should_not include false
58
- subject.values.should_not include "false"
58
+ subject.values.should_not include 'false'
59
59
  end
60
60
  end
61
61
  end
@@ -12,15 +12,15 @@ describe StackerBee::Middleware::EndpointNormalizer do
12
12
  let(:api) { {} }
13
13
  let(:endpoint_name) { :some_endpoint }
14
14
 
15
- describe "#endpoint_name_for" do
15
+ describe '#endpoint_name_for' do
16
16
  before { app.stub :endpoint_name_for, &:upcase }
17
17
 
18
- it "delegates to its app" do
18
+ it 'delegates to its app' do
19
19
  middleware.endpoint_name_for('some-name').should == 'SOME-NAME'
20
20
  end
21
21
  end
22
22
 
23
- describe "#before" do
23
+ describe '#before' do
24
24
  before { app.stub endpoint_name_for: nil }
25
25
 
26
26
  it "doesn't set the endpoint to nil", :regression do
@@ -30,5 +30,5 @@ describe StackerBee::Middleware::EndpointNormalizer do
30
30
  end
31
31
  end
32
32
 
33
- context "when it matches an endpoint"
33
+ context 'when it matches an endpoint'
34
34
  end
@@ -12,22 +12,22 @@ describe StackerBee::Middleware::ErrorMessage do
12
12
  end
13
13
  end
14
14
  let(:body) { { errortext: message } }
15
- let(:message) { "Unable to execute API command deployvirtualmachine " }
15
+ let(:message) { 'Unable to execute API command deployvirtualmachine ' }
16
16
  let(:is_success?) { true }
17
17
 
18
18
  it "doesn't apply to HTML responses" do
19
- middleware.content_types.should_not match("text/html; charset=utf-8")
19
+ middleware.content_types.should_not match('text/html; charset=utf-8')
20
20
  end
21
- it "applies to JSON responses" do
22
- middleware.content_types.should match("text/javascript; charset=utf-8")
21
+ it 'applies to JSON responses' do
22
+ middleware.content_types.should match('text/javascript; charset=utf-8')
23
23
  end
24
24
 
25
- context "given an error" do
25
+ context 'given an error' do
26
26
  let(:is_success?) { false }
27
27
  its(:error) { should eq message }
28
28
  end
29
29
 
30
- context "given a success" do
30
+ context 'given a success' do
31
31
  let(:is_success?) { true }
32
32
  its(:error) { should be_nil }
33
33
  end
@@ -10,9 +10,9 @@ describe StackerBee::Middleware::FormatKeys do
10
10
  }
11
11
  end
12
12
 
13
- it { should have_key "symbol" }
13
+ it { should have_key 'symbol' }
14
14
  it { should_not have_key :symbol }
15
15
 
16
- it { should have_key "keyCase" }
16
+ it { should have_key 'keyCase' }
17
17
  it { should_not have_key :key_case }
18
18
  end
@@ -10,6 +10,6 @@ describe StackerBee::Middleware::FormatValues do
10
10
  }
11
11
  end
12
12
 
13
- its([:single]) { should eq "1" }
14
- its([:list]) { should eq "1,2,3" }
13
+ its([:single]) { should eq '1' }
14
+ its([:list]) { should eq '1,2,3' }
15
15
  end
@@ -13,7 +13,7 @@ describe StackerBee::Middleware::HTTPStatus do
13
13
  end
14
14
  let(:body) { { errorcode: http_status } }
15
15
 
16
- context "given an error" do
16
+ context 'given an error' do
17
17
  let(:http_status) { 431 }
18
18
  let(:success?) { false }
19
19
 
@@ -21,7 +21,7 @@ describe StackerBee::Middleware::HTTPStatus do
21
21
  it { should_not be_success }
22
22
  end
23
23
 
24
- context "given a success" do
24
+ context 'given a success' do
25
25
  let(:http_status) { 200 }
26
26
  let(:success?) { true }
27
27
 
@@ -1,18 +1,18 @@
1
1
  require 'spec_helper'
2
2
  describe StackerBee::Middleware::LogResponse do
3
- describe "after" do
3
+ describe 'after' do
4
4
  let(:logger) { FakeLogger.new }
5
5
 
6
6
  let(:env) do
7
7
  env = StackerBee::Middleware::Environment.new(logger: logger)
8
- env.raw_response = { body: "some body" }
9
- env.request.params = { "command" => "some command" }
10
- env.request.path = "some/path"
8
+ env.raw_response = { body: 'some body' }
9
+ env.request.params = { 'command' => 'some command' }
10
+ env.request.path = 'some/path'
11
11
  env
12
12
  end
13
13
 
14
- shared_examples_for "all logs" do
15
- it "logs the details" do
14
+ shared_examples_for 'all logs' do
15
+ it 'logs the details' do
16
16
  logger.logs.length.should eq 1
17
17
  logger.logs.last[:request_path].should eq env.request.path
18
18
  logger.logs.last[:params].should eq env.request.params.to_a
@@ -20,30 +20,30 @@ describe StackerBee::Middleware::LogResponse do
20
20
  end
21
21
  end
22
22
 
23
- context "error response" do
23
+ context 'error response' do
24
24
  before do
25
25
  env.response.success = false
26
- env.response.error = "invalid request"
26
+ env.response.error = 'invalid request'
27
27
  subject.after(env)
28
28
  end
29
29
 
30
- it_should_behave_like "all logs"
31
- it "should have logged the details" do
30
+ it_should_behave_like 'all logs'
31
+ it 'should have logged the details' do
32
32
  logger.logs.last[:short_message].should eq \
33
- "some command failed: invalid request"
33
+ 'some command failed: invalid request'
34
34
  end
35
35
  end
36
36
 
37
- context "success response" do
37
+ context 'success response' do
38
38
  before do
39
39
  env.response.success = true
40
40
  subject.after(env)
41
41
  end
42
42
 
43
- it_should_behave_like "all logs"
44
- it "should have logged the details" do
43
+ it_should_behave_like 'all logs'
44
+ it 'should have logged the details' do
45
45
  logger.logs.length.should eq 1
46
- logger.logs.last[:short_message].should eq "some command"
46
+ logger.logs.last[:short_message].should eq 'some command'
47
47
  end
48
48
 
49
49
  end
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  # TODO: does this really need to work with nested hashes?
4
4
  describe StackerBee::Middleware::RemoveEmptyStrings do
@@ -40,15 +40,15 @@ describe StackerBee::Middleware::RemoveEmptyStrings do
40
40
  middleware.call(env)
41
41
  end
42
42
 
43
- it "removes empty strings from the input" do
43
+ it 'removes empty strings from the input' do
44
44
  params.keys.should =~ [:ok1, :ok2, :ok3, :ok4, :nested]
45
45
  end
46
46
 
47
- it "removes empty strings nested in hashes" do
47
+ it 'removes empty strings nested in hashes' do
48
48
  params[:nested].keys.should =~ [:ok1, :ok2, :ok3, :ok4, :nested]
49
49
  end
50
50
 
51
- it "removes empty strings deeply nested in hashes" do
51
+ it 'removes empty strings deeply nested in hashes' do
52
52
  params[:nested][:nested].keys.should =~ [:ok1, :ok2, :ok3, :ok4]
53
53
  end
54
54
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe StackerBee::Middleware::RemoveNils do
4
- it "removes pairs with nil values from the params" do
4
+ it 'removes pairs with nil values from the params' do
5
5
  subject.transform_params(something: 'something', nothing: nil)
6
6
  .should eq something: 'something'
7
7
  end
@@ -1,38 +1,38 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
- shared_examples_for "a Rash" do |mapping|
3
+ shared_examples_for 'a Rash' do |mapping|
4
4
  mapping.each_pair { |key, value| its([key]) { should == value } }
5
5
  end
6
6
 
7
7
  describe StackerBee::Rash do
8
8
  subject { rash }
9
9
 
10
- let(:wiz) { [{ "aB_C" => "abc" }, { "X_yZ" => "xyz" }] }
10
+ let(:wiz) { [{ 'aB_C' => 'abc' }, { 'X_yZ' => 'xyz' }] }
11
11
  let(:ziz) do
12
12
  {
13
- "M-om" => {
14
- "kI_d" => 2
13
+ 'M-om' => {
14
+ 'kI_d' => 2
15
15
  }
16
16
  }
17
17
  end
18
18
  let(:hash) do
19
19
  {
20
- "foo" => "foo",
21
- "b_iz" => "biz",
22
- "WiZ" => wiz,
20
+ 'foo' => 'foo',
21
+ 'b_iz' => 'biz',
22
+ 'WiZ' => wiz,
23
23
  :ziz => ziz
24
24
  }
25
25
  end
26
26
  let(:similar_hash) do
27
27
  hash.dup.tap do |loud|
28
- value = loud.delete "foo"
29
- loud["FOO"] = value
28
+ value = loud.delete 'foo'
29
+ loud['FOO'] = value
30
30
  end
31
31
  end
32
- let(:dissimilar_hash) { hash.dup.tap { |loud| loud.delete "foo" } }
32
+ let(:dissimilar_hash) { hash.dup.tap { |loud| loud.delete 'foo' } }
33
33
  let(:rash) { described_class.new(hash) }
34
34
 
35
- it { should include "FOO" }
35
+ it { should include 'FOO' }
36
36
 
37
37
  it { should == subject }
38
38
  it { should == subject.dup }
@@ -41,47 +41,47 @@ describe StackerBee::Rash do
41
41
  it { should == similar_hash }
42
42
  it { should_not == dissimilar_hash }
43
43
 
44
- it_behaves_like "a Rash",
45
- "FOO" => "foo",
46
- :foo => "foo",
47
- "foo" => "foo",
48
- "f_oo" => "foo",
49
- "BIZ" => "biz",
50
- :biz => "biz",
51
- "biz" => "biz",
52
- "b_iz" => "biz"
44
+ it_behaves_like 'a Rash',
45
+ 'FOO' => 'foo',
46
+ :foo => 'foo',
47
+ 'foo' => 'foo',
48
+ 'f_oo' => 'foo',
49
+ 'BIZ' => 'biz',
50
+ :biz => 'biz',
51
+ 'biz' => 'biz',
52
+ 'b_iz' => 'biz'
53
53
 
54
- context "enumerable value" do
55
- subject { rash["wiz"].first }
56
- it_behaves_like "a Rash", "ab_c" => "abc"
54
+ context 'enumerable value' do
55
+ subject { rash['wiz'].first }
56
+ it_behaves_like 'a Rash', 'ab_c' => 'abc'
57
57
  end
58
58
 
59
- context "nested hash value" do
60
- subject { rash["ziz"] }
61
- it_behaves_like "a Rash", "mom" => { "kid" => 2 }
59
+ context 'nested hash value' do
60
+ subject { rash['ziz'] }
61
+ it_behaves_like 'a Rash', 'mom' => { 'kid' => 2 }
62
62
 
63
- context "deeply nested hash value" do
64
- subject { rash["ziz"]["mom"] }
65
- it_behaves_like "a Rash", "kid" => 2
63
+ context 'deeply nested hash value' do
64
+ subject { rash['ziz']['mom'] }
65
+ it_behaves_like 'a Rash', 'kid' => 2
66
66
  end
67
67
  end
68
68
 
69
- describe "#select" do
70
- subject { rash.select { |key, value| value.is_a? String } }
69
+ describe '#select' do
70
+ subject { rash.select { |_, value| value.is_a? String } }
71
71
  it { should be_a described_class }
72
- it { should include "FOO" }
73
- it { should_not include "WIZ" }
72
+ it { should include 'FOO' }
73
+ it { should_not include 'WIZ' }
74
74
  end
75
75
 
76
- describe "#reject" do
77
- subject { rash.reject { |key, value| value.is_a? String } }
76
+ describe '#reject' do
77
+ subject { rash.reject { |_, value| value.is_a? String } }
78
78
  it { should be_a described_class }
79
- it { should include "WIZ" }
80
- it { should_not include "FOO" }
79
+ it { should include 'WIZ' }
80
+ it { should_not include 'FOO' }
81
81
  end
82
82
 
83
- describe "#values_at" do
84
- subject { rash.values_at "FOO", "WIZ", "WRONG" }
85
- it { should == ["foo", wiz, nil] }
83
+ describe '#values_at' do
84
+ subject { rash.values_at 'FOO', 'WIZ', 'WRONG' }
85
+ it { should == ['foo', wiz, nil] }
86
86
  end
87
87
  end
@@ -1,23 +1,23 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
- describe "An error occuring" do
3
+ describe 'An error occuring' do
4
4
  let(:env) { double(response: response) }
5
5
  let(:response) { double(status: status, error: error_text) }
6
- let(:error_text) { "There was an error!" }
6
+ let(:error_text) { 'There was an error!' }
7
7
  let(:status) { 431 }
8
8
 
9
- describe StackerBee::RequestError, ".for" do
9
+ describe StackerBee::RequestError, '.for' do
10
10
  subject { described_class.for(env) }
11
11
 
12
- context "HTTP status in the 400s" do
12
+ context 'HTTP status in the 400s' do
13
13
  let(:status) { 431 }
14
14
  it { should be_a StackerBee::ClientError }
15
15
  end
16
- context "HTTP status in the 500s" do
16
+ context 'HTTP status in the 500s' do
17
17
  let(:status) { 500 }
18
18
  it { should be_a StackerBee::ServerError }
19
19
  end
20
- context "HTTP status > 599" do
20
+ context 'HTTP status > 599' do
21
21
  let(:status) { 999 }
22
22
  it { should be_a StackerBee::RequestError }
23
23
  end