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
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Instance Method Summary collapse
- #cell ⇒ Object
- #method_missing(method, *args, &block) ⇒ Object
-
#render_cell ⇒ Object
Overwrite to wrap render_cell into a Capybara custom string with a lot of matchers.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/rspec/cells/cell_example_group.rb', line 62 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
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
60 61 62 |
# File 'lib/rspec/cells/cell_example_group.rb', line 60 def controller @controller end |
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
60 61 62 |
# File 'lib/rspec/cells/cell_example_group.rb', line 60 def routes @routes end |
Instance Method Details
#cell ⇒ Object
39 40 41 |
# File 'lib/rspec/cells/cell_example_group.rb', line 39 def cell(*) Content.new(super) end |
#render_cell ⇒ 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
35 36 37 |
# File 'lib/rspec/cells/cell_example_group.rb', line 35 def render_cell(*) Capybara.string super end |