Skip to content

Commit 0a754fc

Browse files
committed
tests for erb
1 parent 10ef1b8 commit 0a754fc

File tree

7 files changed

+50
-1
lines changed

7 files changed

+50
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/target
22
.DS_Store
33
/tmp
4+
**/project-file-cache.json

src/common_test.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ pub mod tests {
262262
relative_path: "packs/bar/comp-colon.rb".to_owned(),
263263
content: "# @team: BarColon\n".to_owned(),
264264
},
265+
TestProjectFile {
266+
relative_path: "ruby/app/views/foos/edit.erb".to_owned(),
267+
content: "<%# @team: Foo %>\n".to_owned(),
268+
},
269+
TestProjectFile {
270+
relative_path: "ruby/app/views/foos/show.html.erb".to_owned(),
271+
content: "<!-- @team: Bar -->\n".to_owned(),
272+
},
273+
TestProjectFile {
274+
relative_path: "ruby/app/views/foos/_row.html.erb".to_owned(),
275+
content: "<!-- @team Bam -->\n".to_owned(),
276+
},
265277
],
266278
);
267279
build_ownership(test_config)

src/ownership/mapper/team_file_mapper.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,36 @@ mod tests {
9999
team_name: "Bar".to_owned(),
100100
disabled: false,
101101
},
102+
Entry {
103+
path: "packs/bar/comp-colon.rb".to_owned(),
104+
github_team: "@BarColon".to_owned(),
105+
team_name: "BarColon".to_owned(),
106+
disabled: false,
107+
},
108+
Entry {
109+
path: "packs/jscomponents/comp-colon.ts".to_owned(),
110+
github_team: "@FooColon".to_owned(),
111+
team_name: "FooColon".to_owned(),
112+
disabled: false,
113+
},
114+
Entry {
115+
path: "ruby/app/views/foos/edit.erb".to_owned(),
116+
github_team: "@Foo".to_owned(),
117+
team_name: "Foo".to_owned(),
118+
disabled: false,
119+
},
120+
Entry {
121+
path: "ruby/app/views/foos/show.html.erb".to_owned(),
122+
github_team: "@Bar".to_owned(),
123+
team_name: "Bar".to_owned(),
124+
disabled: false,
125+
},
126+
Entry {
127+
path: "ruby/app/views/foos/_row.html.erb".to_owned(),
128+
github_team: "@Bam".to_owned(),
129+
team_name: "Bam".to_owned(),
130+
disabled: false,
131+
},
102132
],
103133
);
104134
Ok(())
@@ -116,6 +146,9 @@ mod tests {
116146
(PathBuf::from("packs/jscomponents/comp.ts"), "Foo".to_owned()),
117147
(PathBuf::from("packs/jscomponents/comp-colon.ts"), "FooColon".to_owned()),
118148
(PathBuf::from("packs/bar/comp-colon.rb"), "BarColon".to_owned()),
149+
(PathBuf::from("ruby/app/views/foos/edit.erb"), "Foo".to_owned()),
150+
(PathBuf::from("ruby/app/views/foos/show.html.erb"), "Bar".to_owned()),
151+
(PathBuf::from("ruby/app/views/foos/_row.html.erb"), "Bam".to_owned()),
119152
]),
120153
Source::TeamFile,
121154
)];

tests/fixtures/valid_project/config/code_ownership.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
owned_globs:
2-
- "{gems,config,javascript,ruby,components}/**/*.{rb,tsx}"
2+
- "{gems,config,javascript,ruby,components}/**/*.{rb,tsx,erb,html.erb}"
33
ruby_package_paths:
44
- ruby/packages/**/*
55
javascript_package_paths:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%# @team: Payments %>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- @team: UX -->
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%# @team: Payroll %>

0 commit comments

Comments
 (0)