[DRE-commits] [ruby-test-construct] 01/03: Imported Upstream version 2.0.1

Alexander GQ Gerasiov gq at moszumanska.debian.org
Sun Mar 15 21:39:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

gq pushed a commit to branch master
in repository ruby-test-construct.

commit 5b3eaf26039d06ef22694eacea4a787f3c53d9bc
Author: Alexander GQ Gerasiov <gq at cs.msu.su>
Date:   Mon Mar 16 00:13:39 2015 +0300

    Imported Upstream version 2.0.1
---
 CHANGELOG.md                            |  4 ++
 lib/test_construct/rspec_integration.rb | 32 +++++++++++++--
 lib/test_construct/version.rb           |  2 +-
 metadata.yml                            | 70 +++++++++++----------------------
 test/rspec_integration_test.rb          | 24 +++++++++++
 test_construct.gemspec                  |  3 +-
 6 files changed, 80 insertions(+), 55 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf29c9c..9e04985 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # TestConstruct Changelog
 
+## v2.0.1
+
+* Adds support for RSpec 3 (@jcouball)
+
 ## v2.0.0
 
 Enhancements:
diff --git a/lib/test_construct/rspec_integration.rb b/lib/test_construct/rspec_integration.rb
index 8502d5c..ba96183 100644
--- a/lib/test_construct/rspec_integration.rb
+++ b/lib/test_construct/rspec_integration.rb
@@ -36,18 +36,42 @@ RSpec.configure do |config|
   config.include TestConstruct::Helpers
   config.include TestConstruct::RSpecIntegration
 
-  config.before :each do
-    next unless test_construct_enabled?(example)
+  version = RSpec::Version::STRING
+  major, minor, patch, rest = version.split(".")
+  major, minor, patch = [major, minor, patch].map(&:to_i)
+
+  def before_each(example)
+    return unless test_construct_enabled?(example)
     options = test_construct_options(example)
     example.metadata[:construct] = setup_construct(options)
   end
 
-  config.after :each do
-    next unless test_construct_enabled?(example)
+  def after_each(example)
+    return unless test_construct_enabled?(example)
     options = test_construct_options(example)
     teardown_construct(
       example.metadata[:construct],
       example.exception,
       options)
   end
+
+  if major == 2 && minor >= 7
+    config.before :each do
+      before_each(example)
+    end
+
+    config.after :each do
+      after_each(example)
+    end
+  elsif major == 3
+    config.before :each do |example|
+      before_each(example)
+    end
+
+    config.after :each do |example|
+      after_each(example)
+    end
+  else
+    raise "TestConstruct does not support RSpec #{version}"
+  end
 end
diff --git a/lib/test_construct/version.rb b/lib/test_construct/version.rb
index 3dd8431..34983fb 100644
--- a/lib/test_construct/version.rb
+++ b/lib/test_construct/version.rb
@@ -1,3 +1,3 @@
 module TestConstruct
-  VERSION = "2.0.0"
+  VERSION = "2.0.1"
 end
diff --git a/metadata.yml b/metadata.yml
index 6147564..df279a0 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,8 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: test_construct
 version: !ruby/object:Gem::Version
-  version: 2.0.0
-  prerelease: 
+  version: 2.0.1
 platform: ruby
 authors:
 - Ben Brinckerhoff
@@ -10,104 +9,78 @@ authors:
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2013-12-30 00:00:00.000000000 Z
+date: 2015-02-25 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: bundler
   requirement: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ~>
+    - - "~>"
       - !ruby/object:Gem::Version
         version: '1.3'
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ~>
+    - - "~>"
       - !ruby/object:Gem::Version
         version: '1.3'
 - !ruby/object:Gem::Dependency
   name: rake
   requirement: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ! '>='
+    - - ">="
       - !ruby/object:Gem::Version
         version: '0'
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ! '>='
+    - - ">="
       - !ruby/object:Gem::Version
         version: '0'
 - !ruby/object:Gem::Dependency
   name: minitest
   requirement: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ~>
+    - - "~>"
       - !ruby/object:Gem::Version
         version: 5.0.8
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ~>
+    - - "~>"
       - !ruby/object:Gem::Version
         version: 5.0.8
 - !ruby/object:Gem::Dependency
   name: mocha
   requirement: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ~>
+    - - "~>"
       - !ruby/object:Gem::Version
         version: 0.14.0
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ~>
+    - - "~>"
       - !ruby/object:Gem::Version
         version: 0.14.0
 - !ruby/object:Gem::Dependency
-  name: debugger
-  requirement: !ruby/object:Gem::Requirement
-    none: false
-    requirements:
-    - - ! '>='
-      - !ruby/object:Gem::Version
-        version: '0'
-  type: :development
-  prerelease: false
-  version_requirements: !ruby/object:Gem::Requirement
-    none: false
-    requirements:
-    - - ! '>='
-      - !ruby/object:Gem::Version
-        version: '0'
-- !ruby/object:Gem::Dependency
   name: rspec
   requirement: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ! '>='
+    - - "~>"
       - !ruby/object:Gem::Version
-        version: '0'
+        version: '3.0'
   type: :development
   prerelease: false
   version_requirements: !ruby/object:Gem::Requirement
-    none: false
     requirements:
-    - - ! '>='
+    - - "~>"
       - !ruby/object:Gem::Version
-        version: '0'
+        version: '3.0'
 description: Creates temporary files and directories for testing.
 email:
 - ben at bbrinck.com
@@ -116,7 +89,7 @@ executables: []
 extensions: []
 extra_rdoc_files: []
 files:
-- .gitignore
+- ".gitignore"
 - CHANGELOG.md
 - Gemfile
 - LICENSE.txt
@@ -129,34 +102,35 @@ files:
 - lib/test_construct/pathname_extensions.rb
 - lib/test_construct/rspec_integration.rb
 - lib/test_construct/version.rb
+- test/rspec_integration_test.rb
 - test/test_construct_test.rb
 - test/test_helper.rb
 - test_construct.gemspec
 homepage: ''
 licenses:
 - MIT
+metadata: {}
 post_install_message: 
 rdoc_options: []
 require_paths:
 - lib
 required_ruby_version: !ruby/object:Gem::Requirement
-  none: false
   requirements:
-  - - ! '>='
+  - - ">="
     - !ruby/object:Gem::Version
       version: '0'
 required_rubygems_version: !ruby/object:Gem::Requirement
-  none: false
   requirements:
-  - - ! '>='
+  - - ">="
     - !ruby/object:Gem::Version
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 1.8.23
+rubygems_version: 2.2.2
 signing_key: 
-specification_version: 3
+specification_version: 4
 summary: Creates temporary files and directories for testing.
 test_files:
+- test/rspec_integration_test.rb
 - test/test_construct_test.rb
 - test/test_helper.rb
diff --git a/test/rspec_integration_test.rb b/test/rspec_integration_test.rb
new file mode 100644
index 0000000..16d4332
--- /dev/null
+++ b/test/rspec_integration_test.rb
@@ -0,0 +1,24 @@
+require 'test_helper'
+
+class RspecIntegrationTest < Minitest::Test
+  include TestConstruct::Helpers
+
+  test 'rspec integration' do
+    lib_path = File.realpath('lib')
+    within_construct do |construct|
+      spec_file_name = 'rspec_spec.rb'
+      construct.file(spec_file_name, <<-RSPEC)
+require 'test_construct/rspec_integration'
+
+describe 'test_construct', test_construct: true do
+  it 'accesses metadata' do |example|
+    f = example.metadata[:construct].file "somefile", "abcd"
+    expect(f.size).to eq 4
+  end
+end
+      RSPEC
+      output = `rspec -I '#{lib_path}' #{spec_file_name}`
+      assert $CHILD_STATUS.success?, output
+    end
+  end
+end
diff --git a/test_construct.gemspec b/test_construct.gemspec
index 57970f1..ea4a7f5 100644
--- a/test_construct.gemspec
+++ b/test_construct.gemspec
@@ -22,6 +22,5 @@ Gem::Specification.new do |spec|
   spec.add_development_dependency "rake"
   spec.add_development_dependency "minitest", "~> 5.0.8"
   spec.add_development_dependency "mocha", "~> 0.14.0"
-  spec.add_development_dependency "debugger"
-  spec.add_development_dependency "rspec"
+  spec.add_development_dependency "rspec", "~> 3.0"
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-test-construct.git



More information about the Pkg-ruby-extras-commits mailing list