Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rspec/rspec-core
base: v2.12.0
...
head fork: rspec/rspec-core
compare: v2.12.1
Checking mergeability… Don't worry, you can still create the pull request.
  • 17 commits
  • 16 files changed
  • 0 commit comments
  • 6 contributors
Commits on Nov 13, 2012
@sunaku sunaku run specs even if Kernel#exit() was called
This commit fixes a problem that I introduced in pull request #569,
where RSpec won't run any specs if someone explicitly called exit() or
if they were using both Test::Unit and RSpec together and they had
loaded RSpec before loading Test::Unit.  In particular, exit() called in
Test::Unit's at_exit handler would raise SystemExit, thereby defining
$!, whose presence inhibits RSpec's at_exit handler from running specs.
5e5603c
@alindeman alindeman Fixes link in Changelog e951103
@alindeman alindeman Changelog for #720
[Closes #720]
3e95e4e
@charliemaffitt charliemaffitt Defines shellescape method
Method allows newer versions of Ruby to use string.shellescape while not breaking in 1.8.6
f5e14f0
Commits on Nov 14, 2012
@alindeman alindeman Increases the default timeout to attempt to make rbx-19 go green on t…
…ravis-ci
4d881e8
Commits on Nov 18, 2012
@alindeman alindeman Merge pull request #728 from charliemaffitt/shellescape_backwards_com…
…patible

Defines shellescape method
6f99136
Commits on Nov 20, 2012
@TylerBrock TylerBrock fix spelling error in README.md c088283
@alindeman alindeman Merge pull request #736 from TylerBrock/patch-1
fix spelling error in README.md
547754d
Commits on Nov 23, 2012
@myronmarston myronmarston Collapse two loops into one. 9c8d6bd
@myronmarston myronmarston Just use `inject` rather than `map.inject`. 2919139
@myronmarston myronmarston Fix doc string when a method name is nested under a context string de…
…scription.

Fixes #733.
5529b39
Commits on Nov 25, 2012
@myronmarston myronmarston Add missing 1.9.3-jruby fixture files. 247bc53
@myronmarston myronmarston Changelog for 5529b39. ad3d3cd
Commits on Nov 26, 2012
@samphippen samphippen Document the order in which configuration options are loaded
Configuration options are loaded from files, this docstring clarifies
which order they are loaded in and where they are loaded from (hopefully!)

Closes #739
c765c3b
Commits on Dec 01, 2012
@myronmarston myronmarston Restore a public API I unintentionally broke in 39857f3.
@DouweM rightly pointed out that I broke this API.

39857f3#commitcomment-2236278
f06254c
@myronmarston myronmarston Words. 497de60
@myronmarston myronmarston 2.12.1 release. e227bb4
View
17 Changelog.md
@@ -1,5 +1,20 @@
+### 2.12.1 / 2012-12-01
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.12.0...v2.12.1)
+
+Bug fixes
+
+* Specs are run even if another at\_exit hook calls `exit`. This allows
+ Test::Unit and RSpec to run together. (Suraj N. Kurapati)
+* Fix full doc string concatenation so that it handles the case of a
+ method string (e.g. "#foo") being nested under a context string
+ (e.g. "when it is tuesday"), so that we get "when it is tuesday #foo"
+ rather than "when it is tuesday#foo". (Myron Marston)
+* Restore public API I unintentionally broke in 2.12.0:
+ `RSpec::Core::Formatters::BaseFormatter#format_backtrce(backtrace, example)`
+ (Myron Marston).
+
### 2.12.0 / 2012-11-12
-[full changelog](http://github.com/rspec/rspec-core/compare/v2.11.1...2.12.0)
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.11.1...v2.12.0)
Enhancements
View
2  README.md
@@ -2,7 +2,7 @@
rspec-core provides the structure for writing executable examples of how your
code should behave, and an `rspec` command with tools to constrain which
-examples get run and taylor the output.
+examples get run and tailor the output.
## install
View
5 features/command_line/exit_status.feature
@@ -65,19 +65,18 @@ Feature: exit status
Then the exit status should be 2
And the output should contain "1 example, 1 failure"
- @wip
Scenario: exit with rspec's exit code when an at_exit hook is added upstream
Given a file named "exit_at_spec.rb" with:
"""ruby
require 'rspec/autorun'
+ at_exit { exit(0) }
describe "exit 0 at_exit" do
it "does not interfere with rspec's exit code" do
- at_exit { exit 0 }
fail
end
end
"""
- When I run `rspec exit_at_spec.rb`
+ When I run `ruby exit_at_spec.rb`
Then the exit status should be 1
And the output should contain "1 example, 1 failure"
View
2  features/support/env.rb
@@ -7,6 +7,6 @@
set_env('JAVA_OPTS', '-d32') # force jRuby to use client JVM for faster startup times
@aruba_timeout_seconds = 60
else
- @aruba_timeout_seconds = 5
+ @aruba_timeout_seconds = 10
end
end
View
5 lib/rspec/core/configuration.rb
@@ -4,6 +4,11 @@ module RSpec
module Core
# Stores runtime configuration information.
#
+ # Configuration options are loaded from `~/.rspec`, `.rspec`,
+ # `.rspec-local`, command line switches, and the `SPEC_OPTS` environment
+ # variable (listed in lowest to highest precedence; for example, an option
+ # in `~/.rspec` can be overridden by an option in `.rspec-local`).
+ #
# @example Standard settings
# RSpec.configure do |c|
# c.drb = true
View
8 lib/rspec/core/formatters/base_formatter.rb
@@ -117,6 +117,14 @@ def close
restore_sync_output
end
+ # @api public
+ #
+ # Formats the given backtrace based on configuration and
+ # the metadata of the given example.
+ def format_backtrace(backtrace, example)
+ super(backtrace, example.metadata)
+ end
+
protected
def configuration
View
2  lib/rspec/core/formatters/base_text_formatter.rb
@@ -160,7 +160,7 @@ def format_caller(caller_info)
end
def dump_backtrace(example)
- format_backtrace(example.execution_result[:exception].backtrace, example.metadata).each do |backtrace_info|
+ format_backtrace(example.execution_result[:exception].backtrace, example).each do |backtrace_info|
output.puts cyan("#{long_padding}# #{backtrace_info}")
end
end
View
2  lib/rspec/core/formatters/html_formatter.rb
@@ -86,7 +86,7 @@ def example_failed(example)
exception_details = if exception
{
:message => exception.message,
- :backtrace => format_backtrace(exception.backtrace, example.metadata).join("\n")
+ :backtrace => format_backtrace(exception.backtrace, example).join("\n")
}
else
false
View
17 lib/rspec/core/metadata.rb
@@ -89,10 +89,19 @@ def first_caller_from_outside_rspec
self[:caller].detect {|l| l !~ /\/lib\/rspec\/core/}
end
- def build_description_from(*parts)
- parts.map {|p| p.to_s}.inject do |desc, p|
- p =~ /^(#|::|\.)/ ? "#{desc}#{p}" : "#{desc} #{p}"
- end || ""
+ def method_description_after_module?(parent_part, child_part)
+ return false unless parent_part.is_a?(Module)
+ child_part =~ /^(#|::|\.)/
+ end
+
+ def build_description_from(first_part = '', *parts)
+ description, _ = parts.inject([first_part.to_s, first_part]) do |(desc, last_part), this_part|
+ this_part = this_part.to_s
+ this_part = (' ' + this_part) unless method_description_after_module?(last_part, this_part)
+ [(desc + this_part), this_part]
+ end
+
+ description
end
end
View
12 lib/rspec/core/rake_task.rb
@@ -157,11 +157,21 @@ def run_task(verbose)
private
+ if RUBY_VERSION == '1.8.6'
+ def shellescape(string)
+ string.gsub(/"/, '\"').gsub(/'/, "\\\\'")
+ end
+ else
+ def shellescape(string)
+ string.shellescape
+ end
+ end
+
def files_to_run
if ENV['SPEC']
FileList[ ENV['SPEC'] ].sort
else
- FileList[ pattern ].sort.map { |f| f.shellescape }
+ FileList[ pattern ].sort.map { |f| shellescape(f) }
end
end
View
13 lib/rspec/core/runner.rb
@@ -5,7 +5,18 @@ class Runner
# Register an at_exit hook that runs the suite.
def self.autorun
return if autorun_disabled? || installed_at_exit? || running_in_drb?
- at_exit { exit run(ARGV, $stderr, $stdout).to_i unless $! }
+ at_exit do
+ # Don't bother running any specs and just let the program terminate
+ # if we got here due to an unrescued exception (anything other than
+ # SystemExit, which is raised when somebody calls Kernel#exit).
+ next unless $!.nil? || $!.kind_of?(SystemExit)
+
+ # We got here because either the end of the program was reached or
+ # somebody called Kernel#exit. Run the specs and then override any
+ # existing exit status with RSpec's exit status if any specs failed.
+ status = run(ARGV, $stderr, $stdout).to_i
+ exit status if status != 0
+ end
@installed_at_exit = true
end
AT_EXIT_HOOK_BACKTRACE_LINE = "#{__FILE__}:#{__LINE__ - 2}:in `autorun'"
View
2  lib/rspec/core/version.rb
@@ -1,7 +1,7 @@
module RSpec
module Core
module Version
- STRING = '2.12.0'
+ STRING = '2.12.1'
end
end
end
View
2  spec/rspec/core/formatters/base_formatter_spec.rb
@@ -101,7 +101,7 @@
end
it "removes lines from rspec and lines that come before the invocation of the at_exit autorun hook" do
- formatter.format_backtrace(backtrace).should eq(["./my_spec.rb:5"])
+ formatter.format_backtrace(backtrace, stub.as_null_object).should eq(["./my_spec.rb:5"])
end
end
View
410 spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html
@@ -0,0 +1,410 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>RSpec results</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Expires" content="-1" />
+ <meta http-equiv="Pragma" content="no-cache" />
+ <style type="text/css">
+ body {
+ margin: 0;
+ padding: 0;
+ background: #fff;
+ font-size: 80%;
+ }
+ </style>
+ <script type="text/javascript">
+ // <![CDATA[
+
+function addClass(element_id, classname) {
+ document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+ var elem = document.getElementById(element_id);
+ var classlist = elem.className.replace(classname,'');
+ elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+ document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+ removeClass(element_id, 'passed');
+ removeClass(element_id, 'not_implemented');
+ addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+ var elem = document.getElementById(element_id);
+ if (elem.className.indexOf("failed") == -1) { // class doesn't includes failed
+ if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+ removeClass(element_id, 'passed');
+ addClass(element_id,'not_implemented');
+ }
+ }
+}
+
+function apply_filters() {
+ var passed_filter = document.getElementById('passed_checkbox').checked;
+ var failed_filter = document.getElementById('failed_checkbox').checked;
+ var pending_filter = document.getElementById('pending_checkbox').checked;
+
+ assign_display_style("example passed", passed_filter);
+ assign_display_style("example failed", failed_filter);
+ assign_display_style("example not_implemented", pending_filter);
+
+ assign_display_style_for_group("example_group passed", passed_filter);
+ assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+ assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+ var style_mode = 'none';
+ if (display_flag == true) {
+ style_mode = 'block';
+ }
+ return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+ var style_mode = get_display_style(display_flag);
+ var elems = document.getElementsByClassName(classname)
+ for (var i=0; i<elems.length;i++) {
+ elems[i].style.display = style_mode;
+ }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+ var display_style_mode = get_display_style(display_flag);
+ var subgroup_style_mode = get_display_style(subgroup_flag);
+ var elems = document.getElementsByClassName(classname)
+ for (var i=0; i<elems.length;i++) {
+ var style_mode = display_style_mode;
+ if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+ elems[i].style.display = subgroup_style_mode;
+ } else {
+ elems[i].style.display = display_style_mode;
+ }
+ }
+}
+
+ // ]]>
+ </script>
+ <style type="text/css">
+#rspec-header {
+ background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+ margin: 0px 10px 0px 10px;
+ padding: 10px;
+ font-family: "Lucida Grande", Helvetica, sans-serif;
+ font-size: 1.8em;
+ position: absolute;
+}
+
+#label {
+ float:left;
+}
+
+#display-filters {
+ float:left;
+ padding: 28px 0 0 40%;
+ font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+ float:right;
+ padding: 5px 10px;
+ font-family: "Lucida Grande", Helvetica, sans-serif;
+ text-align: right;
+}
+
+#summary p {
+ margin: 0 0 0 2px;
+}
+
+#summary #totals {
+ font-size: 1.2em;
+}
+
+.example_group {
+ margin: 0 10px 5px;
+ background: #fff;
+}
+
+dl {
+ margin: 0; padding: 0 0 5px;
+ font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+ padding: 3px;
+ background: #65C400;
+ color: #fff;
+ font-weight: bold;
+}
+
+dd {
+ margin: 5px 0 5px 5px;
+ padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+ padding-left: 5px;
+ text-align: right;
+ right: 0px;
+ float:right;
+}
+
+dd.example.passed {
+ border-left: 5px solid #65C400;
+ border-bottom: 1px solid #65C400;
+ background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+ border-left: 5px solid #FAF834;
+ border-bottom: 1px solid #FAF834;
+ background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+ border-left: 5px solid #0000C2;
+ border-bottom: 1px solid #0000C2;
+ color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+ border-left: 5px solid #C20000;
+ border-bottom: 1px solid #C20000;
+ color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+ color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+ color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+ color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+ color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+ color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+ color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+ color: #000;
+ font-size: 12px;
+}
+
+a {
+ color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+ font-size: 12px;
+ font-family: monospace;
+ color: white;
+ background-color: black;
+ padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+ width: 75px;
+ padding: 0.1em 1em 0.2em 0;
+ color: #000000;
+ background-color: #FFFBD3;
+}
+
+ </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+ <div id="label">
+ <h1>RSpec Code Examples</h1>
+ </div>
+
+ <div id="display-filters">
+ <input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
+ <input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
+ <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
+ </div>
+
+ <div id="summary">
+ <p id="totals">&nbsp;</p>
+ <p id="duration">&nbsp;</p>
+ </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+ <dl style="margin-left: 0px;">
+ <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+ <script type="text/javascript">makeYellow('rspec-header');</script>
+ <script type="text/javascript">makeYellow('div_group_1');</script>
+ <script type="text/javascript">makeYellow('example_group_1');</script>
+ <script type="text/javascript">moveProgressBar('14.2');</script>
+ <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+ </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+ <dl style="margin-left: 0px;">
+ <dt id="example_group_2" class="passed">pending command with block format</dt>
+ </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+ <dl style="margin-left: 15px;">
+ <dt id="example_group_3" class="passed">with content that would fail</dt>
+ <script type="text/javascript">makeYellow('rspec-header');</script>
+ <script type="text/javascript">makeYellow('div_group_3');</script>
+ <script type="text/javascript">makeYellow('example_group_3');</script>
+ <script type="text/javascript">moveProgressBar('28.5');</script>
+ <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+ </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+ <dl style="margin-left: 15px;">
+ <dt id="example_group_4" class="passed">with content that would pass</dt>
+ <script type="text/javascript">makeRed('rspec-header');</script>
+ <script type="text/javascript">makeRed('div_group_4');</script>
+ <script type="text/javascript">makeRed('example_group_4');</script>
+ <script type="text/javascript">moveProgressBar('42.8');</script>
+ <dd class="example pending_fixed">
+ <span class="failed_spec_name">fails</span>
+ <span class="duration">n.nnnns</span>
+ <div class="failure" id="failure_1">
+ <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+ <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `(root)'
+./spec/rspec/core/formatters/html_formatter_spec.rb:32:in `Formatters'
+./spec/rspec/core/formatters/html_formatter_spec.rb:54:in `Formatters'
+./spec/rspec/core/formatters/html_formatter_spec.rb:54:in `Formatters'
+./spec/rspec/core/formatters/html_formatter_spec.rb:53:in `Formatters'</pre></div>
+ <pre class="ruby"><code><span class="linenum">16</span> <span class="ident">context</span> <span class="punct">&quot;</span><span class="string">with content that would pass</span><span class="punct">&quot;</span> <span class="keyword">do</span>
+<span class="linenum">17</span> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">fails</span><span class="punct">&quot;</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span> <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span> <span class="number">1</span><span class="punct">.</span><span class="ident">should</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span> <span class="keyword">end</span></code></pre>
+ </div>
+ </dd>
+ </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+ <dl style="margin-left: 0px;">
+ <dt id="example_group_5" class="passed">passing spec</dt>
+ <script type="text/javascript">moveProgressBar('57.1');</script>
+ <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+ </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+ <dl style="margin-left: 0px;">
+ <dt id="example_group_6" class="passed">failing spec</dt>
+ <script type="text/javascript">makeRed('div_group_6');</script>
+ <script type="text/javascript">makeRed('example_group_6');</script>
+ <script type="text/javascript">moveProgressBar('71.4');</script>
+ <dd class="example failed">
+ <span class="failed_spec_name">fails</span>
+ <span class="duration">n.nnnns</span>
+ <div class="failure" id="failure_2">
+ <div class="message"><pre>
+expected: 2
+ got: 1
+
+(compared using ==)
+</pre></div>
+ <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `(root)'
+./spec/rspec/core/formatters/html_formatter_spec.rb:32:in `Formatters'
+./spec/rspec/core/formatters/html_formatter_spec.rb:54:in `Formatters'
+./spec/rspec/core/formatters/html_formatter_spec.rb:54:in `Formatters'
+./spec/rspec/core/formatters/html_formatter_spec.rb:53:in `Formatters'</pre></div>
+ <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">&quot;</span><span class="string">failing spec</span><span class="punct">&quot;</span> <span class="keyword">do</span>
+<span class="linenum">32</span> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">fails</span><span class="punct">&quot;</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span> <span class="number">1</span><span class="punct">.</span><span class="ident">should</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span> <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+ </div>
+ </dd>
+ </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+ <dl style="margin-left: 0px;">
+ <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+ <script type="text/javascript">makeRed('div_group_7');</script>
+ <script type="text/javascript">makeRed('example_group_7');</script>
+ <script type="text/javascript">moveProgressBar('85.7');</script>
+ <dd class="example failed">
+ <span class="failed_spec_name">fails with a backtrace that has no file</span>
+ <span class="duration">n.nnnns</span>
+ <div class="failure" id="failure_3">
+ <div class="message"><pre>foo</pre></div>
+ <div class="backtrace"><pre>(erb):1:in `result'
+./spec/rspec/core/resources/formatter_specs.rb:41:in `(root)'
+./spec/rspec/core/formatters/html_formatter_spec.rb:32:in `Formatters'
+./spec/rspec/core/formatters/html_formatter_spec.rb:54:in `Formatters'
+./spec/rspec/core/formatters/html_formatter_spec.rb:54:in `Formatters'
+./spec/rspec/core/formatters/html_formatter_spec.rb:53:in `Formatters'</pre></div>
+ <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+ </div>
+ </dd>
+ <script type="text/javascript">moveProgressBar('100.0');</script>
+ <dd class="example failed">
+ <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+ <span class="duration">n.nnnns</span>
+ <div class="failure" id="failure_4">
+ <div class="message"><pre>Exception</pre></div>
+ <div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
+ <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+ </div>
+ </dd>
+ </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
View
410 spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html
@@ -0,0 +1,410 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>RSpec results</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Expires" content="-1" />
+ <meta http-equiv="Pragma" content="no-cache" />
+ <style type="text/css">
+ body {
+ margin: 0;
+ padding: 0;
+ background: #fff;
+ font-size: 80%;
+ }
+ </style>
+ <script type="text/javascript">
+ // <![CDATA[
+
+function addClass(element_id, classname) {
+ document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+ var elem = document.getElementById(element_id);
+ var classlist = elem.className.replace(classname,'');
+ elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+ document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+ removeClass(element_id, 'passed');
+ removeClass(element_id, 'not_implemented');
+ addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+ var elem = document.getElementById(element_id);
+ if (elem.className.indexOf("failed") == -1) { // class doesn't includes failed
+ if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+ removeClass(element_id, 'passed');
+ addClass(element_id,'not_implemented');
+ }
+ }
+}
+
+function apply_filters() {
+ var passed_filter = document.getElementById('passed_checkbox').checked;
+ var failed_filter = document.getElementById('failed_checkbox').checked;
+ var pending_filter = document.getElementById('pending_checkbox').checked;
+
+ assign_display_style("example passed", passed_filter);
+ assign_display_style("example failed", failed_filter);
+ assign_display_style("example not_implemented", pending_filter);
+
+ assign_display_style_for_group("example_group passed", passed_filter);
+ assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+ assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+ var style_mode = 'none';
+ if (display_flag == true) {
+ style_mode = 'block';
+ }
+ return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+ var style_mode = get_display_style(display_flag);
+ var elems = document.getElementsByClassName(classname)
+ for (var i=0; i<elems.length;i++) {
+ elems[i].style.display = style_mode;
+ }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+ var display_style_mode = get_display_style(display_flag);
+ var subgroup_style_mode = get_display_style(subgroup_flag);
+ var elems = document.getElementsByClassName(classname)
+ for (var i=0; i<elems.length;i++) {
+ var style_mode = display_style_mode;
+ if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+ elems[i].style.display = subgroup_style_mode;
+ } else {
+ elems[i].style.display = display_style_mode;
+ }
+ }
+}
+
+ // ]]>
+ </script>
+ <style type="text/css">
+#rspec-header {
+ background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+ margin: 0px 10px 0px 10px;
+ padding: 10px;
+ font-family: "Lucida Grande", Helvetica, sans-serif;
+ font-size: 1.8em;
+ position: absolute;
+}
+
+#label {
+ float:left;
+}
+
+#display-filters {
+ float:left;
+ padding: 28px 0 0 40%;
+ font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+ float:right;
+ padding: 5px 10px;
+ font-family: "Lucida Grande", Helvetica, sans-serif;
+ text-align: right;
+}
+
+#summary p {
+ margin: 0 0 0 2px;
+}
+
+#summary #totals {
+ font-size: 1.2em;
+}
+
+.example_group {
+ margin: 0 10px 5px;
+ background: #fff;
+}
+
+dl {
+ margin: 0; padding: 0 0 5px;
+ font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+ padding: 3px;
+ background: #65C400;
+ color: #fff;
+ font-weight: bold;
+}
+
+dd {
+ margin: 5px 0 5px 5px;
+ padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+ padding-left: 5px;
+ text-align: right;
+ right: 0px;
+ float:right;
+}
+
+dd.example.passed {
+ border-left: 5px solid #65C400;
+ border-bottom: 1px solid #65C400;
+ background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+ border-left: 5px solid #FAF834;
+ border-bottom: 1px solid #FAF834;
+ background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+ border-left: 5px solid #0000C2;
+ border-bottom: 1px solid #0000C2;
+ color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+ border-left: 5px solid #C20000;
+ border-bottom: 1px solid #C20000;
+ color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+ color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+ color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+ color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+ color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+ color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+ color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+ color: #000;
+ font-size: 12px;
+}
+
+a {
+ color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+ font-size: 12px;
+ font-family: monospace;
+ color: white;
+ background-color: black;
+ padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+ width: 75px;
+ padding: 0.1em 1em 0.2em 0;
+ color: #000000;
+ background-color: #FFFBD3;
+}
+
+ </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+ <div id="label">
+ <h1>RSpec Code Examples</h1>
+ </div>
+
+ <div id="display-filters">
+ <input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
+ <input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
+ <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
+ </div>
+
+ <div id="summary">
+ <p id="totals">&nbsp;</p>
+ <p id="duration">&nbsp;</p>
+ </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+ <dl style="margin-left: 0px;">
+ <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+ <script type="text/javascript">makeYellow('rspec-header');</script>
+ <script type="text/javascript">makeYellow('div_group_1');</script>
+ <script type="text/javascript">makeYellow('example_group_1');</script>
+ <script type="text/javascript">moveProgressBar('14.2');</script>
+ <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+ </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+ <dl style="margin-left: 0px;">
+ <dt id="example_group_2" class="passed">pending command with block format</dt>
+ </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+ <dl style="margin-left: 15px;">
+ <dt id="example_group_3" class="passed">with content that would fail</dt>
+ <script type="text/javascript">makeYellow('rspec-header');</script>
+ <script type="text/javascript">makeYellow('div_group_3');</script>
+ <script type="text/javascript">makeYellow('example_group_3');</script>
+ <script type="text/javascript">moveProgressBar('28.5');</script>
+ <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+ </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+ <dl style="margin-left: 15px;">
+ <dt id="example_group_4" class="passed">with content that would pass</dt>
+ <script type="text/javascript">makeRed('rspec-header');</script>
+ <script type="text/javascript">makeRed('div_group_4');</script>
+ <script type="text/javascript">makeRed('example_group_4');</script>
+ <script type="text/javascript">moveProgressBar('42.8');</script>
+ <dd class="example pending_fixed">
+ <span class="failed_spec_name">fails</span>
+ <span class="duration">n.nnnns</span>
+ <div class="failure" id="failure_1">
+ <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+ <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `(root)'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=32">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:32</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=54">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:54</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=54">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:54</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=53">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:53</a> :in `Formatters'</pre></div>
+ <pre class="ruby"><code><span class="linenum">16</span> <span class="ident">context</span> <span class="punct">&quot;</span><span class="string">with content that would pass</span><span class="punct">&quot;</span> <span class="keyword">do</span>
+<span class="linenum">17</span> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">fails</span><span class="punct">&quot;</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span> <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span> <span class="number">1</span><span class="punct">.</span><span class="ident">should</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span> <span class="keyword">end</span></code></pre>
+ </div>
+ </dd>
+ </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+ <dl style="margin-left: 0px;">
+ <dt id="example_group_5" class="passed">passing spec</dt>
+ <script type="text/javascript">moveProgressBar('57.1');</script>
+ <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+ </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+ <dl style="margin-left: 0px;">
+ <dt id="example_group_6" class="passed">failing spec</dt>
+ <script type="text/javascript">makeRed('div_group_6');</script>
+ <script type="text/javascript">makeRed('example_group_6');</script>
+ <script type="text/javascript">moveProgressBar('71.4');</script>
+ <dd class="example failed">
+ <span class="failed_spec_name">fails</span>
+ <span class="duration">n.nnnns</span>
+ <div class="failure" id="failure_2">
+ <div class="message"><pre>
+expected: 2
+ got: 1
+
+(compared using ==)
+</pre></div>
+ <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `(root)'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=32">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:32</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=54">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:54</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=54">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:54</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=53">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:53</a> :in `Formatters'</pre></div>
+ <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">&quot;</span><span class="string">failing spec</span><span class="punct">&quot;</span> <span class="keyword">do</span>
+<span class="linenum">32</span> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">fails</span><span class="punct">&quot;</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span> <span class="number">1</span><span class="punct">.</span><span class="ident">should</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span> <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+ </div>
+ </dd>
+ </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+ <dl style="margin-left: 0px;">
+ <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+ <script type="text/javascript">makeRed('div_group_7');</script>
+ <script type="text/javascript">makeRed('example_group_7');</script>
+ <script type="text/javascript">moveProgressBar('85.7');</script>
+ <dd class="example failed">
+ <span class="failed_spec_name">fails with a backtrace that has no file</span>
+ <span class="duration">n.nnnns</span>
+ <div class="failure" id="failure_3">
+ <div class="message"><pre>foo</pre></div>
+ <div class="backtrace"><pre>(erb):1:in `result'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `(root)'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=32">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:32</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=54">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:54</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=54">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:54</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&line=53">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:53</a> :in `Formatters'</pre></div>
+ <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+ </div>
+ </dd>
+ <script type="text/javascript">moveProgressBar('100.0');</script>
+ <dd class="example failed">
+ <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+ <span class="duration">n.nnnns</span>
+ <div class="failure" id="failure_4">
+ <div class="message"><pre>Exception</pre></div>
+ <div class="backtrace"><pre><a href="txmt://open?url=file:///foo.html.erb&line=1">/foo.html.erb:1</a> :in `&lt;main&gt;': foo (RuntimeError)</pre></div>
+ <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+ </div>
+ </dd>
+ </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
View
18 spec/rspec/core/metadata_spec.rb
@@ -414,18 +414,28 @@ module Core
m[:example_group][:full_description].should eq("Array#{char}method")
end
end
- end
- %w[# . ::].each do |char|
- context "with a nested description starting with #{char}" do
+ context "with a description starting with #{char} nested under a module" do
it "removes the space" do
parent = Metadata.new
- parent.process("Object")
+ parent.process(Object)
child = Metadata.new(parent)
child.process("#{char}method")
child[:example_group][:full_description].should eq("Object#{char}method")
end
end
+
+ context "with a description starting with #{char} nested under a context string" do
+ it "does not remove the space" do
+ grandparent = Metadata.new
+ grandparent.process(Array)
+ parent = Metadata.new(grandparent)
+ parent.process("with 2 items")
+ child = Metadata.new(parent)
+ child.process("#{char}method")
+ child[:example_group][:full_description].should eq("Array with 2 items #{char}method")
+ end
+ end
end
end

No commit comments for this range

Something went wrong with that request. Please try again.