Sha256: f4c3f05a70ea3049ed504d337a987869364fc8b7a3dc9243e2e40a1ac050f7de

Contents?: true

Size: 1.9 KB

Versions: 1

Compression:

Stored size: 1.9 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe ControllersDiagram do
  describe 'file processing' do

    it 'should select all the files under the controllers dir' do
      cd = ControllersDiagram.new
      files = cd.get_files("spec/file_fixture/")
      files.size.should == 4
    end

    it 'should exclude a specific file' do
      options = OptionsStruct.new(:exclude => ['spec/file_fixture/app/controllers/dummy1_controller.rb'])
      cd = ControllersDiagram.new(options)
      files = cd.get_files("spec/file_fixture/")
      files.size.should == 3
    end

    it 'should exclude a glob pattern of files' do
      options = OptionsStruct.new(:exclude => ['spec/file_fixture/app/controllers/sub-dir/*.rb'])
      cd = ControllersDiagram.new(options)
      files = cd.get_files("spec/file_fixture/")
      files.size.should == 3
    end

    it 'should include only specific file' do
      options = OptionsStruct.new(:specify => ['spec/file_fixture/app/controllers/sub-dir/sub_dummy_controller.rb'])
      cd = ControllersDiagram.new(options)
      files = cd.get_files("spec/file_fixture/")
      files.size.should == 1
    end

    it 'should include only specified files' do
      options = OptionsStruct.new(:specify => ['spec/file_fixture/app/controllers/{dummy1_*.rb,sub-dir/sub_dummy_controller.rb}'])
      cd = ControllersDiagram.new(options)
      files = cd.get_files("spec/file_fixture/")
      files.size.should == 2
    end

    it 'should include only specified files and exclude specified files' do
      options = OptionsStruct.new(:specify => ['spec/file_fixture/app/controllers/{dummy1_*.rb,sub-dir/sub_dummy_controller.rb}'],
                                  :exclude => ['spec/file_fixture/app/controllers/sub-dir/sub_dummy_controller.rb'])
      cd = ControllersDiagram.new(options)
      files = cd.get_files("spec/file_fixture/")
      files.size.should == 1
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tobias-railroad-0.10.0 spec/controllers_diagram_spec.rb