Class: AuthorizedRailsScaffolds::RSpecScaffoldViewHelper

Inherits:
RSpecScaffoldHelper show all
Includes:
Macros::FactoryMacros
Defined in:
lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb

Instance Method Summary collapse

Methods included from Macros::FactoryMacros

#create_parent_resource_from_factory, #create_resource_from_factory, #factory_attribute_string, #factory_attribute_value

Methods inherited from RSpecScaffoldHelper

#modular_class_name, #parent_variables, #references_show_route

Methods included from Macros::TestVarMacros

#references_test_name, #references_test_sym, #references_test_var, #resource_test_name, #resource_test_sym, #resource_test_var

Methods inherited from Helper

#plural_var_name, #shallow_routes?, #var_name

Methods included from Macros::ResourceMacros

#resource_array_name, #resource_array_sym, #resource_array_var, #resource_class, #resource_directory, #resource_human_name, #resource_name, #resource_symbol, #resource_var

Methods included from Macros::PathMacros

#controller_edit_route, #controller_index_path, #controller_index_route, #controller_new_route, #controller_show_route, #references_show_route

Methods included from Macros::ParentMacros

#model_parent_name, #parent_model_names, #parent_models, #parent_module_groups, #parent_modules, #parent_sym, #parent_variable, #parent_variables

Constructor Details

#initialize(options = {}) ⇒ RSpecScaffoldViewHelper

Returns a new instance of RSpecScaffoldViewHelper.



4
5
6
# File 'lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb', line 4

def initialize(options = {})
  super options
end

Instance Method Details

#date_select_day_value(date_string) ⇒ Object



36
37
38
# File 'lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb', line 36

def date_select_day_value(date_string)
  DateTime.parse(date_string).strftime('%-d')
end

#date_select_hour_value(date_string) ⇒ Object



40
41
42
# File 'lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb', line 40

def date_select_hour_value(date_string)
  DateTime.parse(date_string).strftime('%H')
end

#date_select_minute_value(date_string) ⇒ Object



44
45
46
# File 'lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb', line 44

def date_select_minute_value(date_string)
  DateTime.parse(date_string).strftime('%M')
end

#date_select_month_text(date_string) ⇒ Object



32
33
34
# File 'lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb', line 32

def date_select_month_text(date_string)
  DateTime.parse(date_string).strftime('%B')
end

#date_select_month_value(date_string) ⇒ Object



28
29
30
# File 'lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb', line 28

def date_select_month_value(date_string)
  DateTime.parse(date_string).strftime('%-m')
end

#date_select_year_value(date_string) ⇒ Object



24
25
26
# File 'lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb', line 24

def date_select_year_value(date_string)
  DateTime.parse(date_string).strftime('%Y')
end

#datetime_attributesObject



20
21
22
# File 'lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb', line 20

def datetime_attributes
  @datetime_attributes ||= @attributes.reject{|attribute| ![:time, :date, :datetime].include? attribute.type }
end

#output_attributesObject



8
9
10
# File 'lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb', line 8

def output_attributes
  @output_attributes ||= @attributes.reject{|attribute| [:timestamp].include? attribute.type }
end

#references_attributesObject



12
13
14
# File 'lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb', line 12

def references_attributes
  @references_attributes ||= @attributes.reject{|attribute| ![:references].include? attribute.type }
end

#standard_attributesObject



16
17
18
# File 'lib/authorized_rails_scaffolds/rspec_scaffold_view_helper.rb', line 16

def standard_attributes
  @standard_attributes ||= @attributes.reject{|attribute| [:time, :date, :datetime, :references].include? attribute.type }
end