lbspec 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86e46129e9a44bc560ec269a223ae968e0bcb307
4
- data.tar.gz: df753021edf7e751a0a8d3e84e6555fec95bb615
3
+ metadata.gz: bc6f025cf48f9f28b899219aee4782724b75affe
4
+ data.tar.gz: bfaaad1d0182f19d0210f329d0a981a19151dad9
5
5
  SHA512:
6
- metadata.gz: 9590196fd3c452ca5c776d1b58ac1bb4be30edc43e4fbb21e32028bee97993d9cbffffcd71cfc243cec368a52fdc718990c8921ae4f84d48fcca9130c6ebbcc5
7
- data.tar.gz: 2c36467d20e08a8a11eb83ecf0138c1dad5ae7072f165ed419668fac40c69f9440f54b5302720448fd9d1a5e3c613d42f3ad4171278f770df6406bcb9a08dff4
6
+ metadata.gz: be891f0b85609b354e73c05fdc87bad1b03fa5e099744a25815d9eb2399e7eef34e083227fd00aa09dcc1178a91e0625475ff4fdfd1c3c5d1b5b61ba59b827bb
7
+ data.tar.gz: bef0f7f51636c4978f297957ce1853462c81e8dc33fa80db2be973ba89c4ca8515b12ab5b8c21a8869571f55bb724db5f2bfd3508521625d4a33f48de8077f87
@@ -8,6 +8,7 @@ RSpec::Matchers.define :respond do |expect|
8
8
  match do |vhost|
9
9
  fail ArgumentError, '#respond must have non-nil argument' unless expect
10
10
  log.debug("#respond(#{expect.inspect}) is called")
11
+ @vhost = vhost
11
12
  @expect = expect
12
13
  request =
13
14
  Lbspec::Request.new(vhost, @from,
@@ -67,20 +68,20 @@ RSpec::Matchers.define :respond do |expect|
67
68
  "respond #{@expect}#{@chain_str}."
68
69
  end
69
70
 
70
- failure_message_for_should do |vhost|
71
- result_string(vhost, @expect)
71
+ failure_message_for_should do
72
+ result_string
72
73
  end
73
74
 
74
- failure_message_for_should_not do |vhost|
75
+ failure_message_for_should_not do
75
76
  negative = true
76
- result_string(vhost, @expect, negative)
77
+ result_string(negative)
77
78
  end
78
79
 
79
- def result_string(vhost, expect, negative = false)
80
+ def result_string(negative = false)
80
81
  negation = negative ? ' not' : ''
81
- result = "expected #{vhost}#{negation} to respond #{expect}"
82
+ result = "expected #{@vhost}#{negation} to respond #{@expect}"
82
83
  result << ", but did#{negation}.\n" + "requested:\n"
83
- result << request_str.gsub(/^/, ' ')
84
+ result << @output_request.gsub(/^/, ' ')
84
85
  end
85
86
 
86
87
  def log
@@ -8,6 +8,7 @@ RSpec::Matchers.define :transfer do |nodes|
8
8
  match do |vhost|
9
9
  fail ArgumentError, '#transfer must have non-nil argument' unless nodes
10
10
  log.debug("#transfer(#{nodes.inspect}) is called")
11
+ @vhost = vhost
11
12
  prove = Lbspec::Util.create_prove
12
13
  capture =
13
14
  Lbspec::Capture.new(nodes, @port, prove, @include_str)
@@ -76,33 +77,33 @@ RSpec::Matchers.define :transfer do |nodes|
76
77
  "transfer requests to #{nodes}#{@chain_str}."
77
78
  end
78
79
 
79
- failure_message_for_should do |vhost|
80
- result_string(nodes, @chain_str, @output_request, @output_capture)
80
+ failure_message_for_should do
81
+ result_string
81
82
  end
82
83
 
83
- failure_message_for_should_not do |vhost|
84
+ failure_message_for_should_not do
84
85
  negative = true
85
- result_string(nodes, @chain_str, @output_request, @output_capture,
86
- negative)
86
+ result_string(negative)
87
87
  end
88
88
 
89
- def result_string(nodes, chain_str,
90
- request_str, capture_str, negative = false)
89
+ def result_string(negative = false)
91
90
  negation = negative ? ' not' : ''
92
- result = "expected #{vhost}#{negation} to transfer requests to"
93
- result << nodes.to_s + chain_str
91
+ result = "expected #{@vhost}#{negation} to transfer requests to"
92
+ result << @nodes.to_s + @chain_str
94
93
  result << ", but did#{negation}.\n" + "requested:\n"
95
- result << request_str.gsub(/^/, ' ')
94
+ result << @output_request.gsub(/^/, ' ')
96
95
  result << "\ncaptured:\n"
97
96
  result << result_capture
98
97
  result
99
98
  end
100
99
 
101
100
  def result_capture
101
+ result = ''
102
102
  @output_capture.each do |o|
103
103
  result << o[:node].gsub(/^/, ' ') + "\n"
104
104
  result << o[:output].gsub(/^/, ' ') + "\n"
105
105
  end
106
+ result
106
107
  end
107
108
 
108
109
  def log
data/lib/lbspec/util.rb CHANGED
@@ -53,12 +53,14 @@ module Lbspec
53
53
  Net::SSH.start(node, ssh_user(node), options) do |ssh|
54
54
  output << ssh.exec!(command).to_s
55
55
  end
56
+ output
56
57
  end
57
58
 
58
59
  def self.exec_command_local(command)
59
60
  output = command + "\n"
60
61
  log.debug("execute locally: #{command}")
61
62
  output << `#{command}`.to_s
63
+ output
62
64
  end
63
65
 
64
66
  def self.ssh_user(node)
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  # Lbspec is an RSpec plugin for easy Loadbalancer testing.
3
3
  module Lbspec
4
- VERSION = '0.2.7'
4
+ VERSION = '0.2.8'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lbspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - OTA Hiroshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-23 00:00:00.000000000 Z
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler