test-unit-context 0.3.0 → 0.3.1

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.
@@ -74,7 +74,7 @@ module Test::Unit::Context
74
74
  if nested
75
75
  contexts = @_context_definitions.dup
76
76
  @_context_definitions.each do |context|
77
- contexts.push *context.context_definitions(nested)
77
+ contexts.concat context.context_definitions(nested)
78
78
  end
79
79
  contexts
80
80
  else
@@ -3,13 +3,15 @@ require 'time'
3
3
  module Test::Unit::Context
4
4
  module Helpers
5
5
 
6
+ CONST_NAME_SUB_ = /[\s:\-'",\.~;!?#=\(\)&]+/ # :nodoc:
7
+
6
8
  module_function
7
9
 
8
10
  def to_const_name(str, prefix = nil, suffix = nil)
9
11
  name = str.dup
10
12
  name.lstrip! if prefix
11
13
  name.rstrip! if suffix
12
- name.gsub!(/[\s:',\.~;!#=\(\)&]+/, '_')
14
+ name.gsub!(CONST_NAME_SUB_, '_')
13
15
  name.gsub!(/\/(.?)/) { $1.upcase }
14
16
  name.gsub!(/(?:^|_)(.)/) { $1.upcase }
15
17
  "#{prefix}#{name}#{suffix}"
@@ -1,7 +1,7 @@
1
1
  module Test
2
2
  module Unit
3
3
  module Context
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
6
6
  end
7
7
  end
@@ -16,6 +16,14 @@ module Test::Unit
16
16
  assert self.class.respond_to? :contexts
17
17
  end
18
18
 
19
+ def test_context_naming
20
+ Class.new(Test::Unit::TestCase) do
21
+ context("kiss = simple_name") {}
22
+ context("a_(not-so)_simple; name") {}
23
+ context("an '&\" name !?") {}
24
+ end
25
+ end
26
+
19
27
  class Default < Test::Unit::TestCase
20
28
  CONTEXT = context "When testing" do
21
29
  def test_this_thing
metadata CHANGED
@@ -1,105 +1,101 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: test-unit-context
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
4
5
  prerelease:
5
- version: 0.3.0
6
6
  platform: ruby
7
- authors:
8
- - kares
7
+ authors:
8
+ - kares
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2013-02-11 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: test-unit
17
- version_requirements: &id001 !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 2.4.0
23
- requirement: *id001
24
- prerelease: false
25
- type: :runtime
26
- - !ruby/object:Gem::Dependency
27
- name: rake
28
- version_requirements: &id002 !ruby/object:Gem::Requirement
29
- none: false
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- requirement: *id002
35
- prerelease: false
36
- type: :development
37
- description: |-
38
- Makes Test::Unit::TestCases 'contextable' and thus much
39
- easier to read and write. If you've seen RSpec than it's the very same 'context
40
- do ... end' re-invendet for Test::Unit. Inspired by gem 'context' that does the
41
- same for the 'old' Test::Unit 1.2.3 bundled with Ruby 1.8.x standard libraries.
42
- email:
43
- - self@kares.org
12
+ date: 2013-04-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: test-unit
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.4.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.4.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: ! "Makes Test::Unit::TestCases 'contextable' and thus much\neasier to
47
+ read and write. If you've seen RSpec than it's the very same 'context \ndo ... end'
48
+ re-invendet for Test::Unit. Inspired by gem 'context' that does the\nsame for the
49
+ 'old' Test::Unit 1.2.3 bundled with Ruby 1.8.x standard libraries."
50
+ email:
51
+ - self@kares.org
44
52
  executables: []
45
-
46
53
  extensions: []
47
-
48
- extra_rdoc_files:
49
- - README.md
50
- - LICENSE
51
- files:
52
- - .gitignore
53
- - .travis.yml
54
- - Gemfile
55
- - LICENSE
56
- - README.md
57
- - Rakefile
58
- - lib/test/unit/context.rb
59
- - lib/test/unit/context/context.rb
60
- - lib/test/unit/context/helpers.rb
61
- - lib/test/unit/context/shared.rb
62
- - lib/test/unit/context/spec.rb
63
- - lib/test/unit/context/version.rb
64
- - test-unit-context.gemspec
65
- - test/test/unit/context/hooks_test.rb
66
- - test/test/unit/context/shared_test.rb
67
- - test/test/unit/context/spec_spec.rb
68
- - test/test/unit/context/spec_test.rb
69
- - test/test/unit/context_test.rb
70
- - test/test_helper.rb
54
+ extra_rdoc_files:
55
+ - README.md
56
+ - LICENSE
57
+ files:
58
+ - .gitignore
59
+ - .travis.yml
60
+ - Gemfile
61
+ - LICENSE
62
+ - README.md
63
+ - Rakefile
64
+ - lib/test/unit/context.rb
65
+ - lib/test/unit/context/context.rb
66
+ - lib/test/unit/context/helpers.rb
67
+ - lib/test/unit/context/shared.rb
68
+ - lib/test/unit/context/spec.rb
69
+ - lib/test/unit/context/version.rb
70
+ - test-unit-context.gemspec
71
+ - test/test/unit/context/hooks_test.rb
72
+ - test/test/unit/context/shared_test.rb
73
+ - test/test/unit/context/spec_spec.rb
74
+ - test/test/unit/context/spec_test.rb
75
+ - test/test/unit/context_test.rb
76
+ - test/test_helper.rb
71
77
  homepage: http://github.com/kares/test-unit-context
72
78
  licenses: []
73
-
74
79
  post_install_message:
75
80
  rdoc_options: []
76
-
77
- require_paths:
78
- - lib
79
- required_ruby_version: !ruby/object:Gem::Requirement
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
80
84
  none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 2
85
- segments:
86
- - 0
87
- version: "0"
88
- required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 2
94
- segments:
95
- - 0
96
- version: "0"
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
97
95
  requirements: []
98
-
99
96
  rubyforge_project:
100
- rubygems_version: 1.8.24
97
+ rubygems_version: 1.8.23
101
98
  signing_key:
102
99
  specification_version: 3
103
100
  summary: Context for Test::Unit (2.x)
104
101
  test_files: []
105
-