Class: ShouldaRouting::Routes::Spec
- Inherits:
-
Object
- Object
- ShouldaRouting::Routes::Spec
- Defined in:
- lib/shoulda_routing/routes/spec.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#method ⇒ Object
Returns the value of attribute method.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
-
#via ⇒ Object
Returns the value of attribute via.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
5 6 7 |
# File 'lib/shoulda_routing/routes/spec.rb', line 5 def action @action end |
#controller ⇒ Object
Returns the value of attribute controller.
5 6 7 |
# File 'lib/shoulda_routing/routes/spec.rb', line 5 def controller @controller end |
#method ⇒ Object
Returns the value of attribute method.
5 6 7 |
# File 'lib/shoulda_routing/routes/spec.rb', line 5 def method @method end |
#params ⇒ Object
Returns the value of attribute params.
5 6 7 |
# File 'lib/shoulda_routing/routes/spec.rb', line 5 def params @params end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/shoulda_routing/routes/spec.rb', line 5 def path @path end |
#via ⇒ Object
Returns the value of attribute via.
5 6 7 |
# File 'lib/shoulda_routing/routes/spec.rb', line 5 def via @via end |
Class Method Details
.execute {|generator| ... } ⇒ Object
22 23 24 25 26 |
# File 'lib/shoulda_routing/routes/spec.rb', line 22 def self.execute generator = self.new yield(generator) if block_given? generator.test! end |
Instance Method Details
#test! ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/shoulda_routing/routes/spec.rb', line 7 def test! via = @via || :get path = @path || "/" controller = @controller || "" action = @action || :index params = @params || {} method = @method || :to RSpec::Core::DSL.describe type: :routing do it "routes to #{path}" do expect(via => path).send method, route_to("#{controller}##{action}", params) end end end |