Module: Dicer::RSpec::ContextExampleGroup::ClassMethods
- Defined in:
- lib/dicer/rspec/context_example_group.rb
Instance Method Summary collapse
- #controller(base_class = ::ApplicationController, &block) ⇒ Object
- #request(env = nil, &block) ⇒ Object
Instance Method Details
#controller(base_class = ::ApplicationController, &block) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/dicer/rspec/context_example_group.rb', line 32 def controller(base_class = ::ApplicationController, &block) [:controller] = Class.new(base_class) do def self.name; 'AnonymouseController'; end end [:controller].class_eval(&block) if block end |
#request(env = nil, &block) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/dicer/rspec/context_example_group.rb', line 39 def request(env = nil, &block) test_request = ::ActionController::TestRequest.new(env) test_request.instance_eval(&block) if block [:request] = test_request end |