Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/arbre.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ module Arbre
require 'arbre/component'

if defined?(Rails)
require 'arbre/rails'
require 'arbre/railtie'
end
6 changes: 0 additions & 6 deletions lib/arbre/rails.rb

This file was deleted.

1 change: 0 additions & 1 deletion lib/arbre/rails/rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def render(*args)
text_node rendered
end
end

end
end
end
2 changes: 0 additions & 2 deletions lib/arbre/rails/template_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ def call(template, source = nil)
end
end
end

ActionView::Template.register_template_handler :arb, Arbre::Rails::TemplateHandler.new
17 changes: 17 additions & 0 deletions lib/arbre/railtie.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true
require 'arbre/rails/template_handler'
require 'arbre/rails/forms'
require 'arbre/rails/rendering'
require 'rails'

Arbre::Element.include(Arbre::Rails::Rendering)

module Arbre
class Railtie < ::Rails::Railtie
initializer "arbre" do
ActiveSupport.on_load(:action_view) do
ActionView::Template.register_template_handler :arb, Arbre::Rails::TemplateHandler.new
end
end
end
end
13 changes: 3 additions & 10 deletions spec/rails/rails_spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true
require 'rubygems'
require 'bundler/setup'

require 'combustion'
require 'spec_helper'

Combustion.path = 'spec/rails/stub_app'
Combustion.initialize! :action_controller,
Expand All @@ -12,13 +10,8 @@
require 'capybara/rspec'
require 'capybara/rails'

require 'spec_helper'

require 'rails/support/mock_person'

# Ensure that the rails plugin is installed
require 'arbre/rails'

module AdditionalHelpers

def protect_against_forgery?
Expand All @@ -33,8 +26,8 @@ def form_authenticity_token(form_options: {})

def mock_action_view(assigns = {})
controller = ActionView::TestCase::TestController.new
ActionView::Base.send :include, ActionView::Helpers
ActionView::Base.send :include, AdditionalHelpers
ActionView::Base.include(ActionView::Helpers)
ActionView::Base.include(AdditionalHelpers)
context = ActionView::LookupContext.new(ActionController::Base.view_paths)
ActionView::Base.new(context, assigns, controller)
end
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
end

require 'support/bundle'
require 'combustion'
require 'arbre'

def arbre(&block)
Expand Down