Class: RailsProof::ControllerTestPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_proof/controller_test_plan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(inspector) ⇒ ControllerTestPlan

Returns a new instance of ControllerTestPlan.



5
6
7
# File 'lib/rails_proof/controller_test_plan.rb', line 5

def initialize(inspector)
  @inspector = inspector
end

Instance Attribute Details

#inspectorObject (readonly)

Returns the value of attribute inspector.



3
4
5
# File 'lib/rails_proof/controller_test_plan.rb', line 3

def inspector
  @inspector
end

Instance Method Details

#concernsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rails_proof/controller_test_plan.rb', line 9

def concerns
  @concerns ||= inspector.routes.filter_map do |route|
    next if route[:name].to_s.empty?

    {
      type: :controller_response,
      verb: route[:verb],
      path: route[:path],
      route_name: route[:name],
      action: route[:action],
      description: "#{route[:verb]} #{route[:path]} responds successfully"
    }
  end
end

#countObject



24
25
26
# File 'lib/rails_proof/controller_test_plan.rb', line 24

def count
  concerns.count
end