forked from preston/railroady
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrollers_diagram_spec.rb
49 lines (41 loc) · 1.91 KB
/
controllers_diagram_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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("rspec/file_fixture/")
files.size.should == 4
end
it 'should exclude a specific file' do
options = OptionsStruct.new(:exclude => ['rspec/file_fixture/app/controllers/dummy1_controller.rb'])
cd = ControllersDiagram.new(options)
files = cd.get_files("rspec/file_fixture/")
files.size.should == 3
end
it 'should exclude a glob pattern of files' do
options = OptionsStruct.new(:exclude => ['rspec/file_fixture/app/controllers/sub-dir/*.rb'])
cd = ControllersDiagram.new(options)
files = cd.get_files("rspec/file_fixture/")
files.size.should == 3
end
it 'should include only specific file' do
options = OptionsStruct.new(:specify => ['rspec/file_fixture/app/controllers/sub-dir/sub_dummy_controller.rb'])
cd = ControllersDiagram.new(options)
files = cd.get_files("rspec/file_fixture/")
files.size.should == 1
end
it 'should include only specified files' do
options = OptionsStruct.new(:specify => ['rspec/file_fixture/app/controllers/{dummy1_*.rb,sub-dir/sub_dummy_controller.rb}'])
cd = ControllersDiagram.new(options)
files = cd.get_files("rspec/file_fixture/")
files.size.should == 2
end
it 'should include only specified files and exclude specified files' do
options = OptionsStruct.new(:specify => ['rspec/file_fixture/app/controllers/{dummy1_*.rb,sub-dir/sub_dummy_controller.rb}'],
:exclude => ['rspec/file_fixture/app/controllers/sub-dir/sub_dummy_controller.rb'])
cd = ControllersDiagram.new(options)
files = cd.get_files("rspec/file_fixture/")
files.size.should == 1
end
end
end