Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Namespace Validator object #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--format documentation
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
kube-dsl (0.1.0)
kube-dsl (0.2.0)
dry-inflector (~> 0.2)

GEM
Expand Down
1 change: 1 addition & 0 deletions lib/kube-dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module KubeDSL
autoload :ResourceMeta, 'kube-dsl/resource_meta'
autoload :StringHelpers, 'kube-dsl/string_helpers'
autoload :ValueFields, 'kube-dsl/value_fields'
autoload :Validator, 'kube-dsl/validator'

extend Entrypoint
end
1 change: 1 addition & 0 deletions lib/kube-dsl/dsl_object.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module KubeDSL
class DSLObject
extend ::KubeDSL::ValueFields
include ::KubeDSL::Validator

def initialize(&block)
instance_eval(&block) if block
Expand Down
9 changes: 9 additions & 0 deletions lib/kube-dsl/validator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'pry'

module KubeDSL
module Validator
def validate!
binding.pry
end
end
end
19 changes: 19 additions & 0 deletions lib/spec/kube-dsl/dsl/v1/namespace_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require './lib/spec/spec_helper'

describe KubeDSL::DSL::V1::Namespace do
subject(:object) { described_class.new }

describe '#validate!' do
context 'when metadata is an object' do
specify do
expect(object.validate!).to be_truthy
end
end

context 'when metadata is not an object' do
specify do
expect(object.validate!).to be_falsey
end
end
end
end
8 changes: 8 additions & 0 deletions lib/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'bundler/setup'
Bundler.setup

require 'kube-dsl'

RSpec.configure do |config|
# some (optional) config here
end