flexmock 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -5,10 +5,3 @@ gem 'rake', ">= 0.9.2.2"
5
5
  group 'test' do
6
6
  gem 'rspec', ">= 2.0"
7
7
  end
8
-
9
- group 'dev' do
10
- gem 'rdoc'
11
- gem 'flog'
12
- gem 'flay'
13
- gem 'ghpreview'
14
- end
@@ -1,80 +1,20 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activesupport (3.2.12)
5
- i18n (~> 0.6)
6
- multi_json (~> 1.0)
7
- blankslate (3.1.2)
8
- charlock_holmes (0.6.9)
9
- diff-lcs (1.1.3)
10
- escape_utils (0.2.4)
11
- ffi (1.0.11)
12
- flay (2.1.0)
13
- ruby_parser (~> 3.0)
14
- sexp_processor (~> 4.0)
15
- flog (3.2.2)
16
- ruby_parser (~> 3.1, > 3.1.0)
17
- sexp_processor (~> 4.0)
18
- gemoji (1.4.0)
19
- ghpreview (0.0.6)
20
- github-linguist (= 2.1)
21
- html-pipeline (= 0.0.6)
22
- httpclient
23
- listen
24
- rb-fsevent
25
- github-linguist (2.1.0)
26
- charlock_holmes (~> 0.6.6)
27
- escape_utils (~> 0.2.3)
28
- mime-types (~> 1.18)
29
- pygments.rb (~> 0.2.13)
30
- github-markdown (0.5.3)
31
- html-pipeline (0.0.6)
32
- activesupport (>= 2)
33
- escape_utils (~> 0.2)
34
- gemoji (~> 1.0)
35
- github-linguist (~> 2.1)
36
- github-markdown (~> 0.5)
37
- nokogiri (~> 1.4)
38
- rinku (~> 1.7)
39
- sanitize (~> 2.0)
40
- httpclient (2.3.2)
41
- i18n (0.6.1)
42
- json (1.7.7)
43
- listen (0.7.2)
44
- mime-types (1.21)
45
- multi_json (1.6.1)
46
- nokogiri (1.5.6)
47
- pygments.rb (0.2.13)
48
- rubypython (~> 0.5.3)
49
- rake (10.0.3)
50
- rb-fsevent (0.9.3)
51
- rdoc (3.12.1)
52
- json (~> 1.4)
53
- rinku (1.7.2)
54
- rspec (2.12.0)
55
- rspec-core (~> 2.12.0)
56
- rspec-expectations (~> 2.12.0)
57
- rspec-mocks (~> 2.12.0)
58
- rspec-core (2.12.2)
59
- rspec-expectations (2.12.1)
60
- diff-lcs (~> 1.1.3)
61
- rspec-mocks (2.12.2)
62
- ruby_parser (3.1.1)
63
- sexp_processor (~> 4.1)
64
- rubypython (0.5.3)
65
- blankslate (>= 2.1.2.3)
66
- ffi (~> 1.0.7)
67
- sanitize (2.0.3)
68
- nokogiri (>= 1.4.4, < 1.6)
69
- sexp_processor (4.1.5)
4
+ diff-lcs (1.2.4)
5
+ rake (10.0.4)
6
+ rspec (2.13.0)
7
+ rspec-core (~> 2.13.0)
8
+ rspec-expectations (~> 2.13.0)
9
+ rspec-mocks (~> 2.13.0)
10
+ rspec-core (2.13.1)
11
+ rspec-expectations (2.13.0)
12
+ diff-lcs (>= 1.1.3, < 2.0)
13
+ rspec-mocks (2.13.1)
70
14
 
71
15
  PLATFORMS
72
16
  ruby
73
17
 
74
18
  DEPENDENCIES
75
- flay
76
- flog
77
- ghpreview
78
19
  rake (>= 0.9.2.2)
79
- rdoc
80
20
  rspec (>= 2.0)
data/Rakefile CHANGED
@@ -44,7 +44,7 @@ RDOC_FILES = FileList[
44
44
  'doc/**/*.rdoc',
45
45
  ] + EXAMPLE_DOC
46
46
 
47
- task :default => [:test_all, :rspec]
47
+ task :default => [:test_all, :rspec, :testunit]
48
48
  task :test_all => [:test]
49
49
  task :test_units => [:test]
50
50
  task :ta => [:test_all]
@@ -58,10 +58,23 @@ Rake::TestTask.new do |t|
58
58
  t.warning = true
59
59
  end
60
60
 
61
- Rake::TestTask.new(:test_extended) do |t|
62
- t.test_files = FileList['test/extended/*_test.rb']
63
- t.verbose = true
64
- t.warning = true
61
+ module Configuration
62
+ def self.minitest?
63
+ require 'minitest/autorun'
64
+ return true
65
+ rescue Exception
66
+ return false
67
+ end
68
+ end
69
+
70
+ task :testunit do
71
+ files = FileList['test/test_unit_integration/*_test.rb']
72
+ if ! Configuration.minitest?
73
+ files = files.reject { |fn| fn =~ /minitest/ }
74
+ end
75
+ files.each do |file|
76
+ sh "ruby -Ilib:. #{file}"
77
+ end
65
78
  end
66
79
 
67
80
  task :rspec do
@@ -11,22 +11,41 @@
11
11
 
12
12
  require 'flexmock/test_unit_integration'
13
13
 
14
- module Test
15
- module Unit
16
- class TestCase
17
- include FlexMock::ArgumentTypes
18
- include FlexMock::MockContainer
14
+ class FlexMock
15
+ module GenericTestCase
16
+ def self.define_extensions_on(klass)
17
+ klass.class_eval do
18
+ include FlexMock::ArgumentTypes
19
+ include FlexMock::MockContainer
19
20
 
20
- # Alias the original teardown behavior for later use.
21
- alias :flexmock_original_teardown :teardown
21
+ # Alias the original teardown behavior for later use.
22
+ alias :flexmock_original_teardown :teardown
22
23
 
23
- # Teardown the test case, verifying any mocks that might have been
24
- # defined in this test case.
25
- def teardown
26
- flexmock_teardown
27
- flexmock_original_teardown
24
+ # Teardown the test case, verifying any mocks that might have been
25
+ # defined in this test case.
26
+ def teardown
27
+ flexmock_teardown
28
+ flexmock_original_teardown
29
+ end
28
30
  end
31
+ end
32
+ end
33
+ end
29
34
 
35
+ if defined?(MiniTest)
36
+ module MiniTest
37
+ class Unit
38
+ class TestCase
39
+ FlexMock::GenericTestCase.define_extensions_on(self)
40
+ end
41
+ end
42
+ end
43
+ else
44
+ module Test
45
+ module Unit
46
+ class TestCase
47
+ FlexMock::GenericTestCase.define_extensions_on(self)
48
+ end
30
49
  end
31
50
  end
32
51
  end
@@ -3,7 +3,7 @@ class FlexMock
3
3
  NUMBERS = [
4
4
  MAJOR = 1,
5
5
  MINOR = 3,
6
- BUILD = 1,
6
+ BUILD = 2,
7
7
  ]
8
8
  end
9
9
 
@@ -22,11 +22,11 @@ class TestFlexmockDefaultFrameworkAdapter < Test::Unit::TestCase
22
22
  }
23
23
  end
24
24
 
25
- def test_make_assertion_doesnt_raise_exception
25
+ def test_make_assertion_doesnt_raise_exception_when_making_assertion
26
26
  @adapter.make_assertion("failure message") { true }
27
27
  end
28
28
 
29
- def test_make_assertion_doesnt_raise_exception
29
+ def test_make_assertion_doesnt_raise_exception_when_asserting_equal
30
30
  @adapter.assert_equal("a", "a", "no message")
31
31
  end
32
32
 
@@ -16,7 +16,13 @@ require "flexmock/test_unit"
16
16
 
17
17
  class TestFlexmockTestUnit < Test::Unit::TestCase
18
18
  def teardown
19
- super
19
+ failed = false
20
+ begin
21
+ super
22
+ rescue Exception => ex
23
+ failed = true
24
+ end
25
+ assert_equal @should_fail, failed, "Expected failed to be #{@should_fail}"
20
26
  end
21
27
 
22
28
  # This test should pass.
@@ -24,11 +30,13 @@ class TestFlexmockTestUnit < Test::Unit::TestCase
24
30
  m = flexmock("mock")
25
31
  m.should_receive(:hi).once
26
32
  m.hi
33
+ @should_fail = false
27
34
  end
28
35
 
29
36
  # This test should fail during teardown.
30
37
  def test_should_fail__mocks_are_auto_verified
31
38
  m = flexmock("mock")
32
39
  m.should_receive(:hi).once
40
+ @should_fail = true
33
41
  end
34
42
  end
@@ -0,0 +1,14 @@
1
+ require "minitest/autorun"
2
+ require 'flexmock/test_unit'
3
+
4
+ class SimpleTest < MiniTest::Unit::TestCase
5
+
6
+ # This validates that the minitest teardown method is properly
7
+ # aliased when using MiniTest.
8
+ #
9
+ # (see https://github.com/jimweirich/flexmock/issues/14).
10
+ #
11
+ def test_flexmock
12
+ flexmock()
13
+ end
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexmock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
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-03-04 00:00:00.000000000 Z
12
+ date: 2013-05-07 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! "\n FlexMock is a extremely simple mock object class compatible\n
15
15
  \ with the Test::Unit framework. Although the FlexMock's\n interface is
@@ -21,8 +21,6 @@ extra_rdoc_files:
21
21
  - doc/index.rdoc
22
22
  - CHANGES
23
23
  - doc/GoogleExample.rdoc
24
- - doc/examples/rspec_examples_spec.rdoc
25
- - doc/examples/test_unit_examples_test.rdoc
26
24
  - doc/releases/flexmock-0.4.0.rdoc
27
25
  - doc/releases/flexmock-0.4.1.rdoc
28
26
  - doc/releases/flexmock-0.4.2.rdoc
@@ -49,6 +47,8 @@ extra_rdoc_files:
49
47
  - doc/releases/flexmock-1.2.0.rdoc
50
48
  - doc/releases/flexmock-1.3.0.rdoc
51
49
  - doc/releases/flexmock-1.3.1.rdoc
50
+ - doc/examples/rspec_examples_spec.rdoc
51
+ - doc/examples/test_unit_examples_test.rdoc
52
52
  files:
53
53
  - CHANGES
54
54
  - Gemfile
@@ -119,14 +119,13 @@ files:
119
119
  - test/test_class_extensions.rb
120
120
  - test/test_setup.rb
121
121
  - test/test_unit_integration/auto_test_unit_test.rb
122
+ - test/test_unit_integration/minitest_teardown_test.rb
122
123
  - test/tu_integration_test.rb
123
124
  - test/undefined_test.rb
124
125
  - flexmock.blurb
125
126
  - install.rb
126
127
  - doc/index.rdoc
127
128
  - doc/GoogleExample.rdoc
128
- - doc/examples/rspec_examples_spec.rdoc
129
- - doc/examples/test_unit_examples_test.rdoc
130
129
  - doc/releases/flexmock-0.4.0.rdoc
131
130
  - doc/releases/flexmock-0.4.1.rdoc
132
131
  - doc/releases/flexmock-0.4.2.rdoc
@@ -153,6 +152,8 @@ files:
153
152
  - doc/releases/flexmock-1.2.0.rdoc
154
153
  - doc/releases/flexmock-1.3.0.rdoc
155
154
  - doc/releases/flexmock-1.3.1.rdoc
155
+ - doc/examples/rspec_examples_spec.rdoc
156
+ - doc/examples/test_unit_examples_test.rdoc
156
157
  homepage: https://github.com/jimweirich/flexmock
157
158
  licenses: []
158
159
  post_install_message:
@@ -170,6 +171,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
171
  - - ! '>='
171
172
  - !ruby/object:Gem::Version
172
173
  version: '0'
174
+ segments:
175
+ - 0
176
+ hash: 1970361257981767370
173
177
  required_rubygems_version: !ruby/object:Gem::Requirement
174
178
  none: false
175
179
  requirements: