-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow specifing Agent gem in the Gemfile
- Loading branch information
Showing
4 changed files
with
95 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require 'rails_helper' | ||
|
||
describe GemfileHelper do | ||
context 'parse_each_agent_gem' do | ||
VALID_STRINGS = [ | ||
['huginn_nlp_agents(~> 0.2.1)', [ | ||
['huginn_nlp_agents', '~> 0.2.1'] | ||
]], | ||
['huginn_nlp_agents(~> 0.2.1, git: http://github.com/dsander/huginn.git, branch: agents_in_gems)', | ||
[['huginn_nlp_agents', '~> 0.2.1', git: 'http://github.com/dsander/huginn.git', branch: 'agents_in_gems']] | ||
], | ||
['huginn_nlp_agents(~> 0.2.1, git: http://github.com/dsander/huginn.git, ref: 2342asdab) , huginn_nlp_agents(~> 0.2.1)', [ | ||
['huginn_nlp_agents', '~> 0.2.1', git: 'http://github.com/dsander/huginn.git', ref: '2342asdab'], | ||
['huginn_nlp_agents', '~> 0.2.1'] | ||
]], | ||
['huginn_nlp_agents(~> 0.2.1, path: /tmp/test)', [ | ||
['huginn_nlp_agents', '~> 0.2.1', path: '/tmp/test'] | ||
]], | ||
['huginn_nlp_agents', [ | ||
['huginn_nlp_agents'] | ||
]], | ||
['huginn_nlp_agents, test(0.1), test2(github: test2/huginn_test)', [ | ||
['huginn_nlp_agents'], | ||
['test', '0.1'], | ||
['test2', github: 'test2/huginn_test'] | ||
]], | ||
['huginn_nlp_agents(git: http://github.com/dsander/huginn.git, ref: 2342asdab)', [ | ||
['huginn_nlp_agents', git: 'http://github.com/dsander/huginn.git', ref: '2342asdab'] | ||
]], | ||
] | ||
|
||
it 'parses valid gem strings correctly' do | ||
VALID_STRINGS.each do |string, outcomes| | ||
GemfileHelper.parse_each_agent_gem(string) do |args| | ||
expect(args).to eq(outcomes.shift) | ||
end | ||
end | ||
end | ||
|
||
it 'does nothing when nil is passed' do | ||
expect { |b| GemfileHelper.parse_each_agent_gem(nil, &b) }.not_to yield_control | ||
end | ||
|
||
it 'does nothing when an empty string is passed' do | ||
expect { |b| GemfileHelper.parse_each_agent_gem('', &b) }.not_to yield_control | ||
end | ||
end | ||
end |