Skip to content

Commit b3adbb4

Browse files
stanhudblock
authored andcommitted
Fix eager loading due to ServeStream rename
ServeFile was renamed to ServeStream in ruby-grape#1520. Calling Grape.eager_load! would fail with: ``` uninitialized constant Grape::ServeFile (NameError) ```
1 parent 0d5cf40 commit b3adbb4

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ matrix:
2525
gemfile: gemfiles/rails_5.gemfile
2626
- rvm: 2.7.1
2727
gemfile: gemfiles/rails_6.gemfile
28+
- rvm: 2.7.1
29+
gemfile: Gemfile
30+
script:
31+
- bundle exec rspec spec/integration/eager_load
2832
- rvm: 2.7.1
2933
gemfile: gemfiles/multi_json.gemfile
3034
script:

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#### Features
44

5+
* [#2072](https://github.com/ruby-grape/grape/pull/2072): Fix eager loading due to ServeStream rename - [@stanhu](https://github.com/stanhu).
56
* [#1520](https://github.com/ruby-grape/grape/pull/1520): Un-deprecate stream-like objects - [@urkle](https://github.com/urkle).
67
* [#2060](https://github.com/ruby-grape/grape/pull/2060): Drop support for Ruby 2.4 - [@dblock](https://github.com/dblock).
78
* [#2060](https://github.com/ruby-grape/grape/pull/2060): Upgraded Rubocop to 0.84.0 - [@dblock](https://github.com/dblock).
@@ -10,9 +11,10 @@
1011

1112
#### Fixes
1213

13-
* Your contribution here.
1414
* [#2067](https://github.com/ruby-grape/grape/pull/2067): Coerce empty string to nil for all primitive types except String - [@petekinnecom](https://github.com/petekinnecom).
1515
* [#2064](https://github.com/ruby-grape/grape/pull/2064): Fix Ruby 2.7 deprecation warning in `Grape::Middleware::Base#initialize` - [@skarger](https://github.com/skarger).
16+
* [#2072](https://github.com/ruby-grape/grape/pull/2072): Fix `Grape.eager_load!` and `compile!` - [@stanhu](https://github.com/stanhu).
17+
* Your contribution here.
1618

1719
### 1.3.3 (2020/05/23)
1820

lib/grape/eager_load.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
Grape::DSL.eager_load!
1717
Grape::API.eager_load!
1818
Grape::Presenters.eager_load!
19-
Grape::ServeFile.eager_load!
19+
Grape::ServeStream.eager_load!
2020
Rack::Head # AutoLoads the Rack::Head
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
4+
require 'grape'
5+
6+
describe Grape do
7+
it 'eager_load!' do
8+
require 'grape/eager_load'
9+
expect { Grape.eager_load! }.to_not raise_error
10+
end
11+
12+
it 'compile!' do
13+
expect { Class.new(Grape::API).compile! }.to_not raise_error
14+
end
15+
end

0 commit comments

Comments
 (0)