Skip to content

Commit dda76e8

Browse files
committed
Move test controllers into fixtures directory.
1 parent 5d8dffb commit dda76e8

File tree

6 files changed

+29
-8
lines changed

6 files changed

+29
-8
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module Async
2+
module Container
3+
module Controllers
4+
ROOT = File.join(__dir__, "controllers")
5+
6+
def self.path_for(controller)
7+
File.join(ROOT, "#{controller}.rb")
8+
end
9+
end
10+
end
11+
end

test/async/container/.bad.rb renamed to fixtures/async/container/controllers/bad.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Released under the MIT License.
55
# Copyright, 2024, by Samuel Williams.
66

7-
require_relative "../../../lib/async/container/controller"
7+
require_relative "../../../../lib/async/container/controller"
88

99
$stdout.sync = true
1010

test/async/container/.dots.rb renamed to fixtures/async/container/controllers/dots.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Released under the MIT License.
55
# Copyright, 2020-2025, by Samuel Williams.
66

7-
require_relative "../../../lib/async/container/controller"
7+
require_relative "../../../../lib/async/container/controller"
88

99
$stdout.sync = true
1010

test/async/container/.graceful.rb renamed to fixtures/async/container/controllers/graceful.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Released under the MIT License.
55
# Copyright, 2024-2025, by Samuel Williams.
66

7-
require_relative "../../../lib/async/container/controller"
7+
require_relative "../../../../lib/async/container/controller"
88

99
$stdout.sync = true
1010

test/async/container/.cwd.rb renamed to fixtures/async/container/controllers/working_directory.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Released under the MIT License.
55
# Copyright, 2024, by Samuel Williams.
66

7-
require_relative "../../../lib/async/container/controller"
7+
require_relative "../../../../lib/async/container/controller"
88

99
$stdout.sync = true
1010

test/async/container/controller.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@
44
# Copyright, 2018-2025, by Samuel Williams.
55

66
require "async/container/controller"
7+
require "async/container/controllers"
78

89
describe Async::Container::Controller do
910
let(:controller) {subject.new}
1011

12+
with "#to_s" do
13+
it "can generate string representation" do
14+
expect(controller.to_s).to be == "Async::Container::Controller stopped"
15+
end
16+
end
17+
1118
with "#reload" do
1219
it "can reuse keyed child" do
1320
input, output = IO.pipe
@@ -37,6 +44,9 @@ def controller.setup(container)
3744
end
3845

3946
controller.start
47+
48+
expect(controller.state_string).to be == "running"
49+
4050
expect(input.read(2)).to be == ".,"
4151

4252
controller.reload
@@ -89,7 +99,7 @@ def controller.setup(container)
8999
end
90100

91101
with "graceful controller" do
92-
let(:controller_path) {File.expand_path(".graceful.rb", __dir__)}
102+
let(:controller_path) {Async::Container::Controllers.path_for("graceful")}
93103

94104
let(:pipe) {IO.pipe}
95105
let(:input) {pipe.first}
@@ -128,7 +138,7 @@ def after(error = nil)
128138
end
129139

130140
with "bad controller" do
131-
let(:controller_path) {File.expand_path(".bad.rb", __dir__)}
141+
let(:controller_path) {Async::Container::Controllers.path_for("bad")}
132142

133143
let(:pipe) {IO.pipe}
134144
let(:input) {pipe.first}
@@ -160,7 +170,7 @@ def after(error = nil)
160170
end
161171

162172
with "signals" do
163-
let(:controller_path) {File.expand_path(".dots.rb", __dir__)}
173+
let(:controller_path) {Async::Container::Controllers.path_for("dots")}
164174

165175
let(:pipe) {IO.pipe}
166176
let(:input) {pipe.first}
@@ -208,7 +218,7 @@ def after(error = nil)
208218
end
209219

210220
with "working directory" do
211-
let(:controller_path) {File.expand_path(".cwd.rb", __dir__)}
221+
let(:controller_path) {Async::Container::Controllers.path_for("working_directory")}
212222

213223
it "can change working directory" do
214224
pipe = IO.pipe

0 commit comments

Comments
 (0)