Skip to content

Commit 11dd15a

Browse files
Fix failing test regarding console change to fix sandboxing
Introduced in be3e10c.
1 parent e3c56ad commit 11dd15a

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

railties/test/commands/console_test.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ def test_console_with_environment
5858
end
5959

6060
def test_console_defaults_to_IRB
61-
config = mock("config", console: nil)
62-
app = mock("app", config: config)
63-
app.expects(:load_console).returns(nil)
64-
61+
app = build_app(console: nil)
6562
assert_equal IRB, Rails::Console.new(app).console
6663
end
6764

@@ -127,13 +124,15 @@ def start(argv = [])
127124
end
128125

129126
def app
130-
@app ||= begin
131-
config = mock("config", console: FakeConsole)
132-
app = mock("app", config: config)
133-
app.stubs(:sandbox=).returns(nil)
134-
app.expects(:load_console)
135-
app
136-
end
127+
@app ||= build_app(console: FakeConsole)
128+
end
129+
130+
def build_app(config)
131+
config = mock("config", config)
132+
app = mock("app", config: config)
133+
app.stubs(:sandbox=).returns(nil)
134+
app.expects(:load_console)
135+
app
137136
end
138137

139138
def parse_arguments(args)

0 commit comments

Comments
 (0)