Skip to content

Commit

Permalink
removed validations for the filter/risk/log endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
bartes committed Jun 11, 2021
1 parent de1faf2 commit a3a12b4
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 84 deletions.
1 change: 0 additions & 1 deletion lib/castle/commands/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class << self
# @param options [Hash]
# @return [Castle::Command]
def build(options = {})
Castle::Validators::Present.call(options, %i[event])
context = Castle::Context::Sanitize.call(options[:context])

Castle::Command.new(
Expand Down
1 change: 0 additions & 1 deletion lib/castle/commands/log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class << self
# @param options [Hash]
# @return [Castle::Command]
def build(options = {})
Castle::Validators::Present.call(options, %i[event])
context = Castle::Context::Sanitize.call(options[:context])

Castle::Command.new(
Expand Down
1 change: 0 additions & 1 deletion lib/castle/commands/risk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class << self
# @param options [Hash]
# @return [Castle::Command]
def build(options = {})
Castle::Validators::Present.call(options, %i[event])
context = Castle::Context::Sanitize.call(options[:context])

Castle::Command.new(
Expand Down
27 changes: 0 additions & 27 deletions spec/lib/castle/commands/filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,4 @@
it { expect(command.data).to be_eql(command_data) }
end
end

describe '#validate!' do
subject(:validate!) { instance.build(payload) }

context 'with event not present' do
let(:payload) { {} }

it do
expect { validate! }.to raise_error(
Castle::InvalidParametersError,
'event is missing or empty'
)
end
end

context 'with user not present' do
let(:payload) { { event: '$login' } }

it { expect { validate! }.not_to raise_error }
end

context 'with event and user present' do
let(:payload) { { event: '$login', user: user } }

it { expect { validate! }.not_to raise_error }
end
end
end
27 changes: 0 additions & 27 deletions spec/lib/castle/commands/log_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,4 @@
it { expect(command.data).to be_eql(command_data) }
end
end

describe '#validate!' do
subject(:validate!) { instance.build(payload) }

context 'with event not present' do
let(:payload) { {} }

it do
expect { validate! }.to raise_error(
Castle::InvalidParametersError,
'event is missing or empty'
)
end
end

context 'with user not present' do
let(:payload) { { event: '$login' } }

it { expect { validate! }.not_to raise_error }
end

context 'with event and user present' do
let(:payload) { { event: '$login', user: user } }

it { expect { validate! }.not_to raise_error }
end
end
end
27 changes: 0 additions & 27 deletions spec/lib/castle/commands/risk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,4 @@
it { expect(command.data).to be_eql(command_data) }
end
end

describe '#validate!' do
subject(:validate!) { instance.build(payload) }

context 'with event not present' do
let(:payload) { {} }

it do
expect { validate! }.to raise_error(
Castle::InvalidParametersError,
'event is missing or empty'
)
end
end

context 'with user not present' do
let(:payload) { { event: '$login' } }

it { expect { validate! }.not_to raise_error }
end

context 'with event and user present' do
let(:payload) { { event: '$login', user: user } }

it { expect { validate! }.not_to raise_error }
end
end
end

0 comments on commit a3a12b4

Please sign in to comment.