spring 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,4 +15,4 @@
15
15
  /tmp
16
16
 
17
17
  /bin
18
- /vendor/gems/*
18
+ /vendor/gems
@@ -0,0 +1,50 @@
1
+ require 'helper'
2
+
3
+ require "spring/client/command"
4
+ require 'spring/client/help'
5
+ require 'spring/client'
6
+
7
+ class RandomSpringCommand
8
+ def self.description
9
+ 'Random Spring Command'
10
+ end
11
+ end
12
+
13
+ class RandomApplicationCommand
14
+ def description
15
+ 'Random Application Command'
16
+ end
17
+ end
18
+
19
+ class HelpTest < ActiveSupport::TestCase
20
+ def spring_commands
21
+ { 'command' => RandomSpringCommand }
22
+ end
23
+
24
+ def application_commands
25
+ @application_commands ||= begin
26
+ command = RandomApplicationCommand.new
27
+ { 'random' => command, 'r' => command }
28
+ end
29
+ end
30
+
31
+ def setup
32
+ @help = Spring::Client::Help.new('help', spring_commands, application_commands)
33
+ end
34
+
35
+ test "formatted_help generates expected output" do
36
+ expected_output = <<-EOF
37
+ Usage: spring COMMAND [ARGS]
38
+
39
+ Commands for spring itself:
40
+
41
+ command Random Spring Command
42
+
43
+ Commands for your application:
44
+
45
+ random, r Random Application Command
46
+ EOF
47
+
48
+ assert_equal expected_output.chomp, @help.formatted_help
49
+ end
50
+ end
@@ -2,7 +2,6 @@ require "helper"
2
2
  require "spring/commands"
3
3
 
4
4
  class CommandsTest < ActiveSupport::TestCase
5
-
6
5
  test "test command needs a test name" do
7
6
  begin
8
7
  real_stderr = $stderr
@@ -17,6 +16,27 @@ class CommandsTest < ActiveSupport::TestCase
17
16
  end
18
17
  end
19
18
 
19
+ test 'children of Command have inheritable accessor named "preload"' do
20
+ command1, command2 = 2.times.map { Class.new(Spring::Commands::Command) }
21
+
22
+ command1.preloads << "foo"
23
+ assert_equal ["foo"], command1.preloads
24
+ assert_equal [], command2.preloads
25
+
26
+ command2.preloads << "bar"
27
+ assert_equal ["foo"], command1.preloads
28
+ assert_equal ["bar"], command2.preloads
29
+
30
+ command1.preloads = ["omg"]
31
+ assert_equal ["omg"], command1.preloads
32
+ assert_equal ["bar"], command2.preloads
33
+
34
+ command3 = Class.new(command1)
35
+ command3.preloads << "foo"
36
+ assert_equal ["omg", "foo"], command3.preloads
37
+ assert_equal ["omg"], command1.preloads
38
+ end
39
+
20
40
  test "prints error message when preloaded file does not exist" do
21
41
  begin
22
42
  original_stderr = $stderr
@@ -30,5 +50,4 @@ class CommandsTest < ActiveSupport::TestCase
30
50
  $stderr = original_stderr
31
51
  end
32
52
  end
33
-
34
53
  end
@@ -0,0 +1,24 @@
1
+ require "helper"
2
+ require "spring/process_title_updater"
3
+ require "active_support/time"
4
+
5
+ class ProcessTitleUpdaterTest < ActiveSupport::TestCase
6
+ setup do
7
+ @start = Time.local(2012, 2, 12, 4, 3, 12)
8
+ @updater = Spring::ProcessTitleUpdater.new(@start) { }
9
+ end
10
+
11
+ test "seconds" do
12
+ assert_equal "1 sec", @updater.distance_in_words(@start + 1.second)
13
+ assert_equal "2 secs", @updater.distance_in_words(@start + 2.seconds)
14
+ end
15
+
16
+ test "minutes" do
17
+ assert_equal "1 min", @updater.distance_in_words(@start + 1.minute + 10.seconds)
18
+ assert_equal "5 mins", @updater.distance_in_words(@start + 5.minutes + 10.seconds)
19
+ end
20
+
21
+ test "hours" do
22
+ assert_equal "6 hours", @updater.distance_in_words(@start + 6.hours + 50.minutes)
23
+ end
24
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-07 00:00:00.000000000 Z
12
+ date: 2013-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -66,11 +66,13 @@ files:
66
66
  - lib/spring/client/command.rb
67
67
  - lib/spring/client/help.rb
68
68
  - lib/spring/client/run.rb
69
+ - lib/spring/client/status.rb
69
70
  - lib/spring/client/stop.rb
70
71
  - lib/spring/commands.rb
71
72
  - lib/spring/configuration.rb
72
73
  - lib/spring/env.rb
73
74
  - lib/spring/errors.rb
75
+ - lib/spring/process_title_updater.rb
74
76
  - lib/spring/server.rb
75
77
  - lib/spring/sid.rb
76
78
  - lib/spring/version.rb
@@ -141,11 +143,12 @@ files:
141
143
  - test/apps/rails-3-2/test/unit/post_test.rb
142
144
  - test/apps/rails-3-2/vendor/assets/javascripts/.gitkeep
143
145
  - test/apps/rails-3-2/vendor/assets/stylesheets/.gitkeep
144
- - test/apps/rails-3-2/vendor/gems/.gitkeep
145
146
  - test/apps/rails-3-2/vendor/plugins/.gitkeep
146
147
  - test/helper.rb
147
148
  - test/unit/application_watcher_test.rb
149
+ - test/unit/client/help_test.rb
148
150
  - test/unit/commands_test.rb
151
+ - test/unit/process_title_updater_test.rb
149
152
  homepage: http://github.com/jonleighton/spring
150
153
  licenses: []
151
154
  post_install_message:
@@ -166,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
169
  version: '0'
167
170
  requirements: []
168
171
  rubyforge_project:
169
- rubygems_version: 1.8.24
172
+ rubygems_version: 1.8.23
170
173
  signing_key:
171
174
  specification_version: 3
172
175
  summary: Rails application preloader
@@ -237,8 +240,9 @@ test_files:
237
240
  - test/apps/rails-3-2/test/unit/post_test.rb
238
241
  - test/apps/rails-3-2/vendor/assets/javascripts/.gitkeep
239
242
  - test/apps/rails-3-2/vendor/assets/stylesheets/.gitkeep
240
- - test/apps/rails-3-2/vendor/gems/.gitkeep
241
243
  - test/apps/rails-3-2/vendor/plugins/.gitkeep
242
244
  - test/helper.rb
243
245
  - test/unit/application_watcher_test.rb
246
+ - test/unit/client/help_test.rb
244
247
  - test/unit/commands_test.rb
248
+ - test/unit/process_title_updater_test.rb