lib/stair_master/concerns/tests.rb in stair_master-0.0.1 vs lib/stair_master/concerns/tests.rb in stair_master-0.0.2
- old
+ new
@@ -12,22 +12,32 @@
:on_last_step?
end
## Methods ------------------------------------------
def on_last_step?
- @stair_master_on_last_step ||= current_step_name == available_steps.last
+ @stair_master_on_last_step ||= is_last_step?(current_step_name)
end
def on_first_step?
- @stair_master_on_first_step ||= current_step_name == available_steps.first
+ @stair_master_on_first_step ||= is_first_step?(current_step_name)
end
def is_last_step?(step_name)
step_name == available_steps.last
end
def is_first_step?(step_name)
step_name == available_steps.first
+ end
+
+ def is_available_step?(step=nil)
+ step_name = step.nil? ? controller_name.to_sym : step.key
+ available_steps.include? step_name
+ end
+
+ def step_should_be_skipped?(step=nil)
+ step = step.nil? ? current_step : step
+ step.skip?(self)
end
end
end
end
\ No newline at end of file