Module: Granite::ProjectorHelpers::ClassMethods

Defined in:
lib/granite/rspec/projector_helpers.rb

Instance Method Summary collapse

Instance Method Details

#draw_routes(&block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/granite/rspec/projector_helpers.rb', line 11

def draw_routes(&block)
  before(:all) do
    routes = Rails.application.routes
    routes.disable_clear_and_finalize = true
    routes.draw(&block)
  end

  after(:all) do
    Rails.application.routes.disable_clear_and_finalize = false
    Rails.application.reload_routes!
    Rails.application.routes.routes.clear_cache!
  end
end

#projector(&block) ⇒ Object



25
26
27
28
29
# File 'lib/granite/rspec/projector_helpers.rb', line 25

def projector(&block)
  setup_controller(&block)
  setup_view_context
  let(:projector) { controller.projector }
end