arbre 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +10 -0
 - data/README.md +1 -1
 - data/lib/arbre/context.rb +2 -1
 - data/lib/arbre/element.rb +2 -1
 - data/lib/arbre/version.rb +1 -1
 - metadata +35 -46
 - data/.gitignore +0 -10
 - data/.rubocop.yml +0 -15
 - data/.travis.yml +0 -16
 - data/Gemfile +0 -25
 - data/Gemfile.lock +0 -224
 - data/Rakefile +0 -21
 - data/arbre.gemspec +0 -24
 - data/spec/arbre/integration/html_spec.rb +0 -249
 - data/spec/arbre/unit/component_spec.rb +0 -44
 - data/spec/arbre/unit/context_spec.rb +0 -35
 - data/spec/arbre/unit/element_finder_methods_spec.rb +0 -116
 - data/spec/arbre/unit/element_spec.rb +0 -271
 - data/spec/arbre/unit/html/class_list_spec.rb +0 -16
 - data/spec/arbre/unit/html/tag_attributes_spec.rb +0 -62
 - data/spec/arbre/unit/html/tag_spec.rb +0 -115
 - data/spec/arbre/unit/html/text_node_spec.rb +0 -5
 - data/spec/changelog_spec.rb +0 -27
 - data/spec/rails/integration/forms_spec.rb +0 -105
 - data/spec/rails/integration/rendering_spec.rb +0 -99
 - data/spec/rails/rails_spec_helper.rb +0 -42
 - data/spec/rails/stub_app/config/database.yml +0 -3
 - data/spec/rails/stub_app/config/routes.rb +0 -3
 - data/spec/rails/stub_app/db/schema.rb +0 -3
 - data/spec/rails/stub_app/log/.gitignore +0 -1
 - data/spec/rails/stub_app/public/favicon.ico +0 -0
 - data/spec/rails/support/mock_person.rb +0 -15
 - data/spec/rails/templates/arbre/_partial.arb +0 -1
 - data/spec/rails/templates/arbre/_partial_with_assignment.arb +0 -1
 - data/spec/rails/templates/arbre/empty.arb +0 -0
 - data/spec/rails/templates/arbre/page_with_arb_partial_and_assignment.arb +0 -3
 - data/spec/rails/templates/arbre/page_with_assignment.arb +0 -1
 - data/spec/rails/templates/arbre/page_with_erb_partial.arb +0 -3
 - data/spec/rails/templates/arbre/page_with_partial.arb +0 -3
 - data/spec/rails/templates/arbre/simple_page.arb +0 -8
 - data/spec/rails/templates/erb/_partial.erb +0 -1
 - data/spec/spec_helper.rb +0 -7
 - data/spec/support/bundle.rb +0 -4
 - data/tasks/lint.rake +0 -69
 - data/tasks/release.rake +0 -6
 
    
        data/spec/changelog_spec.rb
    DELETED
    
    | 
         @@ -1,27 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            describe "Changelog" do
         
     | 
| 
       4 
     | 
    
         
            -
              subject(:changelog) do
         
     | 
| 
       5 
     | 
    
         
            -
                path = File.join(File.dirname(__dir__), "CHANGELOG.md")
         
     | 
| 
       6 
     | 
    
         
            -
                File.read(path)
         
     | 
| 
       7 
     | 
    
         
            -
              end
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
              it 'has definitions for all implicit links' do
         
     | 
| 
       10 
     | 
    
         
            -
                implicit_link_names = changelog.scan(/\[([^\]]+)\]\[\]/).flatten.uniq
         
     | 
| 
       11 
     | 
    
         
            -
                implicit_link_names.each do |name|
         
     | 
| 
       12 
     | 
    
         
            -
                  expect(changelog).to include("[#{name}]: https")
         
     | 
| 
       13 
     | 
    
         
            -
                end
         
     | 
| 
       14 
     | 
    
         
            -
              end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              describe 'entry' do
         
     | 
| 
       17 
     | 
    
         
            -
                let(:lines) { changelog.each_line }
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                subject(:entries) { lines.grep(/^\*/) }
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                it 'does not end with a punctuation' do
         
     | 
| 
       22 
     | 
    
         
            -
                  entries.each do |entry|
         
     | 
| 
       23 
     | 
    
         
            -
                    expect(entry).not_to match(/\.$/)
         
     | 
| 
       24 
     | 
    
         
            -
                  end
         
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
              end
         
     | 
| 
       27 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,105 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'rails/rails_spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            describe "Building forms" do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              let(:assigns){ {} }
         
     | 
| 
       6 
     | 
    
         
            -
              let(:helpers){ mock_action_view }
         
     | 
| 
       7 
     | 
    
         
            -
              let(:html) { form.to_s }
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
              describe "building a simple form for" do
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                let(:form) do
         
     | 
| 
       12 
     | 
    
         
            -
                  arbre do
         
     | 
| 
       13 
     | 
    
         
            -
                    form_for MockPerson.new, url: "/" do |f|
         
     | 
| 
       14 
     | 
    
         
            -
                      f.label :name
         
     | 
| 
       15 
     | 
    
         
            -
                      f.text_field :name
         
     | 
| 
       16 
     | 
    
         
            -
                    end
         
     | 
| 
       17 
     | 
    
         
            -
                  end
         
     | 
| 
       18 
     | 
    
         
            -
                end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                it "should build a form" do
         
     | 
| 
       21 
     | 
    
         
            -
                  expect(html).to have_selector("form")
         
     | 
| 
       22 
     | 
    
         
            -
                end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                it "should include the hidden authenticity token" do
         
     | 
| 
       25 
     | 
    
         
            -
                  expect(html).to include '<input type="hidden" name="authenticity_token" value="AUTH_TOKEN" />'
         
     | 
| 
       26 
     | 
    
         
            -
                end
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                it "should create a label" do
         
     | 
| 
       29 
     | 
    
         
            -
                  expect(html).to have_selector("form label[for=mock_person_name]")
         
     | 
| 
       30 
     | 
    
         
            -
                end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
                it "should create a text field" do
         
     | 
| 
       33 
     | 
    
         
            -
                  expect(html).to have_selector("form input[type=text]")
         
     | 
| 
       34 
     | 
    
         
            -
                end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
              end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
              describe "building a form with fields for" do
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                let(:form) do
         
     | 
| 
       41 
     | 
    
         
            -
                  arbre do
         
     | 
| 
       42 
     | 
    
         
            -
                    form_for MockPerson.new, url: "/" do |f|
         
     | 
| 
       43 
     | 
    
         
            -
                      f.label :name
         
     | 
| 
       44 
     | 
    
         
            -
                      f.text_field :name
         
     | 
| 
       45 
     | 
    
         
            -
                      f.fields_for :permission do |pf|
         
     | 
| 
       46 
     | 
    
         
            -
                        pf.label :admin
         
     | 
| 
       47 
     | 
    
         
            -
                        pf.check_box :admin
         
     | 
| 
       48 
     | 
    
         
            -
                      end
         
     | 
| 
       49 
     | 
    
         
            -
                    end
         
     | 
| 
       50 
     | 
    
         
            -
                  end
         
     | 
| 
       51 
     | 
    
         
            -
                end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                it "should render nested label" do
         
     | 
| 
       54 
     | 
    
         
            -
                  expect(html).to have_selector("form label[for=mock_person_permission_admin]", text: "Admin")
         
     | 
| 
       55 
     | 
    
         
            -
                end
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                it "should render nested label" do
         
     | 
| 
       58 
     | 
    
         
            -
                  expect(html).to have_selector("form input[type=checkbox][name='mock_person[permission][admin]']")
         
     | 
| 
       59 
     | 
    
         
            -
                end
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                it "should not render a div for the proxy" do
         
     | 
| 
       62 
     | 
    
         
            -
                  expect(html).not_to have_selector("form div.fields_for_proxy")
         
     | 
| 
       63 
     | 
    
         
            -
                end
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
              end
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
              describe "forms with other elements" do
         
     | 
| 
       68 
     | 
    
         
            -
                let(:form) do
         
     | 
| 
       69 
     | 
    
         
            -
                  arbre do
         
     | 
| 
       70 
     | 
    
         
            -
                    form_for MockPerson.new, url: "/" do |f|
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                      div do
         
     | 
| 
       73 
     | 
    
         
            -
                        f.label :name
         
     | 
| 
       74 
     | 
    
         
            -
                        f.text_field :name
         
     | 
| 
       75 
     | 
    
         
            -
                      end
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                      para do
         
     | 
| 
       78 
     | 
    
         
            -
                        f.label :name
         
     | 
| 
       79 
     | 
    
         
            -
                        f.text_field :name
         
     | 
| 
       80 
     | 
    
         
            -
                      end
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                      div class: "permissions" do
         
     | 
| 
       83 
     | 
    
         
            -
                        f.fields_for :permission do |pf|
         
     | 
| 
       84 
     | 
    
         
            -
                          div class: "permissions_label" do
         
     | 
| 
       85 
     | 
    
         
            -
                            pf.label :admin
         
     | 
| 
       86 
     | 
    
         
            -
                          end
         
     | 
| 
       87 
     | 
    
         
            -
                          pf.check_box :admin
         
     | 
| 
       88 
     | 
    
         
            -
                        end
         
     | 
| 
       89 
     | 
    
         
            -
                      end
         
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
                    end
         
     | 
| 
       92 
     | 
    
         
            -
                  end
         
     | 
| 
       93 
     | 
    
         
            -
                end
         
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
                it "should correctly nest elements" do
         
     | 
| 
       96 
     | 
    
         
            -
                  expect(html).to have_selector("form > p > label")
         
     | 
| 
       97 
     | 
    
         
            -
                end
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                it "should correnctly nest elements within fields for" do
         
     | 
| 
       100 
     | 
    
         
            -
                  expect(html).to have_selector("form > div.permissions > div.permissions_label label")
         
     | 
| 
       101 
     | 
    
         
            -
                end
         
     | 
| 
       102 
     | 
    
         
            -
              end
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,99 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'rails/rails_spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            ARBRE_VIEWS_PATH = File.expand_path("../../templates", __FILE__)
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            class TestController < ActionController::Base
         
     | 
| 
       6 
     | 
    
         
            -
              append_view_path ARBRE_VIEWS_PATH
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
              def render_empty
         
     | 
| 
       9 
     | 
    
         
            -
                render "arbre/empty"
         
     | 
| 
       10 
     | 
    
         
            -
              end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              def render_simple_page
         
     | 
| 
       13 
     | 
    
         
            -
                render "arbre/simple_page"
         
     | 
| 
       14 
     | 
    
         
            -
              end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              def render_partial
         
     | 
| 
       17 
     | 
    
         
            -
                render "arbre/page_with_partial"
         
     | 
| 
       18 
     | 
    
         
            -
              end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
              def render_erb_partial
         
     | 
| 
       21 
     | 
    
         
            -
                render "arbre/page_with_erb_partial"
         
     | 
| 
       22 
     | 
    
         
            -
              end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
              def render_with_instance_variable
         
     | 
| 
       25 
     | 
    
         
            -
                @my_instance_var = "From Instance Var"
         
     | 
| 
       26 
     | 
    
         
            -
                render "arbre/page_with_assignment"
         
     | 
| 
       27 
     | 
    
         
            -
              end
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
              def render_partial_with_instance_variable
         
     | 
| 
       30 
     | 
    
         
            -
                @my_instance_var = "From Instance Var"
         
     | 
| 
       31 
     | 
    
         
            -
                render "arbre/page_with_arb_partial_and_assignment"
         
     | 
| 
       32 
     | 
    
         
            -
              end
         
     | 
| 
       33 
     | 
    
         
            -
            end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
            describe TestController, "Rendering with Arbre", type: :request do
         
     | 
| 
       37 
     | 
    
         
            -
              let(:body){ response.body }
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
              before do
         
     | 
| 
       40 
     | 
    
         
            -
                Rails.application.routes.draw do
         
     | 
| 
       41 
     | 
    
         
            -
                  get 'test/render_empty', controller: "test"
         
     | 
| 
       42 
     | 
    
         
            -
                  get 'test/render_simple_page', controller: "test"
         
     | 
| 
       43 
     | 
    
         
            -
                  get 'test/render_partial', controller: "test"
         
     | 
| 
       44 
     | 
    
         
            -
                  get 'test/render_erb_partial', controller: "test"
         
     | 
| 
       45 
     | 
    
         
            -
                  get 'test/render_with_instance_variable', controller: "test"
         
     | 
| 
       46 
     | 
    
         
            -
                  get 'test/render_partial_with_instance_variable', controller: "test"
         
     | 
| 
       47 
     | 
    
         
            -
                  get 'test/render_page_with_helpers', controller: "test"
         
     | 
| 
       48 
     | 
    
         
            -
                end
         
     | 
| 
       49 
     | 
    
         
            -
              end
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
              after do
         
     | 
| 
       52 
     | 
    
         
            -
                Rails.application.reload_routes!
         
     | 
| 
       53 
     | 
    
         
            -
              end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
              it "should render the empty template" do
         
     | 
| 
       56 
     | 
    
         
            -
                get "/test/render_empty"
         
     | 
| 
       57 
     | 
    
         
            -
                expect(response).to be_successful
         
     | 
| 
       58 
     | 
    
         
            -
              end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
              it "should render a simple page" do
         
     | 
| 
       61 
     | 
    
         
            -
                get "/test/render_simple_page"
         
     | 
| 
       62 
     | 
    
         
            -
                expect(response).to be_successful
         
     | 
| 
       63 
     | 
    
         
            -
                expect(body).to have_selector("h1", text: "Hello World")
         
     | 
| 
       64 
     | 
    
         
            -
                expect(body).to have_selector("p", text: "Hello again!")
         
     | 
| 
       65 
     | 
    
         
            -
              end
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
              it "should render an arb partial" do
         
     | 
| 
       68 
     | 
    
         
            -
                get "/test/render_partial"
         
     | 
| 
       69 
     | 
    
         
            -
                expect(response).to be_successful
         
     | 
| 
       70 
     | 
    
         
            -
                expect(body).to eq <<~HTML
         
     | 
| 
       71 
     | 
    
         
            -
                  <h1>Before Partial</h1>
         
     | 
| 
       72 
     | 
    
         
            -
                  <p>Hello from a partial</p>
         
     | 
| 
       73 
     | 
    
         
            -
                  <h2>After Partial</h2>
         
     | 
| 
       74 
     | 
    
         
            -
                HTML
         
     | 
| 
       75 
     | 
    
         
            -
              end
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
              it "should render an erb (or other) partial" do
         
     | 
| 
       78 
     | 
    
         
            -
                get "/test/render_erb_partial"
         
     | 
| 
       79 
     | 
    
         
            -
                expect(response).to be_successful
         
     | 
| 
       80 
     | 
    
         
            -
                expect(body).to eq <<~HTML
         
     | 
| 
       81 
     | 
    
         
            -
                  <h1>Before Partial</h1>
         
     | 
| 
       82 
     | 
    
         
            -
                  <p>Hello from an erb partial</p>
         
     | 
| 
       83 
     | 
    
         
            -
                  <h2>After Partial</h2>
         
     | 
| 
       84 
     | 
    
         
            -
                HTML
         
     | 
| 
       85 
     | 
    
         
            -
              end
         
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
              it "should render with instance variables" do
         
     | 
| 
       88 
     | 
    
         
            -
                get "/test/render_with_instance_variable"
         
     | 
| 
       89 
     | 
    
         
            -
                expect(response).to be_successful
         
     | 
| 
       90 
     | 
    
         
            -
                expect(body).to have_selector("h1", text: "From Instance Var")
         
     | 
| 
       91 
     | 
    
         
            -
              end
         
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
              it "should render an arbre partial with assignments" do
         
     | 
| 
       94 
     | 
    
         
            -
                get "/test/render_partial_with_instance_variable"
         
     | 
| 
       95 
     | 
    
         
            -
                expect(response).to be_successful
         
     | 
| 
       96 
     | 
    
         
            -
                expect(body).to have_selector("p", text: "Partial: From Instance Var")
         
     | 
| 
       97 
     | 
    
         
            -
              end
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,42 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'rubygems'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'bundler/setup'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            require 'combustion'
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            Combustion.path = 'spec/rails/stub_app'
         
     | 
| 
       7 
     | 
    
         
            -
            Combustion.initialize! :action_controller,
         
     | 
| 
       8 
     | 
    
         
            -
                                   :action_view
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            require 'rspec/rails'
         
     | 
| 
       11 
     | 
    
         
            -
            require 'capybara/rspec'
         
     | 
| 
       12 
     | 
    
         
            -
            require 'capybara/rails'
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
            require 'rails/support/mock_person'
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            # Ensure that the rails plugin is installed
         
     | 
| 
       19 
     | 
    
         
            -
            require 'arbre/rails'
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
            module AdditionalHelpers
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
              def protect_against_forgery?
         
     | 
| 
       24 
     | 
    
         
            -
                true
         
     | 
| 
       25 
     | 
    
         
            -
              end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              def form_authenticity_token(form_options: {})
         
     | 
| 
       28 
     | 
    
         
            -
                "AUTH_TOKEN"
         
     | 
| 
       29 
     | 
    
         
            -
              end
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
            end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
            def mock_action_view(assigns = {})
         
     | 
| 
       34 
     | 
    
         
            -
              controller = ActionView::TestCase::TestController.new
         
     | 
| 
       35 
     | 
    
         
            -
              ActionView::Base.send :include, ActionView::Helpers
         
     | 
| 
       36 
     | 
    
         
            -
              ActionView::Base.send :include, AdditionalHelpers
         
     | 
| 
       37 
     | 
    
         
            -
              ActionView::Base.new(ActionController::Base.view_paths, assigns, controller)
         
     | 
| 
       38 
     | 
    
         
            -
            end
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
            RSpec.configure do |config|
         
     | 
| 
       41 
     | 
    
         
            -
              config.include Capybara::RSpecMatchers
         
     | 
| 
       42 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            *.log
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -1 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            para "Hello from a partial"
         
     | 
| 
         @@ -1 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            para "Partial: #{my_instance_var}"
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -1 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            h1 my_instance_var
         
     | 
| 
         @@ -1 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <p>Hello from an erb partial</p>
         
     | 
    
        data/spec/spec_helper.rb
    DELETED
    
    
    
        data/spec/support/bundle.rb
    DELETED
    
    
    
        data/tasks/lint.rake
    DELETED
    
    | 
         @@ -1,69 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require "open3"
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            #
         
     | 
| 
       4 
     | 
    
         
            -
            # Common stuff for a linter
         
     | 
| 
       5 
     | 
    
         
            -
            #
         
     | 
| 
       6 
     | 
    
         
            -
            module LinterMixin
         
     | 
| 
       7 
     | 
    
         
            -
              def run
         
     | 
| 
       8 
     | 
    
         
            -
                offenses = []
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                applicable_files.each do |file|
         
     | 
| 
       11 
     | 
    
         
            -
                  if clean?(file)
         
     | 
| 
       12 
     | 
    
         
            -
                    print "."
         
     | 
| 
       13 
     | 
    
         
            -
                  else
         
     | 
| 
       14 
     | 
    
         
            -
                    offenses << file
         
     | 
| 
       15 
     | 
    
         
            -
                    print "F"
         
     | 
| 
       16 
     | 
    
         
            -
                  end
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                print "\n"
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                return if offenses.empty?
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                raise failure_message_for(offenses)
         
     | 
| 
       24 
     | 
    
         
            -
              end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
              private
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
              def applicable_files
         
     | 
| 
       29 
     | 
    
         
            -
                Open3.capture2("git grep -Il ''")[0].split
         
     | 
| 
       30 
     | 
    
         
            -
              end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
              def failure_message_for(offenses)
         
     | 
| 
       33 
     | 
    
         
            -
                msg = "#{self.class.name} detected offenses. "
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                msg += if respond_to?(:fixing_cmd)
         
     | 
| 
       36 
     | 
    
         
            -
                         "Run `#{fixing_cmd(offenses)}` to fix them."
         
     | 
| 
       37 
     | 
    
         
            -
                       else
         
     | 
| 
       38 
     | 
    
         
            -
                         "Affected files: #{offenses.join(' ')}"
         
     | 
| 
       39 
     | 
    
         
            -
                       end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
                msg
         
     | 
| 
       42 
     | 
    
         
            -
              end
         
     | 
| 
       43 
     | 
    
         
            -
            end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
            #
         
     | 
| 
       46 
     | 
    
         
            -
            # Checks trailing new lines in files
         
     | 
| 
       47 
     | 
    
         
            -
            #
         
     | 
| 
       48 
     | 
    
         
            -
            class MissingTrailingCarriageReturn
         
     | 
| 
       49 
     | 
    
         
            -
              include LinterMixin
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
              def clean?(file)
         
     | 
| 
       52 
     | 
    
         
            -
                File.read(file) =~ /\n\Z/m
         
     | 
| 
       53 
     | 
    
         
            -
              end
         
     | 
| 
       54 
     | 
    
         
            -
            end
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
            require 'rubocop/rake_task'
         
     | 
| 
       57 
     | 
    
         
            -
            RuboCop::RakeTask.new
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
            desc "Lints ActiveAdmin code base"
         
     | 
| 
       60 
     | 
    
         
            -
            task lint: ["rubocop", "lint:missing_trailing_carriage_return"]
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            namespace :lint do
         
     | 
| 
       63 
     | 
    
         
            -
              desc "Check for missing trailing new lines"
         
     | 
| 
       64 
     | 
    
         
            -
              task :missing_trailing_carriage_return do
         
     | 
| 
       65 
     | 
    
         
            -
                puts "Checking for missing trailing carriage returns..."
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                MissingTrailingCarriageReturn.new.run
         
     | 
| 
       68 
     | 
    
         
            -
              end
         
     | 
| 
       69 
     | 
    
         
            -
            end
         
     |