class Aygabtu::Generator
Public Class Methods
new(scope, example_group)
click to toggle source
# File lib/aygabtu/generator.rb, line 5 def initialize(scope, example_group) @scope, @example_group = scope, example_group end
Private Instance Methods
example(route, visiting_data)
click to toggle source
# File lib/aygabtu/generator.rb, line 23 def example(route, visiting_data) # it is an error to pass too few data, catch where? statements = [ "self.aygabtu_path_to_visit = aygabtu_pass_to_route(#{route.object_id}, #{visiting_data.inspect})", "aygabtu_example_for(aygabtu_path_to_visit)" ] message = it_message(route, visiting_data) "it(#{message.inspect}) { #{statements.join('; ')} }" end
it_message(route, visiting_data)
click to toggle source
# File lib/aygabtu/generator.rb, line 50 def it_message(route, visiting_data) params_message = if visiting_data.empty? "without parameters" else "with parameters #{visiting_data.inspect}" end "passes aygabtu assertions for #{route.inspect} #{params_message}" end
no_match_failing_example(action)
click to toggle source
# File lib/aygabtu/generator.rb, line 44 def no_match_failing_example(action) error_message = "No matching route (action was: #{action.inspect}, diagnostics: #{@scope.inspect}" "it('is treated as an error by aygabtu when no route matches') { raise #{error_message.inspect} }" end
pending_example(route, reason)
click to toggle source
# File lib/aygabtu/generator.rb, line 34 def pending_example(route, reason) # We must disable the example in such a way that before hooks are not executed. # I could not find a way of doing this in such a way that RSpec actually takes the reason for # the pending string instead of "Not yet implemented". message = pending_message(route) "it(#{message.inspect}, skip: #{reason.inspect})" end
pending_message(route)
click to toggle source
# File lib/aygabtu/generator.rb, line 60 def pending_message(route) "passes aygabtu assertions for #{route.inspect}" end