speedflow-plugin-jira 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2544df82452f45b75245c0cc92d952093f7c836
4
- data.tar.gz: 3cfa5a29a39d3a2382981d1709c58bef1d1b2bd6
3
+ metadata.gz: 2ded6d3751a92f792b132a9b63939ac5d5d6a32e
4
+ data.tar.gz: 2e2cd3cf5c9b6a8653a75bcb2013f1398787488d
5
5
  SHA512:
6
- metadata.gz: 673bebeb4cc4afdad00ee2639d51b9f04115e0d113d619c622f68e12e7bf1e6d69f28a00699c092439e4dcedc4b85bdeacc281658eb60b54df79e6c01a824ef9
7
- data.tar.gz: 08f4c0fdad78d81b35244b6a47ef8a4cf30a16dbb10e07ea5d9331f5ea62f082d8174d31dd7eb02820f09239241e42cdcefcf9d3d385c08d945e678e51ac8a47
6
+ metadata.gz: aa25d85bbb3f7839c314fb26984e066d643677649f3e74e85db43b6d40a769c3f1d20f6ff2178d0589349771ef83557476ab3e56b5a20980e8e3d456d071c7f7
7
+ data.tar.gz: 689d420053f41dfc90300795cf95a427d82927e4d6d973d51240dbd3735f62f334fdae9a8048f1ef0dd4452c833cbfaca0aef17c43e54c655d8d58e70f8de46a
@@ -56,6 +56,7 @@ module Speedflow
56
56
  data = IssueFormatter.to_create(project_key, title, issue_type_id)
57
57
  issue.save!(data)
58
58
  issue.fetch
59
+ issue
59
60
  end
60
61
  end
61
62
 
@@ -121,6 +122,31 @@ module Speedflow
121
122
  safe { jira_client.Issuetype.all }
122
123
  end
123
124
 
125
+ # Public: Issue link.
126
+ #
127
+ # issue_key - Issue key.
128
+ #
129
+ # Returns issue link.
130
+ def issue_link(issue_key)
131
+ issue_link = @config.by_config('site')
132
+ issue_link << @config.by_config('context_path')
133
+ issue_link << '/browse/'
134
+ issue_link << issue_key
135
+ issue_link
136
+ end
137
+
138
+ # Public: Issue output formatter.
139
+ #
140
+ # issue - ::JIRA::Resource::Issue
141
+ #
142
+ # Returns Hash.
143
+ def issue_output_format(issue)
144
+ { 'issue' => {
145
+ 'key' => issue.key,
146
+ 'summary' => issue.fields['summary'],
147
+ 'url' => issue_link(issue.key) } }
148
+ end
149
+
124
150
  # Public: Safe process JIRA action.
125
151
  #
126
152
  # Returns nothing.
@@ -137,16 +163,30 @@ module Speedflow
137
163
 
138
164
  # Public: Jira client.
139
165
  #
140
- # Returns JIRA::Client instance.
166
+ # Returns <::JIRA::Client> instance.
141
167
  def jira_client
142
- @jira_client ||= ::JIRA::Client.new(@config.auth)
168
+ @jira_client ||= ::JIRA::Client.new(auth)
169
+ end
170
+
171
+ # Public: Auth hash for JIRA.
172
+ #
173
+ # Returns hash of auth.
174
+ def auth
175
+ {
176
+ username: @config.by_config('username'),
177
+ password: @config.by_config('password'),
178
+ site: @config.by_config('site'),
179
+ context_path: @config.by_config('context_path', ''),
180
+ auth_type: @config.by_config('auth_type', :basic).to_sym,
181
+ read_timeout: @config.by_config('read_timeout', 120).to_i
182
+ }
143
183
  end
144
184
 
145
185
  # Public: Prompt.
146
186
  #
147
- # Returns ::Speedflow::Plugin::Jira::Prompt instance.
187
+ # Returns <::Speedflow::Plugin::Prompt> instance.
148
188
  def prompt
149
- @prompt ||= ::Speedflow::Plugin::Jira::Prompt.new
189
+ @prompt ||= ::Speedflow::Plugin::Prompt.new
150
190
  end
151
191
  end
152
192
  end
@@ -1,85 +1,91 @@
1
1
  module Speedflow
2
2
  module Plugin
3
3
  module Jira
4
- # Plugin core
5
- class PluginCore
6
- # @return [Prompt] Plugin prompt.
7
- attr_writer :prompt
8
-
4
+ # JIRA Plugin
5
+ class Plugin < Speedflow::Plugin::Abstract
9
6
  # @return [Client] Plugin client.
10
7
  attr_writer :client
11
8
 
12
- # @return [Config] Plugin config.
13
- attr_writer :config
9
+ # @return [Prompt] Plugin prompt.
10
+ attr_writer :prompt
14
11
 
15
- # Initialize.
12
+ # Public: Constructor
16
13
  #
17
- # arguments - Hash of arguments.
14
+ # config - Speedflow::Plugin::Configuration object.
15
+ # prompt - Speedflow::Plugin::Prompt object.
18
16
  #
19
17
  # Examples
20
18
  #
21
- # Plugin.new({})
22
- # # => <Speedflow::Plugin::Jira::PluginCore>
19
+ # Manager.new(
20
+ # <Speedflow::Plugin::Configuration.new({})>,
21
+ # <Speedflow::Plugin::Prompt.new>)
22
+ # # => <Speedflow::Plugin::Abstract>
23
23
  #
24
24
  # Returns nothing.
25
- def initialize(arguments)
26
- @arguments = arguments
25
+ def initialize(config, _)
26
+ super(config, Prompt.new)
27
27
  end
28
28
 
29
29
  # Public: Create issue.
30
30
  #
31
31
  # Returns Hash of issue.
32
32
  def action_create_issue
33
- title = config.by_required_input('title')
33
+ title = @config.by_required_input('title')
34
34
 
35
- project_key = config.by_input('project')
36
- project_key = prompt.project(client.projects) if project_key.empty?
35
+ project_key = @config.by_input('project')
36
+ project_key = @prompt.project(client.projects) if project_key.empty?
37
37
 
38
- issue_type_id = config.by_input('type')
38
+ issue_type_id = @config.by_input('type')
39
39
  if issue_type_id.empty?
40
- issue_type_id = prompt.issue_type(client.issue_types)
40
+ issue_type_id = @prompt.issue_type(client.issue_types)
41
41
  end
42
42
 
43
- client.create_issue(project_key, title, issue_type_id)
43
+ issue = client.create_issue(project_key, title, issue_type_id)
44
+
45
+ client.issue_output_format(issue)
44
46
  end
45
47
 
46
48
  # Public: Search issue.
47
49
  #
48
- # Returns Hash of issue.
50
+ # Returns Hash.
49
51
  def action_search_issue
50
52
  limit = config.by_input('limit', 20)
51
53
  project = config.by_input('project')
52
54
  project = prompt.project(client.projects) if project.empty?
53
55
 
54
- issue_id = prompt.issue do |title|
56
+ issue_key = prompt.issue do |title|
55
57
  client.search_issue(project, title).take(limit.to_i)
56
58
  end
57
59
 
58
- issue_id
60
+ prompt.ok "[JIRA] Issue found: #{issue_key}"
61
+
62
+ { 'issue' => { 'key' => issue_key } }
59
63
  end
60
64
 
61
65
  # Public: Change issue assignee.
62
66
  #
63
- # Returns Hash of assignee.
67
+ # Returns Hash.
64
68
  def action_change_issue_assignee
65
- issue_key = config.by_input('issue')
66
- assignee_name = config.by_input('assignee')
69
+ issue_key = @config.by_input('issue')
70
+ assignee_name = @config.by_input('assignee')
67
71
 
68
- issue_key = action_search_issue if issue_key.empty?
72
+ issue_key = action_search_issue['issue']['key'] if issue_key.empty?
69
73
 
70
74
  client.update_issue_assignee(issue_key, assignee_name)
71
75
 
72
76
  prompt.ok "[JIRA] Issue assignee changed to: #{assignee_name}"
77
+
78
+ { 'issue' => { 'key' => issue_key, 'assignee' => assignee_name } }
73
79
  end
74
80
 
75
81
  # Public: Change issue transition.
76
82
  #
77
- # Returns Hash of assignee.
83
+ # Returns Hash.
78
84
  def action_change_issue_transition
79
85
  issue_key = config.by_input('issue')
80
86
  transition_id = config.by_input('transition')
81
87
 
82
- issue_key = action_search_issue if issue_key.empty?
88
+ issue_key = action_search_issue['issue']['key'] if issue_key.empty?
83
89
 
84
90
  if transition_id.empty?
85
91
  transition_id = prompt.transition(client.issue_trans(issue_key))
@@ -88,13 +94,8 @@ module Speedflow
88
94
  client.update_issue_transition(issue_key, transition_id)
89
95
 
90
96
  prompt.ok "[JIRA] Issue transition changed to: #{transition_id}"
91
- end
92
97
 
93
- # Public: Plugin configuration.
94
- #
95
- # Returns Configuration instance.
96
- def config
97
- @config ||= Configuration.new(@arguments)
98
+ { 'issue' => { 'key' => issue_key, 'transition' => transition_id } }
98
99
  end
99
100
 
100
101
  # Public: Plugin client.
@@ -103,13 +104,6 @@ module Speedflow
103
104
  def client
104
105
  @client ||= Client.new(@config, @prompt)
105
106
  end
106
-
107
- # Public: Plugin prompt.
108
- #
109
- # Returns Prompt instance.
110
- def prompt
111
- @prompt ||= Prompt.new
112
- end
113
107
  end
114
108
  end
115
109
  end
@@ -5,8 +5,8 @@ module Speedflow
5
5
  module Plugin
6
6
  module Jira
7
7
  # Plugin prompt
8
- class Prompt # < TTY::Prompt
9
- # @return [TTY::Prompt] TTY::Prompt.
8
+ class Prompt
9
+ # @return [<::Speedflow::Plugin::Prompt>] Plugin prompt.
10
10
  attr_writer :prompt
11
11
 
12
12
  # Public: Prompt title.
@@ -69,8 +69,7 @@ module Speedflow
69
69
  end
70
70
  end
71
71
 
72
- issue(&issues) if sel_issue == :retry
73
- ok "[JIRA] Issue found: #{sel_issue}" unless sel_issue == :retry
72
+ sel_issue = issue(&issues) if sel_issue == :retry
74
73
 
75
74
  sel_issue
76
75
  end
@@ -99,11 +98,11 @@ module Speedflow
99
98
  prompt.send(method, *args, &block)
100
99
  end
101
100
 
102
- # Public: TTY prompt.
101
+ # Public: Prompt.
103
102
  #
104
- # Returns ::TTY::Prompt instance.
103
+ # Returns <::Speedflow::Plugin::Prompt> instance.
105
104
  def prompt
106
- @prompt ||= ::TTY::Prompt.new
105
+ @prompt ||= ::Speedflow::Plugin::Prompt.new
107
106
  end
108
107
  end
109
108
  end
@@ -1,7 +1,7 @@
1
1
  module Speedflow
2
2
  module Plugin
3
3
  module Jira
4
- VERSION = '0.2.2'.freeze
4
+ VERSION = '0.3.0'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -1,47 +1,6 @@
1
+ require 'speedflow'
1
2
  require 'speedflow/plugin/jira/version'
2
3
  require 'speedflow/plugin/jira/formatter/issue_formatter'
3
- require 'speedflow/plugin/jira/plugin_core'
4
+ require 'speedflow/plugin/jira/plugin'
4
5
  require 'speedflow/plugin/jira/prompt'
5
- require 'speedflow/plugin/jira/configuration'
6
6
  require 'speedflow/plugin/jira/client'
7
-
8
- # Speedflow GEM, help you to boost your flow and keep your time.
9
- module Speedflow
10
- module Plugin
11
- # Jira Speedflow plugin.
12
- module Jira
13
- # TODO: Move this system in the core Utils
14
- class << self
15
- ACTIONS = [
16
- :action_create_issue,
17
- :action_search_issue,
18
- :action_change_issue_assignee,
19
- :action_change_issue_transition
20
- ].freeze
21
-
22
- # @return [Speedflow::Plugin::Jira.PluginCore] Plugin.
23
- attr_writer :plugin
24
-
25
- # Public: Magic method to route to action
26
- #
27
- # args - Some arguments :)
28
- #
29
- # Returns nothing.
30
- def method_missing(*args)
31
- action = args.first
32
-
33
- raise NoMethodError, action unless ACTIONS.include? action
34
-
35
- plugin.new(args.last).send(action)
36
- end
37
-
38
- # Public: Plugin.
39
- #
40
- # Returns Speedflow::Plugin::Jira.PluginCore instance.
41
- def plugin
42
- @plugin ||= PluginCore
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,13 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Speedflow::Plugin::Jira::Client do
4
+ let(:config_site) { 'https://xxx.atlassian.net' }
4
5
  let(:args) do
5
6
  title = { 'value' => 'test' }
6
7
  assignee = { 'default' => 'julien.breux' }
7
- { 'title' => title, 'assignee' => assignee }
8
+ config = { 'jira' => { 'site' => config_site } }
9
+ { 'title' => title, 'assignee' => assignee, '_config' => config }
8
10
  end
9
11
  let(:config) do
10
- ::Speedflow::Plugin::Jira::Configuration.new(args)
12
+ ::Speedflow::Plugin::Configuration.new(args, 'jira')
11
13
  end
12
14
  let(:prompt) do
13
15
  prompt = ::Speedflow::Plugin::Jira::Prompt.new
@@ -87,6 +89,21 @@ describe Speedflow::Plugin::Jira::Client do
87
89
  client.issue_trans('T-1')
88
90
  end
89
91
 
92
+ it '.issue_link' do
93
+ expect(client.issue_link('T-1'))
94
+ .to eq config_site
95
+ end
96
+
97
+ it '.issue_output_format' do
98
+ issue = double(key: 'T-1', fields: { 'summary' => 'Test' })
99
+
100
+ expected_hash = {
101
+ 'issue' => { 'key' => 'T-1', 'summary' => 'Test',
102
+ 'url' => "#{config_site}/browse/T-1" } }
103
+ expect(client.issue_output_format(issue))
104
+ .to eq expected_hash
105
+ end
106
+
90
107
  it '.safe' do
91
108
  allow(client.prompt)
92
109
  .to receive(:error).with('Invalid URL')
@@ -108,4 +125,18 @@ describe Speedflow::Plugin::Jira::Client do
108
125
  end
109
126
  e.to raise_error(SystemExit)
110
127
  end
128
+
129
+ it '.auth' do
130
+ expected_hash = {
131
+ auth_type: :basic,
132
+ context_path: '',
133
+ password: '',
134
+ read_timeout: 120,
135
+ site: 'https://xxx.atlassian.net',
136
+ username: ''
137
+ }
138
+
139
+ expect(client.auth)
140
+ .to eq expected_hash
141
+ end
111
142
  end
@@ -1,9 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Speedflow::Plugin::Jira::PluginCore do
3
+ describe Speedflow::Plugin::Jira::Plugin do
4
4
  let(:plugin) do
5
- plugin = ::Speedflow::Plugin::Jira::PluginCore.new({})
6
- plugin.config = double
5
+ plugin = ::Speedflow::Plugin::Jira::Plugin.new(double, double)
7
6
  plugin.prompt = double
8
7
  plugin.client = double
9
8
  plugin
@@ -32,11 +31,26 @@ describe Speedflow::Plugin::Jira::PluginCore do
32
31
  .with('3')
33
32
  .and_return('3')
34
33
 
34
+ allow(plugin.client)
35
+ .to receive(:issue_link)
36
+ .with('T-1')
37
+ .and_return('xxx')
38
+
39
+ return_object = double(key: 'T-1', fields: { 'summary' => 'Test' })
35
40
  allow(plugin.client)
36
41
  .to receive(:create_issue)
37
42
  .with('T', 'Test', '3')
43
+ .and_return(return_object)
38
44
 
39
- plugin.action_create_issue
45
+ expected_hash = { 'foo' => 'bar' }
46
+
47
+ allow(plugin.client)
48
+ .to receive(:issue_output_format)
49
+ .with(return_object)
50
+ .and_return(expected_hash)
51
+
52
+ expect(plugin.action_create_issue)
53
+ .to eq expected_hash
40
54
  end
41
55
 
42
56
  it '.action_search_issue' do
@@ -53,12 +67,18 @@ describe Speedflow::Plugin::Jira::PluginCore do
53
67
  .to receive(:issue)
54
68
  .and_yield('test')
55
69
 
70
+ allow(plugin.prompt)
71
+ .to receive(:ok)
72
+ .with('[JIRA] Issue found: T-1')
73
+
56
74
  allow(plugin.client)
57
75
  .to receive(:search_issue)
58
76
  .with('T', 'test')
59
77
  .and_return(double(take: 'T-1'))
60
78
 
61
- expect(plugin.action_search_issue).to eq 'T-1'
79
+ expected_hash = { 'issue' => { 'key' => 'T-1' } }
80
+ expect(plugin.action_search_issue)
81
+ .to eq expected_hash
62
82
  end
63
83
 
64
84
  it '.action_change_issue_assignee' do
@@ -80,7 +100,10 @@ describe Speedflow::Plugin::Jira::PluginCore do
80
100
  .with('T-1', 'julien.breux')
81
101
  .and_return(double(take: 'T-1'))
82
102
 
83
- plugin.action_change_issue_assignee
103
+ expected_hash = {
104
+ 'issue' => { 'key' => 'T-1', 'assignee' => 'julien.breux' } }
105
+ expect(plugin.action_change_issue_assignee)
106
+ .to eq expected_hash
84
107
  end
85
108
 
86
109
  it '.action_change_issue_transition' do
@@ -110,6 +133,8 @@ describe Speedflow::Plugin::Jira::PluginCore do
110
133
  .to receive(:ok)
111
134
  .with('[JIRA] Issue transition changed to: 1')
112
135
 
113
- plugin.action_change_issue_transition
136
+ expected_hash = { 'issue' => { 'key' => 'T-1', 'transition' => '1' } }
137
+ expect(plugin.action_change_issue_transition)
138
+ .to eq expected_hash
114
139
  end
115
140
  end
@@ -1,19 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Speedflow::Plugin::Jira do
4
- let(:plugin) do
5
- double(new: double(action_create_issue: nil))
6
- end
7
-
8
4
  it 'has a version number' do
9
5
  expect(Speedflow::Plugin::Jira::VERSION).not_to be nil
10
6
  end
11
-
12
- it 'has an action catcher' do
13
- expect { Speedflow::Plugin::Jira.action_lol }.to raise_error(NoMethodError)
14
-
15
- Speedflow::Plugin::Jira.plugin = plugin
16
-
17
- expect(Speedflow::Plugin::Jira.action_create_issue).to eq nil
18
- end
19
7
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speedflow-plugin-jira
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Breux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2016-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: jira-ruby
14
+ name: speedflow
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.17
19
+ version: '0.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.17
26
+ version: '0.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: tty-prompt
28
+ name: jira-ruby
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.5.0
33
+ version: 0.1.17
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.5.0
40
+ version: 0.1.17
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -178,16 +178,14 @@ files:
178
178
  - lib/speedflow-plugin-jira.rb
179
179
  - lib/speedflow/plugin/jira.rb
180
180
  - lib/speedflow/plugin/jira/client.rb
181
- - lib/speedflow/plugin/jira/configuration.rb
182
181
  - lib/speedflow/plugin/jira/formatter/issue_formatter.rb
183
- - lib/speedflow/plugin/jira/plugin_core.rb
182
+ - lib/speedflow/plugin/jira/plugin.rb
184
183
  - lib/speedflow/plugin/jira/prompt.rb
185
184
  - lib/speedflow/plugin/jira/version.rb
186
185
  - spec/spec_helper.rb
187
186
  - spec/speedflow/plugin/jira/client_spec.rb
188
- - spec/speedflow/plugin/jira/configuration_spec.rb
189
187
  - spec/speedflow/plugin/jira/formatter/issue_formatter_spec.rb
190
- - spec/speedflow/plugin/jira/plugin_core_spec.rb
188
+ - spec/speedflow/plugin/jira/plugin_spec.rb
191
189
  - spec/speedflow/plugin/jira/prompt_spec.rb
192
190
  - spec/speedflow/plugin/jira_spec.rb
193
191
  homepage: https://github.com/speedflow/speedflow-plugin-jira
@@ -1,84 +0,0 @@
1
- module Speedflow
2
- module Plugin
3
- module Jira
4
- # Jira Configuration
5
- class Configuration
6
- CONFIG_KEY = '_config'.freeze
7
- PLUGIN_KEY = 'jira'.freeze
8
-
9
- # Initialize.
10
- #
11
- # arguments - Hash of arguments.
12
- #
13
- # Examples
14
- #
15
- # Configuration.new({})
16
- # # => <Speedflow::Plugin::Jira::Configuration>
17
- #
18
- # Returns nothing.
19
- def initialize(arguments)
20
- @arguments = arguments
21
- end
22
-
23
- # Public: Auth configuration.
24
- #
25
- # Returns Hash of auth configuration.
26
- def auth
27
- {
28
- username: by_config('username'),
29
- password: by_config('password'),
30
- site: by_config('site'),
31
- context_path: by_config('context_path', '/'),
32
- auth_type: by_config('auth_type', :basic),
33
- read_timeout: by_config('read_timeout', 120)
34
- }
35
- end
36
-
37
- # Public: Get a specific config.
38
- #
39
- # key - Key of config.
40
- # default_value - Default value.
41
- #
42
- # Returns value of config key.
43
- def by_config(key, default_value = '')
44
- if @arguments.key?(CONFIG_KEY) &&
45
- @arguments[CONFIG_KEY].key?(PLUGIN_KEY)
46
- config = @arguments[CONFIG_KEY][PLUGIN_KEY]
47
- end
48
- config.key?(key) ? config[key] : default_value
49
- end
50
-
51
- # Public: Get an input config by key.
52
- #
53
- # key - Key of config.
54
- # default_value - Default value.
55
- #
56
- # Returns value of input config key.
57
- def by_input(key, default_value = '')
58
- if @arguments.key?(key)
59
- @arguments[key]['value'].to_s
60
- else
61
- default_value
62
- end
63
- end
64
-
65
- # Public: Get an input config by key but required.
66
- #
67
- # key - Key of config.
68
- # default_value - Default value.
69
- #
70
- # Returns value of input config key or Exception.
71
- def by_required_input(key, default_value = '')
72
- value = by_input(key, default_value)
73
-
74
- # TODO: Improve communication with core for errors
75
- if by_input(key).empty?
76
- raise Exception, "Required value for '#{key}'."
77
- end
78
-
79
- value
80
- end
81
- end
82
- end
83
- end
84
- end
@@ -1,53 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Speedflow::Plugin::Jira::Configuration do
4
- let(:config) do
5
- title = { 'value' => 'hello' }
6
- num = { 'value' => 3 }
7
- jira_config = { 'username' => 'foo', 'password' => 'bar', 'site' => 'baz' }
8
- config = { 'jira' => jira_config }
9
- args = { 'num' => num, 'title' => title, '_config' => config }
10
- Speedflow::Plugin::Jira::Configuration.new(args)
11
- end
12
-
13
- it '.by_config' do
14
- expect(config.by_config('username', 'default'))
15
- .to eq 'foo'
16
- end
17
-
18
- it '.by_input' do
19
- expect(config.by_input('title', 'default'))
20
- .to eq 'hello'
21
-
22
- expect(config.by_input('num'))
23
- .to eq '3'
24
-
25
- expect(config.by_input('notitle', 'default'))
26
- .to eq 'default'
27
- end
28
-
29
- it '.by_required_input' do
30
- expect(config.by_required_input('title', 'default'))
31
- .to eq 'hello'
32
-
33
- expect { config.by_required_input('notitle') }
34
- .to raise_error(Exception)
35
-
36
- expect { config.by_required_input('nonotitle', 'default') }
37
- .to raise_error(Exception)
38
- end
39
-
40
- it '.auth' do
41
- returned_hash = {
42
- auth_type: :basic,
43
- context_path: '/',
44
- password: 'bar',
45
- read_timeout: 120,
46
- site: 'baz',
47
- username: 'foo'
48
- }
49
-
50
- expect(config.auth)
51
- .to eq returned_hash
52
- end
53
- end