Skip to content

Commit 9f11cdf

Browse files
committed
test: check that the transmission policy stays denied
Review feedback on #83. The recipe promises that four policies stay denied, but the smoke check verified only three. Add authorize_transmission to DENIED_POLICIES. With the generator template changed to grant transmissions, rake quickstart now fails with "authorize_transmission stays denied"; with the real template it passes. Remove two guards that cannot fire: __dir__ is never nil when Ruby loads the file, and initialize sets @root before call runs. Name the Integer values that the two proof methods return instead of untyped.
1 parent 7d2202f commit 9f11cdf

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎examples/quickstart/smoke.rb‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ class Failure < StandardError; end
1515
HoldProcess = Data.define(:buyer, :pid, :input, :output)
1616

1717
REPOSITORY_ROOT = File.expand_path("../..", __dir__)
18-
QUICKSTART_ROOT = __dir__ || raise(Failure, "the quickstart directory is unknown")
18+
QUICKSTART_ROOT = __dir__
1919
ACTOR_PATH = File.join(QUICKSTART_ROOT, "app/actors/ticket_sale.rb")
2020
RECIPE_PATH = File.join(QUICKSTART_ROOT, "README.md")
2121
INITIALIZER = "config/initializers/solid_objects.rb"
2222
DEMO_GRANTS = {
2323
"configuration.authorize_message = ->(**) { false }" => "configuration.authorize_message = ->(**) { true }",
2424
"configuration.authorize_query = ->(**) { false }" => "configuration.authorize_query = ->(**) { true }"
2525
}.freeze
26-
DENIED_POLICIES = %w[authorize_destroy authorize_subscription authorize_administration].freeze
26+
DENIED_POLICIES = %w[authorize_destroy authorize_subscription authorize_administration authorize_transmission].freeze
2727
CONCURRENT_BUYERS = 8
2828
RESTART_DEADLINE_SECONDS = 8
2929
COMMAND_TIMEOUT_SECONDS = 600
@@ -107,7 +107,7 @@ def call
107107
)
108108
ensure
109109
stop_children
110-
FileUtils.remove_entry(@root) if @root && File.exist?(@root)
110+
FileUtils.remove_entry(@root) if File.exist?(@root)
111111
end
112112

113113
private
@@ -217,7 +217,7 @@ def grant_demo_policies
217217
File.write(path, initializer)
218218
end
219219

220-
# @rbs () -> Hash[Symbol, untyped]
220+
# @rbs () -> Hash[Symbol, Integer]
221221
def prove_concurrent_holds
222222
runtime = start_runtime("runtime-concurrency")
223223
buyers = (1..CONCURRENT_BUYERS).map { |number| "buyer-#{number}" }
@@ -239,7 +239,7 @@ def prove_concurrent_holds
239239
{ calls: buyers.length, held: winners.length, available: state.fetch("available") }
240240
end
241241

242-
# @rbs () -> Hash[Symbol, untyped]
242+
# @rbs () -> Hash[Symbol, Integer]
243243
def prove_restart_recovery
244244
hold = JSON.parse(
245245
rails_runner("shifted-hold", SHIFTED_CLOCK_HOLD_PROGRAM, "matinee", "ada", RESTART_DEADLINE_SECONDS.to_s).lines.last

0 commit comments

Comments
 (0)