rspec-given 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2010 Jim Weirich
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
data/README.md CHANGED
@@ -165,3 +165,10 @@ used in contexts that define that accessor.
165
165
 
166
166
  NOTE: Invariants are not yet implemented in the current version of
167
167
  rspec-given.
168
+
169
+ # Links
170
+
171
+ * Github: [https://github.com/jimweirich/rspec-given](https://github.com/jimweirich/rspec-given)
172
+ * Clone URL: git://github.com/jimweirich/rspec-given.git
173
+ * Bug/Issue Reporting: [http://onestepback.org/cgi-bin/bugs.cgi?project=rspec-given](http://onestepback.org/cgi-bin/bugs.cgi?project=rspec-given)
174
+
data/Rakefile CHANGED
@@ -36,3 +36,30 @@ task "html/README.html" => ['html', 'README.md'] do
36
36
  end
37
37
  end
38
38
  end
39
+
40
+ # RDoc ---------------------------------------------------------------
41
+ require 'rake/rdoctask'
42
+
43
+ begin
44
+ require 'darkfish-rdoc'
45
+ DARKFISH_ENABLED = true
46
+ rescue LoadError => ex
47
+ DARKFISH_ENABLED = false
48
+ end
49
+
50
+ BASE_RDOC_OPTIONS = [
51
+ '--line-numbers', '--inline-source',
52
+ '--main' , 'README.rdoc',
53
+ '--title', 'RSpec::Given - Given/When/Then Extensions for RSpec'
54
+ ]
55
+
56
+ rd = Rake::RDocTask.new("rdoc") do |rdoc|
57
+ rdoc.rdoc_dir = 'html'
58
+ # rdoc.template = 'doc/jamis.rb'
59
+ rdoc.title = "Rake -- Ruby Make"
60
+ rdoc.options = BASE_RDOC_OPTIONS.dup
61
+ rdoc.options << '-SHN' << '-f' << 'darkfish' if DARKFISH_ENABLED
62
+
63
+ rdoc.rdoc_files.include('README.md', 'MIT-LICENSE')
64
+ rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
65
+ end
data/lib/rspec/given.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  require 'rspec/given/version'
2
2
  require 'rspec/given/extensions'
3
+ require 'rspec/given/configure'
3
4
 
@@ -0,0 +1,7 @@
1
+ require 'rspec/given/extensions'
2
+
3
+ RSpec.configure do |c|
4
+ c.alias_example_to :Then
5
+ c.extend(RSpec::Given::Extensions)
6
+ end
7
+
@@ -1,36 +1,46 @@
1
- require 'rspec/core/let'
2
-
3
1
  module RSpec
4
- module Core
5
- class ExampleGroup
6
- alias_example_to :Then
7
- end
8
- end
9
- end
2
+ module Given
3
+ module Extensions
10
4
 
11
- module RSpec
12
- module Core
13
- module Let
14
- module ClassMethods
15
-
16
- def Given(*args,&block)
17
- if args.first.is_a?(Symbol)
18
- let(args.first, &block)
19
- else
20
- before(&block)
21
- end
5
+ # Declare a "given" of the current specification. If the given
6
+ # is named, the block will be lazily evaluated the first time
7
+ # the given is mentioned by name in the specification. If the
8
+ # given is unnamed, the block is evaluated for side effects
9
+ # every time the specification is executed.
10
+ #
11
+ # :call-seq:
12
+ # Given(:name, &block)
13
+ # Given(&block)
14
+ #
15
+ def Given(*args,&block)
16
+ if args.first.is_a?(Symbol)
17
+ let(args.first, &block)
18
+ else
19
+ before(&block)
22
20
  end
21
+ end
23
22
 
24
- def Given!(var, &block)
25
- let!(var, &block)
26
- end
23
+ # Declare a named given of the current specification. Similar
24
+ # to the named version of the "Given" command, except that the
25
+ # block is always evaluated.
26
+ #
27
+ # :call-seq:
28
+ # Given!(:name) { ... code ... }
29
+ def Given!(name, &block)
30
+ let!(name, &block)
31
+ end
27
32
 
28
- def When(*args, &block)
29
- if args.first.is_a?(Symbol)
30
- let!(args.first, &block)
31
- else
32
- before(&block)
33
- end
33
+ # Declare the code that is under test.
34
+ #
35
+ # :call-seq:
36
+ # When(:named_result, &block)
37
+ # When(&block)
38
+ #
39
+ def When(*args, &block)
40
+ if args.first.is_a?(Symbol)
41
+ let!(args.first, &block)
42
+ else
43
+ before(&block)
34
44
  end
35
45
  end
36
46
  end
@@ -1,7 +1,7 @@
1
1
  module RSpec
2
2
  module Given
3
3
  VERSION_MAJOR = 1
4
- VERSION_MINOR = 1
4
+ VERSION_MINOR = 2
5
5
  VERSION_BUILD = 0
6
6
  VERSION_NUMBERS = [VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD]
7
7
  VERSION = VERSION_NUMBERS.join(".")
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 1.1.0
9
+ version: 1.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jim Weirich
@@ -14,14 +14,13 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-27 00:00:00 -05:00
17
+ date: 2010-11-28 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
24
  requirements:
26
25
  - - ~>
27
26
  - !ruby/object:Gem::Version
@@ -35,7 +34,6 @@ dependencies:
35
34
  name: bluecloth
36
35
  prerelease: false
37
36
  requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
37
  requirements:
40
38
  - - ">="
41
39
  - !ruby/object:Gem::Version
@@ -56,8 +54,10 @@ extensions: []
56
54
  extra_rdoc_files: []
57
55
 
58
56
  files:
57
+ - MIT-LICENSE
59
58
  - Rakefile
60
59
  - README.md
60
+ - lib/rspec/given/configure.rb
61
61
  - lib/rspec/given/extensions.rb
62
62
  - lib/rspec/given/version.rb
63
63
  - lib/rspec/given.rb
@@ -79,7 +79,6 @@ rdoc_options:
79
79
  require_paths:
80
80
  - lib
81
81
  required_ruby_version: !ruby/object:Gem::Requirement
82
- none: false
83
82
  requirements:
84
83
  - - ">="
85
84
  - !ruby/object:Gem::Version
@@ -87,7 +86,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
86
  - 0
88
87
  version: "0"
89
88
  required_rubygems_version: !ruby/object:Gem::Requirement
90
- none: false
91
89
  requirements:
92
90
  - - ">="
93
91
  - !ruby/object:Gem::Version
@@ -97,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
95
  requirements: []
98
96
 
99
97
  rubyforge_project: given
100
- rubygems_version: 1.3.7
98
+ rubygems_version: 1.3.6
101
99
  signing_key:
102
100
  specification_version: 3
103
101
  summary: Given/When/Then Specification Extensions for RSpec.