Module: NitroKit::UpgradeSmoke::RouteLifecycle

Defined in:
lib/nitro_kit/upgrade_smoke_test.rb

Constant Summary collapse

ROUTE_BLOCK =
proc do
  get PATH, to: Controller.action(:show)
  patch PATH, to: Controller.action(:update)
end

Class Method Summary collapse

Class Method Details

.install!(owner) ⇒ Object



154
155
156
157
158
159
160
161
162
163
# File 'lib/nitro_kit/upgrade_smoke_test.rb', line 154

def install!(owner)
  ensure_test_environment!

  @lock.synchronize do
    return if @owners.include?(owner)

    install_routes! if @owners.empty?
    @owners.add(owner)
  end
end

.uninstall!(owner) ⇒ Object



165
166
167
168
169
170
# File 'lib/nitro_kit/upgrade_smoke_test.rb', line 165

def uninstall!(owner)
  @lock.synchronize do
    @owners.delete(owner)
    uninstall_routes! if @owners.empty? && route_block_installed?
  end
end