Skip to content

Commit

Permalink
fix new rubocop 0.30 offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
abonas committed Apr 7, 2015
1 parent 5d26380 commit 223721e
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions kubeclient.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
spec.license = 'MIT'

spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
spec.required_ruby_version = '>= 2.0.0'

Expand Down
8 changes: 4 additions & 4 deletions lib/kubeclient/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ def rest_client
ssl_client_cert: @ssl_options[:client_cert],
ssl_client_key: @ssl_options[:client_key]
}
endpoint_with_version = @api_endpoint.merge(@api_endpoint.path + '/' \
+ @api_version)
endpoint_with_version = @api_endpoint.merge(@api_endpoint.path + '/' +
@api_version)
RestClient::Resource.new(endpoint_with_version, options)
end
end

def watch_entities(entity_type, resource_version = nil)
resource_name = get_resource_name(entity_type.to_s)

uri = @api_endpoint.merge(@api_endpoint.path + '/' + @api_version \
+ '/watch/' + resource_name)
uri = @api_endpoint.merge(@api_endpoint.path + '/' + @api_version +
'/watch/' + resource_name)

unless resource_version.nil?
uri.query = URI.encode_www_form('resourceVersion' => resource_version)
Expand Down
22 changes: 11 additions & 11 deletions test/test_kubeclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_no_version_passed
end

def test_exception
stub_request(:post, /\/services/)
stub_request(:post, %r{/services})
.to_return(body: open_test_json_file('namespace_exception_b3.json'),
status: 409)

Expand Down Expand Up @@ -107,7 +107,7 @@ def test_api_valid_with_non_json
end

def test_nonjson_exception
stub_request(:get, /\/servic/)
stub_request(:get, %r{/servic})
.to_return(body: open_test_json_file('service_illegal_json_404.json'),
status: 404)

Expand All @@ -123,7 +123,7 @@ def test_nonjson_exception
end

def test_entity_list
stub_request(:get, /\/services/)
stub_request(:get, %r{/services})
.to_return(body: open_test_json_file('entity_list_b3.json'),
status: 200)

Expand All @@ -139,7 +139,7 @@ def test_entity_list
end

def test_empty_list
stub_request(:get, /\/pods/)
stub_request(:get, %r{/pods})
.to_return(body: open_test_json_file('empty_pod_list_b3.json'),
status: 200)

Expand All @@ -150,30 +150,30 @@ def test_empty_list
end

def test_get_all
stub_request(:get, /\/services/)
stub_request(:get, %r{/services})
.to_return(body: open_test_json_file('service_list_b3.json'),
status: 200)

stub_request(:get, /\/pods/)
stub_request(:get, %r{/pods})
.to_return(body: open_test_json_file('pod_list_b3.json'),
status: 200)

stub_request(:get, /\/nodes/)
stub_request(:get, %r{/nodes})
.to_return(body: open_test_json_file('node_list_b3.json'),
status: 200)

stub_request(:get, /\/replicationcontrollers/)
stub_request(:get, %r{/replicationcontrollers})
.to_return(body: open_test_json_file('replication_controller_list_' \
'b3.json'), status: 200)

stub_request(:get, /\/events/)
stub_request(:get, %r{/events})
.to_return(body: open_test_json_file('event_list_b3.json'), status: 200)

stub_request(:get, /\/endpoints/)
stub_request(:get, %r{/endpoints})
.to_return(body: open_test_json_file('endpoint_list_b3.json'),
status: 200)

stub_request(:get, /\/namespaces/)
stub_request(:get, %r{/namespaces})
.to_return(body: open_test_json_file('namespace_list_b3.json'),
status: 200)

Expand Down
4 changes: 2 additions & 2 deletions test/test_namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Namespace entity tests
class TestNamespace < MiniTest::Test
def test_get_namespace_v1beta3
stub_request(:get, /\/namespaces/)
stub_request(:get, %r{/namespaces})
.to_return(body: open_test_json_file('namespace_b3.json'),
status: 200)

Expand All @@ -21,7 +21,7 @@ def test_delete_namespace_v1beta3
our_namespace = Kubeclient::Namespace.new
our_namespace.name = 'staging'

stub_request(:delete, /\/namespaces/)
stub_request(:delete, %r{/namespaces})
.to_return(status: 200)

client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
Expand Down
2 changes: 1 addition & 1 deletion test/test_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Node entity tests
class TestNode < MiniTest::Test
def test_get_from_json_v3
stub_request(:get, /\/nodes/)
stub_request(:get, %r{/nodes})
.to_return(body: open_test_json_file('node_b3.json'),
status: 200)

Expand Down
2 changes: 1 addition & 1 deletion test/test_pod.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Pod entity tests
class TestPod < MiniTest::Test
def test_get_from_json_v3
stub_request(:get, /\/pods/)
stub_request(:get, %r{/pods})
.to_return(body: open_test_json_file('pod_b3.json'),
status: 200)

Expand Down
2 changes: 1 addition & 1 deletion test/test_replication_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Replication Controller entity tests
class TestReplicationController < MiniTest::Test
def test_get_from_json_v3
stub_request(:get, /\/replicationcontrollers/)
stub_request(:get, %r{/replicationcontrollers})
.to_return(body: open_test_json_file('replication_controller_b3.json'),
status: 200)

Expand Down
4 changes: 2 additions & 2 deletions test/test_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_construct_our_own_service
end

def test_conversion_from_json_v3
stub_request(:get, /\/services/)
stub_request(:get, %r{/services})
.to_return(body: open_test_json_file('service_b3.json'),
status: 200)

Expand Down Expand Up @@ -50,7 +50,7 @@ def test_delete_service
our_service.labels.component = 'apiserver'
our_service.labels.provider = 'kubernetes'

stub_request(:delete, /\/services/)
stub_request(:delete, %r{/services})
.to_return(status: 200)

client = Kubeclient::Client.new 'http://localhost:8080/api/', 'v1beta3'
Expand Down

0 comments on commit 223721e

Please sign in to comment.