bumbleworks-gui 0.0.5 → 0.0.6

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: dedbd3923bbc3165fe31905124efcdba6ab9b736
4
- data.tar.gz: 84e2b4ec345d50d9e4e26ff8f8e2aa46890758d7
3
+ metadata.gz: cc4490ff3c596a984d4b6940f742de3d6476460b
4
+ data.tar.gz: 11b127ebf00a42af42ad8b00d07f18916131a4ea
5
5
  SHA512:
6
- metadata.gz: 5e9891fe4a01b6be05a4b5ebfec65fcb9ad76c135dd0815b2268ee43c20401c3e2c3e3b37414287e7970c5c5c522195611b51d6348e70324dde20c09f872da20
7
- data.tar.gz: 266facdeae58cba52227902a50e84dadc95b1b7057f285d8f4dfb8c88c22bf6302a1a2e4f3efa767ca9de8dfccb65c25695276a90670f72cba69cad43313a303
6
+ metadata.gz: 4ba3bd612b5aefdfce7a8cbc6d7f3fc4063030821baf63a11087e60d145b50f7e94fe93d14b91d7580a2f89717e9564af783bebc7a45498de24f57986d202635
7
+ data.tar.gz: 8f4b1732ae4f1406ace7778eac4198027890a58dc9cfee01319e4fff39d9b89339ffbaa0f00d3333ec1ed6cf0a3d878f2109837d41c22852d53cfcdea4be420f
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_runtime_dependency "bumbleworks", ">= 0.0.82"
22
+ spec.add_runtime_dependency "bumbleworks", ">= 0.0.83"
23
23
  spec.add_runtime_dependency "rory", ">= 0.3.11"
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
@@ -12,8 +12,8 @@ module Bumbleworks
12
12
  end
13
13
 
14
14
  def change_global_state
15
- new_state = params[:state]
16
- Bumbleworks::Worker.change_worker_state(new_state)
15
+ command = params[:command]
16
+ Bumbleworks::Worker.send("#{command}_all")
17
17
  redirect path_to('workers_index')
18
18
  end
19
19
 
@@ -1,5 +1,5 @@
1
1
  module Bumbleworks
2
2
  module Gui
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -3,12 +3,12 @@
3
3
  </div>
4
4
 
5
5
  <div class="action-button-group">
6
- <% { :paused => 'Pause', :running => 'Start', :stopped => 'Stop' }.each do |state, action| %>
6
+ <% %w(shutdown pause unpause).each do |command| %>
7
7
  <form action="<%= path_to 'workers_change_global_state' %>" class="inline" method="post">
8
8
  <input type="hidden" name="_method" value="put">
9
- <input type="hidden" name="state" value="<%= state %>">
10
- <button type="submit" name="action" value="<%= action.downcase %>" class="pure-button button-error button-bottom" id="<%= action.downcase %>-button">
11
- <%= action %> All
9
+ <input type="hidden" name="command" value="<%= command %>">
10
+ <button type="submit" name="action" value="<%= command %>" class="pure-button button-error button-bottom" id="<%= command %>-button">
11
+ <%= command.capitalize %> All
12
12
  </button>
13
13
  </form>
14
14
  <% end %>
@@ -3,39 +3,42 @@ feature "Worker management" do
3
3
  let(:worker_detail) { WorkerDetail.new(Capybara) }
4
4
 
5
5
  scenario "Admin views worker index" do
6
- worker1 = Bumbleworks.start_worker!
7
- worker2 = Bumbleworks.start_worker!
6
+ other_worker = Bumbleworks.start_worker!
8
7
 
9
8
  visit_scoped '/workers'
10
9
 
11
- expect(worker_index).to have_workers([Bumbleworks.dashboard.worker, worker1, worker2])
10
+ expect(worker_index).to have_workers([Bumbleworks.dashboard.worker, other_worker])
11
+
12
+ other_worker.shutdown
12
13
  end
13
14
 
14
15
  scenario "Admin views worker detail" do
15
- worker = Bumbleworks.start_worker!
16
-
17
- visit_scoped "/workers/#{worker.id}"
16
+ visit_scoped "/workers/#{Bumbleworks.dashboard.worker.id}"
18
17
 
19
- expect(worker_detail).to have_worker(worker)
18
+ expect(worker_detail).to have_worker(Bumbleworks.dashboard.worker)
20
19
  end
21
20
 
22
21
  scenario "Admin pauses all workers" do
23
- worker1 = Bumbleworks.start_worker!
24
- worker2 = Bumbleworks.start_worker!
22
+ other_worker = Bumbleworks.start_worker!
25
23
 
26
24
  visit_scoped "/workers"
27
25
  click_button :pause
28
26
  expect(page).not_to have_text('running')
29
27
  expect(page).to have_text('paused')
28
+
29
+ # return to single running worker
30
+ click_button :unpause
31
+ other_worker.shutdown
30
32
  end
31
33
 
32
34
  scenario "Admin purges stale worker info" do
33
- worker1 = Bumbleworks.start_worker!
34
- worker2 = Bumbleworks.start_worker!
35
+ other_worker = Bumbleworks.start_worker!
35
36
 
36
37
  visit_scoped "/workers"
37
- click_button :stop
38
+ click_button :shutdown
38
39
  click_button :purge
39
- expect(worker_index).not_to have_workers([worker1, worker2])
40
+ expect(worker_index).not_to have_workers([Bumbleworks.dashboard.worker, other_worker])
41
+
42
+ Bumbleworks.start_worker!
40
43
  end
41
44
  end
@@ -0,0 +1,42 @@
1
+ describe TimeSupport do
2
+ describe '.seconds_to_units' do
3
+ it 'returns hash of subdivided units for given seconds' do
4
+ described_class.seconds_to_units(33924.5).should eq({
5
+ :hours => 9,
6
+ :minutes => 25,
7
+ :seconds => 24
8
+ })
9
+ end
10
+
11
+ it 'includes zero units if requested' do
12
+ described_class.seconds_to_units(33924.5, include_zeros: true).should eq({
13
+ :days => 0,
14
+ :hours => 9,
15
+ :minutes => 25,
16
+ :seconds => 24
17
+ })
18
+ end
19
+
20
+ it 'does not round seconds if switched off' do
21
+ described_class.seconds_to_units(33924.5, round_seconds: false).should eq({
22
+ :hours => 9,
23
+ :minutes => 25,
24
+ :seconds => 24.5
25
+ })
26
+ end
27
+ end
28
+
29
+ describe '.seconds_to_units_in_words' do
30
+ it 'wordifies response from seconds_to_units' do
31
+ allow(described_class).to receive(:seconds_to_units).
32
+ with(90210.5, foo: 'bar').
33
+ and_return({
34
+ :days => 2,
35
+ :minutes => 5,
36
+ :spinachios => 42
37
+ })
38
+ expect(described_class.seconds_to_units_in_words(90210.5, foo: 'bar')).
39
+ to eq("2 days, 5 minutes, 42 spinachios")
40
+ end
41
+ end
42
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bumbleworks-gui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ravi Gadad
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.82
19
+ version: 0.0.83
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.0.82
26
+ version: 0.0.83
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rory
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -200,6 +200,7 @@ files:
200
200
  - spec/fixtures/participants/naughty_participant.rb
201
201
  - spec/fixtures/processes/task_process.rb
202
202
  - spec/fixtures/processes/waiting_process.rb
203
+ - spec/lib/time_support_spec.rb
203
204
  - spec/spec_helper.rb
204
205
  - spec/support/drivers/dashboard_detail.rb
205
206
  - spec/support/drivers/entity_detail.rb
@@ -258,6 +259,7 @@ test_files:
258
259
  - spec/fixtures/participants/naughty_participant.rb
259
260
  - spec/fixtures/processes/task_process.rb
260
261
  - spec/fixtures/processes/waiting_process.rb
262
+ - spec/lib/time_support_spec.rb
261
263
  - spec/spec_helper.rb
262
264
  - spec/support/drivers/dashboard_detail.rb
263
265
  - spec/support/drivers/entity_detail.rb