mspec 1.5.21 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb7091a131017258473190549823fa8239557f71
4
- data.tar.gz: 4a4d9b0877a059409eca4427e03bca0dbfc3def2
3
+ metadata.gz: dea78f04d5f7dd8d900b3a9de1462448b14a71db
4
+ data.tar.gz: a978b407496a528fbaf345bdf3188c52be68a8ad
5
5
  SHA512:
6
- metadata.gz: 2c4f7467fd468001a2e09990bfadb1e6a1b1ab0a10e74b937af980ea81c6ef8b6821a46515e18d5f680819bb9c07b9bb00b25dfc39a6a31fc8b80492aa48f491
7
- data.tar.gz: 60e2c53be8e1d584fa9f4bc26e880196c3239d79fd4031de3fea7e5e248ce37e99af497116d493d98ce3366b8b8bfa416673e700921cd28f187d29ac1019d850
6
+ metadata.gz: 1fd3e10ba43ac914f0191b93cd687c8d5bd299194f7a0b6c95d4dff4f52542a38e362c67ba5d13d74ec9a4c0842bbcff58d69be995404c7da79f0396166f66d3
7
+ data.tar.gz: 457f6c7dda4d73809de319c0c13a3d0047801f5f8e9927a7a681612cc290f27979e3d218ebb0166de34fe70caf013b2dc68fb69d97b559837d22da772d443da9
@@ -7,14 +7,12 @@ rvm:
7
7
  - 1.8.7
8
8
  - 1.9.3
9
9
  - 2.0.0
10
+ - 2.1.0
10
11
  - ruby-head
11
- - rbx-18mode
12
- - rbx-19mode
13
- - jruby-18mode
14
- - jruby-19mode
12
+ - rbx-2
13
+ - jruby-head
15
14
  allow_failures:
16
- - rvm: jruby-18mode
17
- - rvm: jruby-19mode
15
+ - rvm: jruby-head
18
16
  notifications:
19
17
  recipients:
20
18
  - brixen@gmail.com
data/README CHANGED
@@ -34,7 +34,7 @@ specs in a manner compatible with multiple Ruby implementations.
34
34
 
35
35
  2. Bundler
36
36
 
37
- A Gemfile is provides. Use Bundler to install gem dependencies. To install
37
+ A Gemfile is provided. Use Bundler to install gem dependencies. To install
38
38
  Bundler, run the following:
39
39
 
40
40
  $ gem install bundler
@@ -25,4 +25,27 @@ class Object
25
25
  DateTime.new value[:year], value[:month], value[:day], value[:hour],
26
26
  value[:minute], value[:second], value[:offset], value[:sg]
27
27
  end
28
+
29
+ def with_timezone(name, offset = nil, daylight_saving_zone = "")
30
+ zone = name.dup
31
+
32
+ if offset
33
+ # TZ convention is backwards
34
+ offset = -offset
35
+
36
+ zone += offset.to_s
37
+ zone += ":00:00"
38
+ end
39
+ zone += daylight_saving_zone
40
+
41
+ old = ENV["TZ"]
42
+ ENV["TZ"] = zone
43
+
44
+ begin
45
+ yield
46
+ ensure
47
+ ENV["TZ"] = old
48
+ end
49
+ end
50
+
28
51
  end
@@ -1,6 +1,7 @@
1
1
  require 'mspec/mocks'
2
2
  require 'mspec/runner/mspec'
3
3
  require 'mspec/runner/context'
4
+ require 'mspec/runner/evaluate'
4
5
  require 'mspec/runner/example'
5
6
  require 'mspec/runner/exception'
6
7
  require 'mspec/runner/object'
@@ -0,0 +1,54 @@
1
+ class SpecEvaluate
2
+ def self.desc=(desc)
3
+ @desc = desc
4
+ end
5
+
6
+ def self.desc
7
+ @desc ||= "evaluates "
8
+ end
9
+
10
+ def initialize(ruby, desc)
11
+ @ruby = ruby
12
+ @desc = desc || self.class.desc
13
+ end
14
+
15
+ # Formats the Ruby source code for reabable output in the -fs formatter
16
+ # option. If the source contains no newline characters, wraps the source in
17
+ # single quotes to set if off from the rest of the description string. If
18
+ # the source does contain newline characters, sets the indent level to four
19
+ # characters.
20
+ def format(ruby, newline=true)
21
+ if /\n/ =~ ruby
22
+ lines = ruby.rstrip.each_line.to_a
23
+ if /( *)/ =~ lines.first
24
+ if $1.size > 4
25
+ dedent = $1.size - 4
26
+ ruby = lines.map { |l| l[dedent..-1] }.join
27
+ else
28
+ indent = " " * (4 - $1.size)
29
+ ruby = lines.map { |l| "#{indent}#{l}" }.join
30
+ end
31
+ end
32
+ "\n#{ruby}"
33
+ else
34
+ "'#{ruby}'"
35
+ end
36
+ end
37
+
38
+ def define(&block)
39
+ ruby = @ruby
40
+ desc = @desc
41
+ evaluator = self
42
+
43
+ specify "#{desc} #{format ruby}" do
44
+ evaluator.instance_eval(ruby)
45
+ evaluator.instance_eval(&block)
46
+ end
47
+ end
48
+ end
49
+
50
+ class Object
51
+ def evaluate(str, desc=nil, &block)
52
+ SpecEvaluate.new(str, desc).define(&block)
53
+ end
54
+ end
@@ -1,5 +1,5 @@
1
1
  require 'mspec/utils/version'
2
2
 
3
3
  module MSpec
4
- VERSION = SpecVersion.new "1.5.21"
4
+ VERSION = SpecVersion.new "1.6.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.21
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-10 00:00:00.000000000 Z
11
+ date: 2014-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -175,6 +175,7 @@ files:
175
175
  - lib/mspec/runner/actions/tally.rb
176
176
  - lib/mspec/runner/actions/timer.rb
177
177
  - lib/mspec/runner/context.rb
178
+ - lib/mspec/runner/evaluate.rb
178
179
  - lib/mspec/runner/example.rb
179
180
  - lib/mspec/runner/exception.rb
180
181
  - lib/mspec/runner/filters.rb
@@ -357,7 +358,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
357
358
  version: '0'
358
359
  requirements: []
359
360
  rubyforge_project: http://rubyforge.org/projects/mspec
360
- rubygems_version: 2.2.1
361
+ rubygems_version: 2.2.2
361
362
  signing_key:
362
363
  specification_version: 4
363
364
  summary: MSpec is a specialized framework that is syntax-compatible with RSpec for