minitest-context 0.2.0 → 0.3.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
@@ -6,3 +6,8 @@ rvm:
6
6
  - jruby
7
7
  - ruby-head
8
8
  - ree
9
+
10
+ notifications:
11
+ irc: "irc.freenode.org#flowof.info"
12
+ recipients:
13
+ - rob@flowof.info
data/README.md CHANGED
@@ -10,10 +10,10 @@ __OVERVIEW__
10
10
 
11
11
  __DESCRIPTION__
12
12
 
13
- minitest/context can define contexts for code reuse in MiniTest specs that share common expectations.
13
+ minitest-context can define contexts for code reuse in minitest specs that share common expectations.
14
14
  The idea orginated from the `shared_context()` and `include_context()` methods distributed with RSpec.
15
15
 
16
- MiniTest supports code re-use in MiniTest specs already, via a subclass of MiniTest::Spec.
16
+ minitest supports code re-use in minitest specs already, via a subclass of MiniTest::Spec.
17
17
  You might want to look at that option, if you didn't know about it already.
18
18
 
19
19
  __EXAMPLES__
@@ -28,8 +28,8 @@ __EXAMPLES__
28
28
  inherit_context :operand
29
29
 
30
30
  it "should perform addition on the operand." do
31
- @operand = @operand + 10
32
- @operand.must_equal(50)
31
+ result = @operand + 10
32
+ result.must_equal(50)
33
33
  end
34
34
  end
35
35
 
@@ -37,8 +37,8 @@ __EXAMPLES__
37
37
  inherit_context :operand
38
38
 
39
39
  it "should perform subtraction on the operand." do
40
- @operand = @operand - 10
41
- @operand.must_equal(30)
40
+ result = @operand - 10
41
+ result.must_equal(30)
42
42
  end
43
43
  end
44
44
 
data/Rakefile CHANGED
@@ -1,17 +1,9 @@
1
- $LOAD_PATH.unshift *%w(./lib ./spec)
2
- require 'minitest/context/version'
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
3
 
4
- desc "Run tests."
5
- task :test do
6
- Dir["./spec/*_spec.rb"].each { |f| require(f) }
7
- end
8
-
9
- namespace :gem do
10
- desc "Release a new version"
11
- task :release do
12
- `gem build minitest-context.gemspec`
13
- `gem push minitest-context-#{MiniTest::Context::VERSION}.gem`
14
- end
4
+ Rake::TestTask.new do |t|
5
+ t.name = :test
6
+ t.test_files = FileList["test/*.rb"]
15
7
  end
16
8
 
17
9
  task :default => :test
@@ -9,30 +9,28 @@ module MiniTest::Context
9
9
  # @private
10
10
  attr_reader :list
11
11
 
12
- # Define a context for re-use in a subclass of MiniTest::Spec.
13
12
  #
14
- # @example
15
- #
13
+ # Defines a context.
14
+ #
15
+ # @example
16
16
  # MiniTest::Context.define(:example) do
17
- # before do
18
- # puts "Hello, world!"
19
- # end
17
+ # before { puts "Hello, world!" }
20
18
  # end
21
19
  #
22
20
  # @param [Symbol] name
23
21
  # The name of the context to define.
24
22
  #
25
- # @param [Proc] block
26
- # A Proc object that is evaluated in a subclass of MiniTest::Spec
27
- # through {MiniTest::Spec.inherit_context inherit_context}.
23
+ # @param [Proc] block
24
+ # Evaluated in a subclass of MiniTest::Spec through {MiniTest::Spec.inherit_context}.
28
25
  #
29
26
  # @raise [ArgumentError]
30
- # Raises an ArgumentError if _block_ is not supplied as an argument.
27
+ # Raises an ArgumentError if block is missing.
31
28
  #
32
29
  # @return [void]
30
+ #
33
31
  def define name, &block
34
32
  raise ArgumentError, "Block expected." unless block_given?
35
- @list ||= Hash.new { |h,k| h[k] = [] }
33
+ @list = @list || Hash.new { |h,k| h[k] = [] }
36
34
  @list[name] << block
37
35
  end
38
36
 
@@ -1,5 +1,5 @@
1
1
  module MiniTest
2
2
  module Context
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -2,21 +2,22 @@ class MiniTest::Spec
2
2
 
3
3
  class << self
4
4
 
5
- # Evaluates a context by _name_ in the scope of a MiniTest::Spec subclass.
6
5
  #
7
- # @example
8
- #
6
+ # Evaluates a context by name.
7
+ #
8
+ # @example
9
9
  # describe ExampleClass do
10
10
  # inherit_context :example
11
11
  # end
12
12
  #
13
13
  # @param [Symbol] name
14
- # The name of a context which has been defined by {MiniTest::Context.define define}.
14
+ # The name of a context defined by {MiniTest::Context.define define}.
15
15
  #
16
16
  # @raise [ArgumentError]
17
- # Raises an ArgumentError if a context by _name_ does not exist.
17
+ # Raises an ArgumentError if a context by name does not exist.
18
18
  #
19
19
  # @return [void]
20
+ #
20
21
  def inherit_context name
21
22
  if MiniTest::Context.list.has_key?(name)
22
23
  MiniTest::Context.list[name].each do |context|
File without changes
File without changes
@@ -1,10 +1,10 @@
1
- require 'spec_helper'
1
+ require File.expand_path("setup.rb", File.dirname(__FILE__))
2
2
 
3
3
  describe "Contexts" do
4
- describe "an inherited context." do
4
+ describe "An inherited context." do
5
5
  inherit_context :before_block
6
6
 
7
- it "should execute a before block and assign an Array to @example." do
7
+ it "must assign an Array to @example." do
8
8
  @example.must_be_instance_of(Array)
9
9
  end
10
10
  end
@@ -13,13 +13,13 @@ describe "Contexts" do
13
13
  inherit_context :before_block
14
14
 
15
15
  describe "Suite 1" do
16
- it "should inherit context from the parent suite." do
16
+ it "must the inherit context from the parent suite." do
17
17
  @example.must_be_instance_of(Array)
18
18
  end
19
19
  end
20
20
 
21
21
  describe "Suite 2" do
22
- it "should inherit context from the parent suite." do
22
+ it "must the inherit context from the parent suite." do
23
23
  @example.must_be_instance_of(Array)
24
24
  end
25
25
  end
@@ -28,20 +28,20 @@ describe "Contexts" do
28
28
  describe "A stacked context." do
29
29
  inherit_context :stacked_context
30
30
 
31
- it "should execute all stacked contexts." do
31
+ it "must execute all stacked contexts." do
32
32
  @number.must_equal(2)
33
33
  end
34
34
  end
35
35
  end
36
36
 
37
37
  describe "MiniTest::Context.define" do
38
- it "should raise an ArgumentError when no block is recieved." do
38
+ it "must raise an ArgumentError when no block is recieved." do
39
39
  proc { MiniTest::Context.define(:fail) }.must_raise(ArgumentError)
40
40
  end
41
41
  end
42
42
 
43
43
  describe "MiniTest::Spec.inherit_context" do
44
- it "should raise an ArgumentError when no context by given name can be found." do
44
+ it "must raise an ArgumentError when no context by given name can be found." do
45
45
  proc { MiniTest::Spec.inherit_context(:fail) }.must_raise(ArgumentError)
46
46
  end
47
47
  end
@@ -3,4 +3,4 @@ require 'minitest/spec'
3
3
  require 'minitest/context'
4
4
  require 'minitest/autorun'
5
5
 
6
- Dir["./spec/contexts/*.rb"].each { |f| require(f) }
6
+ Dir["./test/contexts/*.rb"].each { |f| require(f) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-context
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-19 00:00:00.000000000Z
12
+ date: 2011-10-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
16
- requirement: &70126913223860 !ruby/object:Gem::Requirement
16
+ requirement: &70313064995720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.5'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70126913223860
24
+ version_requirements: *70313064995720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70126913222860 !ruby/object:Gem::Requirement
27
+ requirement: &70313064994960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 0.9.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70126913222860
35
+ version_requirements: *70313064994960
36
36
  description: Defines contexts for code reuse in MiniTest specs that share common expectations.
37
37
  email:
38
38
  - rob@flowof.info
@@ -51,10 +51,10 @@ files:
51
51
  - lib/minitest/context/version.rb
52
52
  - lib/minitest/ext/spec.rb
53
53
  - minitest-context.gemspec
54
- - spec/contexts/before_block_context.rb
55
- - spec/contexts/stacked_context.rb
56
- - spec/minitest_context_spec.rb
57
- - spec/spec_helper.rb
54
+ - test/contexts/before_block_context.rb
55
+ - test/contexts/stacked_context.rb
56
+ - test/minitest_context_test.rb
57
+ - test/setup.rb
58
58
  homepage: https://github.com/robgleeson/minitest-context
59
59
  licenses: []
60
60
  post_install_message:
@@ -69,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
69
  version: '0'
70
70
  segments:
71
71
  - 0
72
- hash: -4595800343370108559
72
+ hash: -2902589455045483768
73
73
  required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  segments:
80
80
  - 0
81
- hash: -4595800343370108559
81
+ hash: -2902589455045483768
82
82
  requirements: []
83
83
  rubyforge_project:
84
84
  rubygems_version: 1.8.10
@@ -86,7 +86,7 @@ signing_key:
86
86
  specification_version: 3
87
87
  summary: Defines contexts for code reuse in MiniTest specs that share common expectations.
88
88
  test_files:
89
- - spec/contexts/before_block_context.rb
90
- - spec/contexts/stacked_context.rb
91
- - spec/minitest_context_spec.rb
92
- - spec/spec_helper.rb
89
+ - test/contexts/before_block_context.rb
90
+ - test/contexts/stacked_context.rb
91
+ - test/minitest_context_test.rb
92
+ - test/setup.rb