on 0.0.1 → 0.1.0

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.
data/.travis.yml CHANGED
@@ -9,6 +9,4 @@ rvm:
9
9
  - rbx-18mode
10
10
  - rbx-19mode
11
11
  - ruby-head
12
- branches:
13
- only:
14
- - master
12
+ script: rake test:all
data/Rakefile CHANGED
@@ -11,6 +11,18 @@ Rake::TestTask.new do |t|
11
11
  t.verbose = true
12
12
  end
13
13
 
14
+ namespace :test do
15
+ desc "Run tests in isolation"
16
+ task :isolation do
17
+ FileList['test/*_test.rb'].each do |test_file|
18
+ ruby "-Ilib:test #{test_file}"
19
+ end
20
+ end
21
+
22
+ desc "Run tests with isolation tests"
23
+ task :all => [ :test, :"test:isolation" ]
24
+ end
25
+
14
26
  # RDoc
15
27
  require 'rdoc/task'
16
28
  RDoc::Task.new do |rdoc|
data/lib/on/proc.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'on'
2
+
1
3
  # Syntatic sugar for creating an +on+ callback from Proc.
2
4
  #
3
5
  # = Example
data/lib/on/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class On
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
data/test/helper.rb CHANGED
@@ -1,4 +1,22 @@
1
1
  require 'minitest/autorun'
2
2
  require 'testem'
3
3
 
4
- require 'on'
4
+ class Testem
5
+ let(:called) { [] }
6
+
7
+ setup do
8
+ called.clear
9
+ end
10
+
11
+ def called!(*args)
12
+ called << args
13
+ end
14
+
15
+ def assert_called(*args)
16
+ assert_equal called, args
17
+ end
18
+
19
+ def assert_nothing_called
20
+ assert_called
21
+ end
22
+ end
@@ -1,7 +1,8 @@
1
1
  require 'helper'
2
2
 
3
- class IntegrationTest < Testem
3
+ require 'on'
4
4
 
5
+ class IntegrationTest < Testem
5
6
  def tweet(message, &block)
6
7
  callback = On.new(:success, :failure, &block)
7
8
  case message
@@ -12,12 +13,6 @@ class IntegrationTest < Testem
12
13
  end
13
14
  end
14
15
 
15
- let(:called) { [] }
16
-
17
- before do
18
- called.clear
19
- end
20
-
21
16
  test "it calls success" do
22
17
  tweet "Sir, hello world" do |callback|
23
18
  called! :method
@@ -68,14 +63,4 @@ class IntegrationTest < Testem
68
63
 
69
64
  assert_called [:method]
70
65
  end
71
-
72
- private
73
-
74
- def assert_called(*args)
75
- assert_equal called, args
76
- end
77
-
78
- def called!(*args)
79
- called << args
80
- end
81
66
  end
data/test/on_proc_test.rb CHANGED
@@ -24,26 +24,10 @@ class OnProcTest < Testem
24
24
  end
25
25
  end
26
26
 
27
- let(:called) { [] }
28
-
29
- before do
30
- called.clear
31
- end
32
-
33
27
  test "call proc" do
34
28
  verify(1)
35
29
  verify(2)
36
30
 
37
31
  assert_called [ :block, 1 ], [ :odd ], [ :block, 2 ], [ :even ]
38
32
  end
39
-
40
- private
41
-
42
- def assert_called(*args)
43
- assert_equal called, args
44
- end
45
-
46
- def called!(*args)
47
- called << args
48
- end
49
33
  end
data/test/on_test.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  require 'helper'
2
2
 
3
- class OnTest < Testem
4
- let(:called) { [] }
3
+ require 'on'
5
4
 
5
+ class OnTest < Testem
6
6
  context "initialize" do
7
7
  test "at least one callback" do
8
8
  e = assert_raises ArgumentError do
@@ -81,16 +81,4 @@ class OnTest < Testem
81
81
  assert_nothing_called
82
82
  end
83
83
  end
84
-
85
- def called!(*args)
86
- called << args
87
- end
88
-
89
- def assert_called(*args)
90
- assert_equal called, args
91
- end
92
-
93
- def assert_nothing_called
94
- assert_called
95
- end
96
84
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 'on'
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
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: 2012-11-21 00:00:00.000000000 Z
12
+ date: 2012-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  segments:
112
112
  - 0
113
- hash: 4033254695859622643
113
+ hash: 418871734339587128
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  none: false
116
116
  requirements:
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  segments:
121
121
  - 0
122
- hash: 4033254695859622643
122
+ hash: 418871734339587128
123
123
  requirements: []
124
124
  rubyforge_project:
125
125
  rubygems_version: 1.8.24