Class: Merb::Test::ExampleGroup

Inherits:
Spec::Example::ExampleGroup
  • Object
show all
Includes:
ControllerHelper, Matchers, RouteHelper, Webrat::Methods
Defined in:
lib/merb-core/test/test_ext/rspec.rb

Class Method Summary collapse

Methods included from MultipartRequestHelper

#dispatch_multipart_to, #multipart_fake_request, #multipart_post, #multipart_put, #multipart_request

Methods included from RequestHelper

#build_request, #check_request_for_route, #delete, #describe_input, #describe_request, #dispatch_request, #dispatch_to, #dispatch_with_basic_authentication_to, #fake_request, #get, #merge_controller_and_action, #mock_request, #post, #put, #requesting, #response_for, #status_code, #with_cookies

Methods included from MakeRequest

#request

Methods included from RouteHelper

#request_to, #resource, #url

Class Method Details

.describe(*args, &example_group_block) ⇒ Object Also known as: context

This is a copy of the method in rspec, so we can have describe “…”, :when => “logged in”, and the like


54
55
56
57
58
59
60
61
62
63
64
# File 'lib/merb-core/test/test_ext/rspec.rb', line 54

def describe(*args, &example_group_block)
  ret = super
  
  params = args.last.is_a?(Hash) ? args.last : {}
  if example_group_block
    params[:when] = params[:when] || params[:given]
    [params[:when]].flatten.compact.each do |w|
      ret.module_eval %{it_should_behave_like "#{w}"}
    end
  end
end

.given(*args, &example_group_block) ⇒ Object


67
68
69
70
71
72
73
74
# File 'lib/merb-core/test/test_ext/rspec.rb', line 67

def given(*args, &example_group_block)
  args << {} unless Hash === args.last
  params = args.last
  
  params[:shared] = true
  
  describe(*args, &example_group_block)
end