2011-07-26 00:00:35 +00:00
|
|
|
require 'rspec-cells'
|
|
|
|
require 'cell/test_case'
|
2011-08-13 23:24:02 +00:00
|
|
|
require 'rspec/rails/example/cell_example_group'
|
|
|
|
|
|
|
|
module CellsResetter
|
|
|
|
|
|
|
|
def self.method_missing(meth, *args)
|
|
|
|
if meth =~ /^new_(.*)_klass/
|
|
|
|
name = $1
|
|
|
|
|
|
|
|
klass_name = name.camelize
|
|
|
|
|
2011-11-26 06:24:34 +00:00
|
|
|
::Locomotive.send(:remove_const, klass_name)
|
|
|
|
load "locomotive/#{name}.rb"
|
2011-08-13 23:24:02 +00:00
|
|
|
|
2011-11-26 06:24:34 +00:00
|
|
|
"::Locomotive::#{klass_name}".constantize.any_instance.stubs(:sections).returns(args.first)
|
2011-08-13 23:24:02 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.clean!
|
|
|
|
[:menu_cell, :main_menu_cell, :global_actions_cell, :settings_menu_cell].each do |name|
|
2011-11-26 06:24:34 +00:00
|
|
|
::Locomotive.send(:remove_const, "#{name.to_s.camelize}")
|
|
|
|
load "locomotive/#{name}.rb"
|
2011-08-13 23:24:02 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-11-26 06:24:34 +00:00
|
|
|
end
|