Skip to content

Commit 497ed1b

Browse files
committed
[test] use Railtie sub-class to resemble _real_ Rails
1 parent a59475d commit 497ed1b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/spec/ruby/jruby/rack/rails_booter_spec.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@
101101

102102
RAILS_ROOT_DIR = File.expand_path("../../../rails", __FILE__)
103103

104-
# NOTE: specs currently only test with a stubbed Rails::Railtie
105-
describe "Rails (stubbed)", :lib => :stub do
104+
describe "Rails (stubbed)", :lib => :stub do # NOTE: specs currently only test with a stubbed Rails::Railtie
106105

107106
before :all do
108107
$LOAD_PATH.unshift File.join(RAILS_ROOT_DIR, 'stub') # for require 'rails/railtie'
@@ -126,6 +125,8 @@
126125
$servlet_context = nil
127126
end
128127

128+
let(:railtie_class) { Class.new(Rails::Railtie) }
129+
129130
it "should have loaded the railtie" do
130131
defined?(JRuby::Rack::Railtie).should_not be nil
131132
end
@@ -137,8 +138,8 @@
137138
app = double("app"); app.stub_chain(:config, :paths).and_return(paths)
138139
public_path = Pathname.new(booter.public_path)
139140

140-
Rails::Railtie.config.__before_configuration.size.should == 1
141-
before_config = Rails::Railtie.config.__before_configuration.first
141+
railtie_class.config.__before_configuration.size.should == 1
142+
before_config = railtie_class.config.__before_configuration.first
142143
before_config.should_not be nil
143144

144145
before_config.call(app)
@@ -155,7 +156,7 @@
155156
app = double("app"); app.stub_chain(:config, :paths).and_return(paths)
156157
JRuby::Rack.public_path = nil
157158

158-
before_config = Rails::Railtie.config.__before_configuration.first
159+
before_config = railtie_class.config.__before_configuration.first
159160
before_config.should_not be nil
160161
before_config.call(app)
161162

0 commit comments

Comments
 (0)