Skip to content

Commit

Permalink
Spec given? with multipart param
Browse files Browse the repository at this point in the history
  • Loading branch information
solebared committed Mar 25, 2021
1 parent c9d5608 commit 391dc5f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions spec/active_interaction/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,41 @@ def execute
expect(result).to be false
end
end

context 'multi-part date values' do
let(:described_class) do
Class.new(TestInteraction) do
date :thing,
default: nil

def execute
given?(:thing)
end
end
end

it 'is false when the input is not given' do
expect(result).to be false
end

it 'is true when the input is given' do
inputs.merge!(
'thing(1i)' => '2020',
'thing(2i)' => '12',
'thing(3i)' => '31'
)
expect(result).to be true
end

it 'is true when the input is given' do
inputs.merge!(
'thing(1i)' => nil,
'thing(2i)' => nil,
'thing(3i)' => nil
)
expect(result).to be true
end
end
end

context 'inheritance' do
Expand Down

0 comments on commit 391dc5f

Please sign in to comment.