-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1345 from snyk/feat/allow-custom-ruby-file-names
Feat: allow custom ruby file names
- Loading branch information
Showing
8 changed files
with
157 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import * as path from 'path'; | ||
import * as _ from '@snyk/lodash'; | ||
import { AcceptanceTests } from './cli-test.acceptance.test'; | ||
import { getWorkspaceJSON } from '../workspace-helper'; | ||
|
@@ -42,6 +41,80 @@ export const RubyTests: AcceptanceTests = { | |
); | ||
}, | ||
|
||
'`test ruby-app-custom-names --file=123.gemfile.lock --package-manager=rubygems`': ( | ||
params, | ||
utils, | ||
) => async (t) => { | ||
utils.chdirWorkspaces(); | ||
await params.cli.test('ruby-app-custom-names', { | ||
file: '123.gemfile.lock', | ||
packageManager: 'rubygems', | ||
}); | ||
|
||
const req = params.server.popRequest(); | ||
t.equal(req.method, 'POST', 'makes POST request'); | ||
t.equal( | ||
req.headers['x-snyk-cli-version'], | ||
params.versionNumber, | ||
'sends version number', | ||
); | ||
t.match(req.url, '/test-dep-graph', 'posts to correct url'); | ||
|
||
const depGraph = req.body.depGraph; | ||
t.equal(depGraph.pkgManager.name, 'rubygems'); | ||
t.same( | ||
depGraph.pkgs.map((p) => p.id).sort(), | ||
[ | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'ruby-app-custom-names@', | ||
'[email protected]', | ||
'[email protected]', | ||
].sort(), | ||
'depGraph looks fine', | ||
); | ||
}, | ||
|
||
'`test ruby-app-custom-names --file=gemfiles/Gemfile.rails-2.4.5.lock --package-manager=rubygems`': ( | ||
params, | ||
utils, | ||
) => async (t) => { | ||
utils.chdirWorkspaces(); | ||
await params.cli.test('ruby-app-custom-names', { | ||
file: 'gemfiles/Gemfile.rails-2.4.5.lock', | ||
packageManager: 'rubygems', | ||
}); | ||
|
||
const req = params.server.popRequest(); | ||
t.equal(req.method, 'POST', 'makes POST request'); | ||
t.equal( | ||
req.headers['x-snyk-cli-version'], | ||
params.versionNumber, | ||
'sends version number', | ||
); | ||
t.match(req.url, '/test-dep-graph', 'posts to correct url'); | ||
|
||
const depGraph = req.body.depGraph; | ||
t.equal(depGraph.pkgManager.name, 'rubygems'); | ||
t.same( | ||
depGraph.pkgs.map((p) => p.id).sort(), | ||
[ | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]', | ||
'ruby-app-custom-names@', | ||
'[email protected]', | ||
'[email protected]', | ||
].sort(), | ||
'depGraph looks fine', | ||
); | ||
}, | ||
|
||
'`test ruby-app` meta when no vulns': (params, utils) => async (t) => { | ||
utils.chdirWorkspaces(); | ||
const commandResult: CommandResult = await params.cli.test('ruby-app'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source :rubygems | ||
|
||
gem "sanitize", "4.6.2" | ||
gem "yard", "0.8.0" | ||
gem "lynx", "0.4.0" |
26 changes: 26 additions & 0 deletions
26
test/acceptance/workspaces/ruby-app-custom-names/123.gemfile.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
crass (1.0.4) | ||
lynx (0.4.0) | ||
mini_portile2 (2.3.0) | ||
nokogiri (1.8.5) | ||
mini_portile2 (~> 2.3.0) | ||
nokogumbo (1.5.0) | ||
nokogiri | ||
sanitize (4.6.2) | ||
crass (~> 1.0.2) | ||
nokogiri (>= 1.4.4) | ||
nokogumbo (~> 1.4) | ||
yard (0.8.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
lynx (= 0.4.0) | ||
sanitize (= 4.6.2) | ||
yard (= 0.8.0) | ||
|
||
BUNDLED WITH | ||
1.16.5 |
5 changes: 5 additions & 0 deletions
5
test/acceptance/workspaces/ruby-app-custom-names/gemfiles/Gemfile.rails-2.4.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source :rubygems | ||
|
||
gem "sanitize", "4.6.2" | ||
gem "yard", "0.8.0" | ||
gem "lynx", "0.4.0" |
26 changes: 26 additions & 0 deletions
26
test/acceptance/workspaces/ruby-app-custom-names/gemfiles/Gemfile.rails-2.4.5.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
crass (1.0.4) | ||
lynx (0.4.0) | ||
mini_portile2 (2.3.0) | ||
nokogiri (1.8.5) | ||
mini_portile2 (~> 2.3.0) | ||
nokogumbo (1.5.0) | ||
nokogiri | ||
sanitize (4.6.2) | ||
crass (~> 1.0.2) | ||
nokogiri (>= 1.4.4) | ||
nokogumbo (~> 1.4) | ||
yard (0.8.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
lynx (= 0.4.0) | ||
sanitize (= 4.6.2) | ||
yard (= 0.8.0) | ||
|
||
BUNDLED WITH | ||
1.16.5 |