forked from burnettk/vim-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgf_definition_spec.rb
More file actions
69 lines (55 loc) · 2.06 KB
/
Copy pathgf_definition_spec.rb
File metadata and controls
69 lines (55 loc) · 2.06 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
require "spec_helper"
describe "gf definition" do
before do
assume_blank_vimrc_by_unsetting_any_global_variables
end
specify "should be found even though the identifier does not include the js suffix that is obviously in the filename" do
setup_filesystem('app/js/poo.js')
find_definition('poo')
current_file_name.should eq "./app/js/poo.js"
end
specify "should be found when the identifier has a camelcasedName" do
setup_filesystem('app/js/piles-of-poo.js')
find_definition('pilesOfPoo')
current_file_name.should eq "./app/js/piles-of-poo.js"
end
specify "should be found when the identifier has a TitlecasedName" do
setup_filesystem('app/js/piles-of-poo.js')
find_definition('PilesOfPoo')
current_file_name.should eq "./app/js/piles-of-poo.js"
end
specify "should be found when the filename-is-dasherized" do
setup_filesystem('app/js/piles-of-poo.js')
find_definition('pilesOfPoo')
current_file_name.should eq "./app/js/piles-of-poo.js"
end
specify "should be found when the filenameIsCamelcased" do
setup_filesystem('app/js/pilesOfPoo.js')
find_definition('pilesOfPoo')
current_file_name.should eq "./app/js/pilesOfPoo.js"
end
specify "should be found when the FilenameIsTitlecased" do
setup_filesystem('app/js/PilesOfPoo.js')
find_definition('PilesOfPoo')
current_file_name.should eq "./app/js/PilesOfPoo.js"
end
specify "should be a champ about avoiding full stops" do
setup_filesystem('app/js/piles-of-poo.js')
find_definition('PilesOfPoo.keepingStinking()')
current_file_name.should eq "./app/js/piles-of-poo.js"
end
specify "should find partial matches at the end i guess" do
setup_filesystem('app/js/piles-of-poo.js')
find_definition('poo')
current_file_name.should eq "./app/js/piles-of-poo.js"
end
private
def find_definition(string_to_find_by)
write_file('starting-file.js', <<-EOF)
#{string_to_find_by}
EOF
vim.edit 'starting-file.js'
current_file_name.should eq "starting-file.js"
vim.command 'AngularGoToFile'
end
end