class AuthorizedRailsScaffolds::RSpecScaffoldHelper

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method AuthorizedRailsScaffolds::Helper::new
# File lib/authorized_rails_scaffolds/rspec_scaffold_helper.rb, line 4
def initialize(options = {})
  super options

  @modular_class_name = options[:class_name] || options[:local_class_name]
  @attributes = options[:attributes]
end

Public Instance Methods

describe_nesting_comment() click to toggle source
# File lib/authorized_rails_scaffolds/rspec_scaffold_helper.rb, line 47
def describe_nesting_comment
  if parent_model_names.any?
    "within #{parent_model_names.join('/')} nesting"
  else
    "Within default nesting"
  end
end
end_nesting_block() click to toggle source
# File lib/authorized_rails_scaffolds/rspec_scaffold_helper.rb, line 43
def end_nesting_block
  'end'
end
modular_class_name() click to toggle source

Class name with parent modules included (i.e. Example::FooBar) Name of class assumed by default generators, used as a base for determining modules and class

# File lib/authorized_rails_scaffolds/rspec_scaffold_helper.rb, line 13
def modular_class_name
  @modular_class_name
end
parent_variables(use_shallow_route=false) click to toggle source
# File lib/authorized_rails_scaffolds/rspec_scaffold_helper.rb, line 17
def parent_variables(use_shallow_route=false)
  @parent_variables ||= parent_model_names.collect{ |parent_table| references_test_name(parent_table) }
  use_shallow_route ? @parent_variables[0..-2] : @parent_variables
end
references_show_route(attribute_name, variable = nil) click to toggle source
# File lib/authorized_rails_scaffolds/rspec_scaffold_helper.rb, line 22
def references_show_route(attribute_name, variable = nil)
  variable ||= "#{resource_test_name}.#{attribute_name}"
  super attribute_name, variable
end
start_nesting_block() click to toggle source
# File lib/authorized_rails_scaffolds/rspec_scaffold_helper.rb, line 27
def start_nesting_block
  if parent_model_names.any?
    "context \"within #{parent_model_names.join('/')} nesting\" do"
  else
    'context do # Within default nesting'
  end
end
start_shallow_nesting_block() click to toggle source
# File lib/authorized_rails_scaffolds/rspec_scaffold_helper.rb, line 35
def start_shallow_nesting_block
  if shallow_routes?
    'context do # Within shallow nesting'
  else
    start_nesting_block
  end
end