Skip to content

Commit 33f74b0

Browse files
committed
Extract DUMMY_ROOT to top level test_helper.rb
1 parent ae8f336 commit 33f74b0

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

test/features/console_helpers.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
module ConsoleHelpers
44
private
55

6-
DUMMY_RAILS = File.expand_path "../../dummy/bin/rails", __FILE__
7-
86
def with_pty
97
PTY.open do |primary, replica|
108
@primary, @replica = primary, replica
@@ -27,7 +25,7 @@ def spawn_console(options, wait_for_prompt: true, env: {})
2725

2826
pid = Process.spawn(
2927
env,
30-
"#{DUMMY_RAILS} console #{options}",
28+
"#{DUMMY_ROOT}/bin/rails console #{options}",
3129
in: @replica, out: @replica, err: @replica
3230
)
3331

test/features/runner_helpers.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
module RunnerHelpers
22
private
33

4-
DUMMY_RAILS = File.expand_path "../../dummy/bin/rails", __FILE__
5-
64
def assert_runner_puts(expected, subject, env: {})
75
env = env.with_defaults({"APP_ENV" => nil, "RAILS_ENV" => nil, "SECRET_KEY_BASE_DUMMY" => "1"})
86

9-
stdout, status = Open3.capture2(env, DUMMY_RAILS, "runner", "puts #{subject}")
7+
stdout, status = Open3.capture2(env, "#{DUMMY_ROOT}/bin/rails", "runner", "puts #{subject}")
108

119
assert_predicate status, :success?
1210
assert_equal expected.to_s, stdout.chomp

test/test_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
end
1414

1515
DEFAULT_RAILS_ENV = "development"
16+
17+
DUMMY_ROOT = File.expand_path "../dummy", __FILE__

0 commit comments

Comments
 (0)