rspec 0.7.2 → 0.7.5.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.
- data/CHANGES +72 -1
- data/EXAMPLES.rd +6 -0
- data/README +27 -6
- data/Rakefile +32 -81
- data/bin/drbspec +3 -0
- data/bin/spec +2 -3
- data/examples/file_accessor_spec.rb +1 -1
- data/examples/greeter_spec.rb +30 -0
- data/examples/helper_method_example.rb +1 -1
- data/examples/io_processor_spec.rb +1 -1
- data/examples/mocking_example.rb +1 -1
- data/examples/partial_mock_example.rb +1 -1
- data/examples/predicate_example.rb +1 -1
- data/examples/setup_teardown_example.rb +34 -0
- data/examples/spec_helper.rb +1 -0
- data/examples/stack_spec.rb +1 -1
- data/examples/stubbing_example.rb +1 -1
- data/examples/test_case_spec.rb +1 -1
- data/lib/spec/callback/callback_container.rb +60 -0
- data/lib/spec/callback/extensions/module.rb +24 -0
- data/lib/spec/callback/extensions/object.rb +33 -0
- data/lib/spec/callback.rb +3 -0
- data/lib/spec/expectations/diff.rb +10 -14
- data/lib/spec/expectations/extensions/numeric.rb +17 -3
- data/lib/spec/expectations/extensions/object.rb +145 -0
- data/lib/spec/expectations/extensions/proc.rb +57 -0
- data/lib/spec/expectations/extensions/string.rb +22 -0
- data/lib/spec/expectations/extensions.rb +2 -2
- data/lib/spec/expectations/message_builder.rb +13 -0
- data/lib/spec/expectations/should/base.rb +29 -10
- data/lib/spec/expectations/should/change.rb +69 -0
- data/lib/spec/expectations/should/have.rb +94 -37
- data/lib/spec/expectations/should/not.rb +6 -2
- data/lib/spec/expectations/should/should.rb +9 -5
- data/lib/spec/expectations/should.rb +1 -0
- data/lib/spec/expectations/sugar.rb +2 -2
- data/lib/spec/expectations.rb +28 -0
- data/lib/spec/mocks/error_generator.rb +23 -12
- data/lib/spec/mocks/message_expectation.rb +18 -15
- data/lib/spec/mocks/mock_handler.rb +10 -9
- data/lib/spec/mocks/mock_methods.rb +1 -1
- data/lib/spec/rake/spectask.rb +8 -2
- data/lib/spec/runner/backtrace_tweaker.rb +34 -25
- data/lib/spec/runner/context.rb +56 -7
- data/lib/spec/runner/context_eval.rb +33 -3
- data/lib/spec/runner/context_runner.rb +24 -11
- data/lib/spec/runner/drb_command_line.rb +21 -0
- data/lib/spec/runner/execution_context.rb +1 -0
- data/lib/spec/runner/extensions/kernel.rb +2 -0
- data/lib/spec/runner/extensions/object.rb +26 -18
- data/lib/spec/runner/formatter/base_text_formatter.rb +1 -1
- data/lib/spec/runner/formatter/html_formatter.rb +94 -74
- data/lib/spec/runner/heckle_runner.rb +55 -0
- data/lib/spec/runner/option_parser.rb +15 -3
- data/lib/spec/runner/reporter.rb +13 -8
- data/lib/spec/runner/specification.rb +67 -42
- data/lib/spec/runner.rb +1 -1
- data/lib/spec/version.rb +6 -5
- data/lib/spec.rb +1 -0
- metadata +20 -19
- data/lib/spec/expectations/extensions/inspect_for_expectation_not_met_error.rb +0 -14
- data/lib/spec/expectations/extensions/symbol.rb +0 -5
- data/vendor/selenium/README.txt +0 -23
- data/vendor/selenium/find_rspecs_home_page.rb +0 -23
- data/vendor/selenium/rspec_selenium.rb +0 -33
- data/vendor/selenium/start_browser_once.patch +0 -65
- data/vendor/watir/README.txt +0 -32
- data/vendor/watir/find_rspecs_home_page.rb +0 -21
- data/vendor/watir/find_rspecs_home_page.txt +0 -15
- data/vendor/watir/rspec_watir.rb +0 -45
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.1
|
3
3
|
specification_version: 1
|
4
4
|
name: rspec
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.7.
|
7
|
-
date:
|
8
|
-
summary: RSpec-0.7.
|
6
|
+
version: 0.7.5.1
|
7
|
+
date: 2007-01-18 00:00:00 -06:00
|
8
|
+
summary: RSpec-0.7.5.1 (r1395) - BDD for Ruby http://rspec.rubyforge.org/
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: rspec-devel@rubyforge.org
|
@@ -27,11 +27,7 @@ signing_key:
|
|
27
27
|
cert_chain:
|
28
28
|
post_install_message:
|
29
29
|
authors:
|
30
|
-
- -
|
31
|
-
- Aslak Hellesoy
|
32
|
-
- Dave Astels
|
33
|
-
- David Chelimsky
|
34
|
-
- Brian Takita
|
30
|
+
- - RSpec Development Team
|
35
31
|
files:
|
36
32
|
- CHANGES
|
37
33
|
- EXAMPLES.rd
|
@@ -39,21 +35,27 @@ files:
|
|
39
35
|
- Rakefile
|
40
36
|
- README
|
41
37
|
- lib/spec.rb
|
38
|
+
- lib/spec/callback.rb
|
42
39
|
- lib/spec/expectations.rb
|
43
40
|
- lib/spec/mocks.rb
|
44
41
|
- lib/spec/runner.rb
|
45
42
|
- lib/spec/version.rb
|
43
|
+
- lib/spec/callback/callback_container.rb
|
44
|
+
- lib/spec/callback/extensions/module.rb
|
45
|
+
- lib/spec/callback/extensions/object.rb
|
46
46
|
- lib/spec/expectations/diff.rb
|
47
47
|
- lib/spec/expectations/errors.rb
|
48
48
|
- lib/spec/expectations/extensions.rb
|
49
|
+
- lib/spec/expectations/message_builder.rb
|
49
50
|
- lib/spec/expectations/should.rb
|
50
51
|
- lib/spec/expectations/sugar.rb
|
51
52
|
- lib/spec/expectations/differs/default.rb
|
52
|
-
- lib/spec/expectations/extensions/inspect_for_expectation_not_met_error.rb
|
53
53
|
- lib/spec/expectations/extensions/numeric.rb
|
54
54
|
- lib/spec/expectations/extensions/object.rb
|
55
|
-
- lib/spec/expectations/extensions/
|
55
|
+
- lib/spec/expectations/extensions/proc.rb
|
56
|
+
- lib/spec/expectations/extensions/string.rb
|
56
57
|
- lib/spec/expectations/should/base.rb
|
58
|
+
- lib/spec/expectations/should/change.rb
|
57
59
|
- lib/spec/expectations/should/have.rb
|
58
60
|
- lib/spec/expectations/should/not.rb
|
59
61
|
- lib/spec/expectations/should/should.rb
|
@@ -73,8 +75,10 @@ files:
|
|
73
75
|
- lib/spec/runner/context.rb
|
74
76
|
- lib/spec/runner/context_eval.rb
|
75
77
|
- lib/spec/runner/context_runner.rb
|
78
|
+
- lib/spec/runner/drb_command_line.rb
|
76
79
|
- lib/spec/runner/execution_context.rb
|
77
80
|
- lib/spec/runner/formatter.rb
|
81
|
+
- lib/spec/runner/heckle_runner.rb
|
78
82
|
- lib/spec/runner/option_parser.rb
|
79
83
|
- lib/spec/runner/reporter.rb
|
80
84
|
- lib/spec/runner/spec_matcher.rb
|
@@ -91,24 +95,19 @@ files:
|
|
91
95
|
- examples/custom_formatter.rb
|
92
96
|
- examples/file_accessor.rb
|
93
97
|
- examples/file_accessor_spec.rb
|
98
|
+
- examples/greeter_spec.rb
|
94
99
|
- examples/helper_method_example.rb
|
95
100
|
- examples/io_processor.rb
|
96
101
|
- examples/io_processor_spec.rb
|
97
102
|
- examples/mocking_example.rb
|
98
103
|
- examples/partial_mock_example.rb
|
99
104
|
- examples/predicate_example.rb
|
105
|
+
- examples/setup_teardown_example.rb
|
106
|
+
- examples/spec_helper.rb
|
100
107
|
- examples/stack.rb
|
101
108
|
- examples/stack_spec.rb
|
102
109
|
- examples/stubbing_example.rb
|
103
110
|
- examples/test_case_spec.rb
|
104
|
-
- vendor/watir/find_rspecs_home_page.rb
|
105
|
-
- vendor/watir/rspec_watir.rb
|
106
|
-
- vendor/watir/find_rspecs_home_page.txt
|
107
|
-
- vendor/watir/README.txt
|
108
|
-
- vendor/selenium/find_rspecs_home_page.rb
|
109
|
-
- vendor/selenium/rspec_selenium.rb
|
110
|
-
- vendor/selenium/start_browser_once.patch
|
111
|
-
- vendor/selenium/README.txt
|
112
111
|
test_files: []
|
113
112
|
|
114
113
|
rdoc_options:
|
@@ -121,8 +120,10 @@ rdoc_options:
|
|
121
120
|
extra_rdoc_files:
|
122
121
|
- README
|
123
122
|
- CHANGES
|
123
|
+
- MIT-LICENSE
|
124
124
|
executables:
|
125
125
|
- spec
|
126
|
+
- drbspec
|
126
127
|
extensions: []
|
127
128
|
|
128
129
|
requirements: []
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class Object
|
2
|
-
def inspect_for_expectation_not_met_error
|
3
|
-
return "#{inspect}" if inspect.include? "<"
|
4
|
-
return "<#{inspect}>" unless inspect.include? "<"
|
5
|
-
end
|
6
|
-
end
|
7
|
-
class TrueClass; def inspect_for_expectation_not_met_error; "true" end end
|
8
|
-
class FalseClass; def inspect_for_expectation_not_met_error; "false" end end
|
9
|
-
class NilClass; def inspect_for_expectation_not_met_error; "nil" end end
|
10
|
-
class Class; def inspect_for_expectation_not_met_error; "<#{name}>" end end
|
11
|
-
class Proc; def inspect_for_expectation_not_met_error; "<Proc>" end end
|
12
|
-
class Array; def inspect_for_expectation_not_met_error; inspect end end
|
13
|
-
class String; def inspect_for_expectation_not_met_error; inspect end end
|
14
|
-
class Numeric; def inspect_for_expectation_not_met_error; inspect end end
|
data/vendor/selenium/README.txt
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
= Using Selenium with RSpec =
|
2
|
-
(Also see ../watir/README.txt)
|
3
|
-
|
4
|
-
The files in this directory are examples illustrating how to use Selenium
|
5
|
-
from RSpec. In addition to Ruby and RSpec you need:
|
6
|
-
|
7
|
-
* Install Java 1.4 or later
|
8
|
-
* Download SeleniumRC 0.8.1 or later (http://www.openqa.org/selenium-rc/)
|
9
|
-
* Copy selenium-server.jar into this directory.
|
10
|
-
* Copy selenium.rb into this directory.
|
11
|
-
|
12
|
-
After this is installed, open two shells.
|
13
|
-
|
14
|
-
In the first one, run:
|
15
|
-
|
16
|
-
java -jar selenium-server.jar
|
17
|
-
|
18
|
-
In the second one, run:
|
19
|
-
|
20
|
-
ruby find_rspecs_home_page.rb --format specdoc
|
21
|
-
|
22
|
-
NOTE
|
23
|
-
If you want to optimize speed (by sacrificing spec independence) you may apply the patch start_browser_once.patch
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/rspec_selenium'
|
2
|
-
|
3
|
-
context "Google's search page" do
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@browser = Selenium::SeleneseInterpreter.new("localhost", 4444, "*firefox", "http://www.google.no", 10000)
|
7
|
-
@browser.start
|
8
|
-
@browser.open('http://www.google.no')
|
9
|
-
end
|
10
|
-
|
11
|
-
specify "should find rspec's home page when I search for rspec" do
|
12
|
-
@browser.type "name=q", "rspec"
|
13
|
-
@browser.click_and_wait "name=btnG"
|
14
|
-
@browser.is_text_present("rspec.rubyforge.org").should_be(true)
|
15
|
-
end
|
16
|
-
|
17
|
-
specify "should not find Ali G when I search for rspec" do
|
18
|
-
@browser.type "name=q", "rspec"
|
19
|
-
@browser.click_and_wait "name=btnG"
|
20
|
-
@browser.is_text_present("Ali G").should_be(false)
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'spec'
|
3
|
-
require File.dirname(__FILE__) + '/selenium'
|
4
|
-
|
5
|
-
class RSpecSelenium
|
6
|
-
def teardown
|
7
|
-
@browser.stop
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
module Spec
|
12
|
-
module Runner
|
13
|
-
class Context
|
14
|
-
def before_context_eval
|
15
|
-
inherit RSpecSelenium
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
module Selenium
|
22
|
-
class SeleneseInterpreter
|
23
|
-
def click_and_wait(locator, timeout="5000")
|
24
|
-
click(locator)
|
25
|
-
wait_for_page_to_load timeout
|
26
|
-
end
|
27
|
-
|
28
|
-
def open_and_wait(url, timeout="5000")
|
29
|
-
open(url)
|
30
|
-
wait_for_page_to_load timeout
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
Index: find_rspecs_home_page.rb
|
2
|
-
===================================================================
|
3
|
-
--- find_rspecs_home_page.rb (revision 767)
|
4
|
-
+++ find_rspecs_home_page.rb (working copy)
|
5
|
-
@@ -2,22 +2,18 @@
|
6
|
-
|
7
|
-
context "Google's search page" do
|
8
|
-
|
9
|
-
- setup do
|
10
|
-
- @browser = Selenium::SeleneseInterpreter.new("localhost", 4444, "*firefox", "http://www.google.no", 10000)
|
11
|
-
- @browser.start
|
12
|
-
- @browser.open('http://www.google.no')
|
13
|
-
- end
|
14
|
-
-
|
15
|
-
specify "should find rspec's home page when I search for rspec" do
|
16
|
-
- @browser.type "name=q", "rspec"
|
17
|
-
- @browser.click_and_wait "name=btnG"
|
18
|
-
- @browser.is_text_present("rspec.rubyforge.org").should_be(true)
|
19
|
-
+ browser.open('http://www.google.no')
|
20
|
-
+ browser.type "name=q", "rspec"
|
21
|
-
+ browser.click_and_wait "name=btnG"
|
22
|
-
+ browser.is_text_present("rspec.rubyforge.org").should_be(true)
|
23
|
-
end
|
24
|
-
|
25
|
-
specify "should not find Ali G when I search for rspec" do
|
26
|
-
- @browser.type "name=q", "rspec"
|
27
|
-
- @browser.click_and_wait "name=btnG"
|
28
|
-
- @browser.is_text_present("Ali G").should_be(false)
|
29
|
-
+ browser.open('http://www.google.no')
|
30
|
-
+ browser.type "name=q", "rspec"
|
31
|
-
+ browser.click_and_wait "name=btnG"
|
32
|
-
+ browser.is_text_present("Ali G").should_be(false)
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
Index: rspec_selenium.rb
|
38
|
-
===================================================================
|
39
|
-
--- rspec_selenium.rb (revision 767)
|
40
|
-
+++ rspec_selenium.rb (working copy)
|
41
|
-
@@ -3,10 +3,22 @@
|
42
|
-
require File.dirname(__FILE__) + '/selenium'
|
43
|
-
|
44
|
-
class RSpecSelenium
|
45
|
-
- def teardown
|
46
|
-
- @browser.stop
|
47
|
-
+ def setup
|
48
|
-
+ unless defined?@@browser
|
49
|
-
+ @@browser = Selenium::SeleneseInterpreter.new("localhost", 4444, "*firefox", "http://www.google.no", 10000)
|
50
|
-
+ @@browser.start
|
51
|
-
+ end
|
52
|
-
end
|
53
|
-
+
|
54
|
-
+ def browser
|
55
|
-
+ @@browser
|
56
|
-
+ end
|
57
|
-
+
|
58
|
-
+ def self.shutdown
|
59
|
-
+ @@browser.stop
|
60
|
-
+ end
|
61
|
-
end
|
62
|
-
+at_exit{RSpecSelenium.shutdown}
|
63
|
-
|
64
|
-
module Spec
|
65
|
-
module Runner
|
data/vendor/watir/README.txt
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
= Using Watir with RSpec =
|
2
|
-
|
3
|
-
Watir provides a Ruby API to talk to a browser (Internet Explorer).
|
4
|
-
Many people use Watir to *test* web applications, but it is also excellent
|
5
|
-
for *specifying* the *intended behaviour* of a web application. Even
|
6
|
-
for web applications that don't yet exist!
|
7
|
-
|
8
|
-
Customers, QA people, testers and programmers can translate user story
|
9
|
-
acceptance criteria to executable specs based on RSpec and Watir. Take
|
10
|
-
a look at find_rspecs_home_page.txt (the story) and find_rspecs_home_page.rb
|
11
|
-
(the associated spec).
|
12
|
-
|
13
|
-
One of the great benefits of using Watir with RSpec as opposed to using
|
14
|
-
Watir 'alone' or Watir with Test::Unit is RSpec's specdoc feature, which
|
15
|
-
is a great way to see what behaviour is actually implemented and in a working
|
16
|
-
condition. It also makes the behaviour of your webapp more transparent to
|
17
|
-
customers. They can say "The specdoc says foo, but I meant bar. We need to talk".
|
18
|
-
|
19
|
-
This directory contains a simple example to illustrate this. After you
|
20
|
-
have installed Ruby, Watir and RSpec, open a shell, go to this directory
|
21
|
-
and type:
|
22
|
-
|
23
|
-
ruby find_rspecs_home_page.rb --format specdoc
|
24
|
-
|
25
|
-
Or better:
|
26
|
-
|
27
|
-
ruby find_rspecs_home_page.rb --format html > find_rspecs_home_page.html
|
28
|
-
|
29
|
-
And upload find_rspecs_home_page.html to your project's web page or intranet.
|
30
|
-
This will give immediate visibility to the intended behaviour of your web app,
|
31
|
-
as well as whether it's working as expected or not.
|
32
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/rspec_watir'
|
2
|
-
|
3
|
-
context "Google's search page" do
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@browser.goto('http://www.google.com')
|
7
|
-
end
|
8
|
-
|
9
|
-
specify "should find rspec's home page when I search for rspec" do
|
10
|
-
@browser.text_field(:name, "q").set("rspec")
|
11
|
-
@browser.button(:name, "btnG").click
|
12
|
-
@browser.should_contain("rspec.rubyforge.org") # should_contain_text is RSpec sugar
|
13
|
-
end
|
14
|
-
|
15
|
-
specify "should not find Ali G when I search for rspec" do
|
16
|
-
@browser.text_field(:name, "q").set("rspec")
|
17
|
-
@browser.button(:name, "btnG").click
|
18
|
-
@browser.should_not_contain("Ali G")
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
= Find RSpec's home page =
|
2
|
-
|
3
|
-
As an agile customer
|
4
|
-
I want to easily find RSpec's home page
|
5
|
-
So that I can learn about this fantastic tool
|
6
|
-
|
7
|
-
I will know that we are done when:
|
8
|
-
|
9
|
-
Given I am on Google's search page
|
10
|
-
When I search for 'rspec'
|
11
|
-
Then http://rspec.rubyforge.org/ should be the top result
|
12
|
-
|
13
|
-
Given I am on Google's search page
|
14
|
-
When I search for 'rspec'
|
15
|
-
Then Ali G (who says respec a lot) is not among the results
|
data/vendor/watir/rspec_watir.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'spec'
|
3
|
-
require 'watir'
|
4
|
-
|
5
|
-
# Comment out to enable ActiveRecord fixtures
|
6
|
-
#require 'active_record'
|
7
|
-
#require 'active_record/fixtures'
|
8
|
-
#config = YAML::load_file(File.dirname(__FILE__) + '/database.yml')
|
9
|
-
#$fixture_path = File.dirname(__FILE__) + '/fixtures'
|
10
|
-
#ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
11
|
-
#ActiveRecord::Base.establish_connection(config['db'])
|
12
|
-
|
13
|
-
class RSpecWatir
|
14
|
-
def setup
|
15
|
-
#Fixtures.create_fixtures($fixture_path, @@fixtures)
|
16
|
-
@browser = Watir::IE.new
|
17
|
-
end
|
18
|
-
|
19
|
-
def teardown
|
20
|
-
@browser.close
|
21
|
-
end
|
22
|
-
|
23
|
-
#def self.fixtures(*testdata)
|
24
|
-
# @@fixtures = testdata
|
25
|
-
#end
|
26
|
-
end
|
27
|
-
|
28
|
-
module Spec
|
29
|
-
module Runner
|
30
|
-
class Context
|
31
|
-
def before_context_eval
|
32
|
-
inherit RSpecWatir
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# Extensions to Watir to make it play nicer with RSpec
|
39
|
-
module Watir
|
40
|
-
class IE
|
41
|
-
# @browser.should_contain("bla bla")
|
42
|
-
# @browser.should_not_contain("bla bla")
|
43
|
-
alias_method :contain?, :contains_text
|
44
|
-
end
|
45
|
-
end
|