Skip to content

Commit

Permalink
Skip endless range tests with ActiveSupport < 6.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed May 9, 2023
1 parent aafcbe7 commit 0e5c824
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,7 @@ params do
end
```

Note endless ranges are also supported but they require that the type be provided.
Note endless ranges are also supported with ActiveSupport >= 6.0, but they require that the type be provided.

```ruby
params do
Expand Down
4 changes: 2 additions & 2 deletions spec/grape/validations/validators/values_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,13 @@ def include?(value)
expect(last_response.body).to eq({ error: 'type does not have a valid value' }.to_json)
end

it 'validates against values in an endless range' do
it 'validates against values in an endless range', if: ActiveSupport::VERSION::MAJOR >= 6 do
get('/endless', type: 10)
expect(last_response.status).to eq 200
expect(last_response.body).to eq({ type: 10 }.to_json)
end

it 'does not allow an invalid value for a parameter using an endless range' do
it 'does not allow an invalid value for a parameter using an endless range', if: ActiveSupport::VERSION::MAJOR >= 6 do
get('/endless', type: 0)
expect(last_response.status).to eq 400
expect(last_response.body).to eq({ error: 'type does not have a valid value' }.to_json)
Expand Down

0 comments on commit 0e5c824

Please sign in to comment.