Module: RSpec::Rails::CellExampleGroup

Extended by:
ActiveSupport::Concern
Includes:
ActionController::UrlFor, Cell::TestCase::TestMethods, RailsExampleGroup, Webrat::Matchers, Webrat::Methods
Defined in:
lib/rspec/rails/example/cell_example_group.rb

Overview

Lets you call #render_cell in Rspec2. Move your cell specs to spec/cells/.

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/rspec/rails/example/cell_example_group.rb', line 43

def method_missing(method, *args, &block)
  # Send the route helpers to the application router.
  if @routes && @routes.named_routes.helpers.include?(method)
    @controller.send(method, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



41
42
43
# File 'lib/rspec/rails/example/cell_example_group.rb', line 41

def controller
  @controller
end

#routesObject (readonly)

Returns the value of attribute routes.



41
42
43
# File 'lib/rspec/rails/example/cell_example_group.rb', line 41

def routes
  @routes
end

Instance Method Details

#render_cell(*args) ⇒ Object

Overwrite to wrap render_cell into a Capybara custom string with a lot of matchers.

Read more at:

The Capybara.string method documentation:

- http://rubydoc.info/github/jnicklas/capybara/master/Capybara#string-class_method

Return value is an instance of Capybara::Node::Simple

- http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Simple

That expose all the methods from the following capybara modules:

- http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Matchers
- http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Finders


36
37
38
# File 'lib/rspec/rails/example/cell_example_group.rb', line 36

def render_cell(*args)
  Capybara.string super
end