Sha256: ccdec82585a86ec338ab8681c2b68d3c48532b9bd65d15bd148363c27fe8e910

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

require "spec_helper"
require 'sections_rails/view_finder'


describe "SectionsRails::ViewFinder" do

  describe '#find_all_views' do
    let(:result) { SectionsRails::ViewFinder.find_all_views 'spec/sections_rails/view_finder_spec' }
    let(:empty_result) { SectionsRails::ViewFinder.find_all_views 'spec/sections_rails/view_finder_spec/empty' }

    it 'returns all erb views' do
      expect(result).to include 'spec/sections_rails/view_finder_spec/erb/_erb.html.erb'
    end

    it 'returns all haml views' do
      expect(result).to include 'spec/sections_rails/view_finder_spec/haml/_haml.html.haml'
    end

    it 'returns all ruby files' do
      expect(result).to include 'spec/sections_rails/view_finder_spec/rb/decorator.rb'
    end

    it 'does not return js files' do
      expect(result).not_to include 'spec/sections_rails/view_finder_spec/assets/javascript.js'
    end

    it 'does not return css files' do
      expect(result).not_to include 'spec/sections_rails/view_finder_spec/assets/stylesheet.css'
    end

    it 'returns views that are deeper nested in the directory structure' do
      expect(result).to include 'spec/sections_rails/view_finder_spec/nested/deeper/nested.html.erb'
    end

    it 'returns an empty array if there are no views' do
      expect(empty_result).to eq []
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sections_rails-0.11.0 spec/sections_rails/view_finder_spec.rb