Module: RSpec::Rails::CellExampleGroup

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

Overview

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

Defined Under Namespace

Classes: Content

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



67
68
69
70
71
72
73
74
# File 'lib/rspec/cells/cell_example_group.rb', line 67

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.



65
66
67
# File 'lib/rspec/cells/cell_example_group.rb', line 65

def controller
  @controller
end

#routesObject (readonly)

Returns the value of attribute routes.



65
66
67
# File 'lib/rspec/cells/cell_example_group.rb', line 65

def routes
  @routes
end

Instance Method Details

#cellObject



39
40
41
# File 'lib/rspec/cells/cell_example_group.rb', line 39

def cell(*)
  Content.new(super)
end

#render_cellObject

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


35
36
37
# File 'lib/rspec/cells/cell_example_group.rb', line 35

def render_cell(*)
  Capybara.string super
end