Skip to content

Commit

Permalink
Add a library that can automatically add view helpers to view specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Seung-Hyo Choi committed Sep 9, 2014
1 parent 829a560 commit ab9dec7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/bootstrap_haml_helpers/spec_view_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module BootstrapHamlHelpers
module SpecViewHelpers
def self.included(base)
base.class_eval do
helper BootstrapHamlHelpers::ApplicationHelper if respond_to?(:helper)

before do
if respond_to?(:view)
BootstrapHamlHelpers::Component::Base.init_context(view)
view.stub(:set_page_title)
view.stub(:add_metatag)
end
end

after do
BootstrapHamlHelpers::Component::Base.teardown_context if respond_to?(:view)
end
end
end
end
end

0 comments on commit ab9dec7

Please sign in to comment.