diff --git a/.travis.yml b/.travis.yml index 4dff3f2bcc..b5a3b1f677 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,24 @@ -language: ruby -script: "script/test_all 2>&1" -bundler_args: "--standalone --binstubs" +# This file was generated on 2014-02-12T09:23:25+11:00 from the rspec-dev repo. +# DO NOT modify it by hand as your changes will get lost the next time it is generated. + +before_install: "script/clone_all_rspec_repos" +bundler_args: "--binstubs --standalone --without documentation --path ../bundle" +script: "script/run_build" rvm: - 1.8.7 - 1.9.2 - 1.9.3 + - 2.0.0 + - 2.1.0 + - ruby-head - ree - jruby-18mode - - jruby-19mode - - rbx-18mode - - rbx-19mode - - 2.0.0 + - jruby + - jruby-head + - rbx matrix: allow_failures: - - rvm: rbx-19mode - - rvm: rbx-18mode - + - rvm: jruby-head + - rvm: ruby-head + - rvm: rbx + fast_finish: true diff --git a/Changelog.md b/Changelog.md index 62f2c6f91d..42be6352d1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,11 @@ +### 2.14.8 / 2014-02-27 +[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.7...v2.14.8) + +Bug fixes: + +* Fix regression with the `TextMateFormatter` that prevented backtrace links + from being clickable. (Stefan Daschek) + ### 2.14.7 / 2013-10-29 [full changelog](http://github.com/rspec/rspec-core/compare/v2.14.6...v2.14.7) diff --git a/lib/rspec/core/formatters/text_mate_formatter.rb b/lib/rspec/core/formatters/text_mate_formatter.rb index f288c3c95b..a2358c4e61 100644 --- a/lib/rspec/core/formatters/text_mate_formatter.rb +++ b/lib/rspec/core/formatters/text_mate_formatter.rb @@ -6,6 +6,18 @@ module Core module Formatters # Formats backtraces so they're clickable by TextMate class TextMateFormatter < HtmlFormatter + class NonEscapingHtmlPrinter < RSpec::Core::Formatters::HtmlPrinter + def print_example_failed(pending_fixed, description, run_time, failure_id, exception, extra_content, escape_backtrace = false) + # Call implementation from superclass, but ignore `escape_backtrace` and always pass `false` instead. + super(pending_fixed, description, run_time, failure_id, exception, extra_content, false) + end + end + + def initialize(output) + super + @printer = NonEscapingHtmlPrinter.new(output) + end + def backtrace_line(line, skip_textmate_conversion=false) if skip_textmate_conversion super(line) diff --git a/lib/rspec/core/version.rb b/lib/rspec/core/version.rb index ce0e3313fb..be2a153a5a 100644 --- a/lib/rspec/core/version.rb +++ b/lib/rspec/core/version.rb @@ -1,7 +1,7 @@ module RSpec module Core module Version - STRING = '2.14.7' + STRING = '2.14.8' end end end diff --git a/maintenance-branch b/maintenance-branch new file mode 100644 index 0000000000..62c9fb0030 --- /dev/null +++ b/maintenance-branch @@ -0,0 +1 @@ +2-14-maintenance \ No newline at end of file diff --git a/script/clone_all_rspec_repos b/script/clone_all_rspec_repos new file mode 100755 index 0000000000..f48a9d8137 --- /dev/null +++ b/script/clone_all_rspec_repos @@ -0,0 +1,23 @@ +#!/bin/bash +# This file was generated on 2014-02-12T09:23:25+11:00 from the rspec-dev repo. +# DO NOT modify it by hand as your changes will get lost the next time it is generated. + +set -e -x +source script/functions.sh + +if is_mri; then + pushd .. + + clone_repo "rspec" + clone_repo "rspec-core" + clone_repo "rspec-expectations" + clone_repo "rspec-mocks" + + if rspec_support_compatible; then + clone_repo "rspec-support" + fi + + popd +else + echo "Not cloning all repos since we are not on MRI and they are only needed for the MRI build" +fi diff --git a/script/functions.sh b/script/functions.sh new file mode 100644 index 0000000000..87a21e4814 --- /dev/null +++ b/script/functions.sh @@ -0,0 +1,123 @@ +# This file was generated on 2014-02-12T09:23:25+11:00 from the rspec-dev repo. +# DO NOT modify it by hand as your changes will get lost the next time it is generated. + +# idea taken from: http://blog.headius.com/2010/03/jruby-startup-time-tips.html +export JRUBY_OPTS='-X-C' # disable JIT since these processes are so short lived +SPECS_HAVE_RUN_FILE=specs.out +MAINTENANCE_BRANCH=`cat maintenance-branch` +BUNDLE_INSTALL_FLAGS=`cat .travis.yml | grep bundler_args | tr -d '"' | grep -o " .*"` + +# Taken from: +# https://github.com/travis-ci/travis-build/blob/e9314616e182a23e6a280199cd9070bfc7cae548/lib/travis/build/script/templates/header.sh#L34-L53 +travis_retry() { + local result=0 + local count=1 + while [ $count -le 3 ]; do + [ $result -ne 0 ] && { + echo -e "\n\033[33;1mThe command \"$@\" failed. Retrying, $count of 3.\033[0m\n" >&2 + } + "$@" + result=$? + [ $result -eq 0 ] && break + count=$(($count + 1)) + sleep 1 + done + + [ $count -eq 3 ] && { + echo "\n\033[33;1mThe command \"$@\" failed 3 times.\033[0m\n" >&2 + } + + return $result +} + +function is_mri { + if ruby -e "exit(!defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby')"; then + # RUBY_ENGINE only returns 'ruby' on MRI. + # MRI 1.8.7 lacks the constant but all other rubies have it (including JRuby in 1.8 mode) + return 0 + else + return 1 + fi; +} + +function is_mri_192 { + if is_mri; then + if ruby -e "exit(RUBY_VERSION == '1.9.2')"; then + return 0 + else + return 1 + fi + else + return 1 + fi +} + +function rspec_support_compatible { + if [ "$MAINTENANCE_BRANCH" != "2-99-maintenance" ] && [ "$MAINTENANCE_BRANCH" != "2-14-maintenance" ]; then + return 0 + else + return 1 + fi +} + + +function clone_repo { + if [ ! -d $1 ]; then # don't clone if the dir is already there + travis_retry git clone git://github.com/rspec/$1 --depth 1 --branch $MAINTENANCE_BRANCH + fi; +} + +function run_specs_and_record_done { + local rspec_bin=bin/rspec + + # rspec-core needs to run with a special script that loads simplecov first, + # so that it can instrument rspec-core's code before rspec-core has been loaded. + if [ -f script/rspec_with_simplecov ]; then + rspec_bin=script/rspec_with_simplecov + fi; + + $rspec_bin spec --backtrace --format progress --profile --format progress --out $SPECS_HAVE_RUN_FILE +} + +function run_cukes { + if [ -d features ]; then + # force jRuby to use client mode JVM or a compilation mode thats as close as possible, + # idea taken from https://github.com/jruby/jruby/wiki/Improving-startup-time + # + # Note that we delay setting this until we run the cukes because we've seen + # spec failures in our spec suite due to problems with this mode. + export JAVA_OPTS='-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1' + + if is_mri_192; then + # For some reason we get SystemStackError on 1.9.2 when using + # the bin/cucumber approach below. That approach is faster + # (as it avoids the bundler tax), so we use it on rubies where we can. + bundle exec cucumber --strict + else + # Prepare RUBYOPT for scenarios that are shelling out to ruby, + # and PATH for those that are using `rspec` or `rake`. + RUBYOPT="-I${PWD}/../bundle -rbundler/setup" \ + PATH="${PWD}/bin:$PATH" \ + bin/cucumber --strict + fi + fi +} + +function run_specs_one_by_one { + for file in `find spec -iname '*_spec.rb'`; do + bin/rspec $file -b --format progress + done +} + +function run_spec_suite_for { + if [ ! -f ../$1/$SPECS_HAVE_RUN_FILE ]; then # don't rerun specs that have already run + pushd ../$1 + echo + echo "Running specs for $1" + echo + unset BUNDLE_GEMFILE + travis_retry bundle install $BUNDLE_INSTALL_FLAGS + run_specs_and_record_done + popd + fi; +} diff --git a/script/run_build b/script/run_build new file mode 100755 index 0000000000..fd74b1460e --- /dev/null +++ b/script/run_build @@ -0,0 +1,22 @@ +#!/bin/bash +# This file was generated on 2014-02-12T09:23:25+11:00 from the rspec-dev repo. +# DO NOT modify it by hand as your changes will get lost the next time it is generated. + +set -e -x +source script/functions.sh + +run_specs_and_record_done +run_cukes + +if is_mri; then + run_specs_one_by_one + run_spec_suite_for "rspec-core" + run_spec_suite_for "rspec-expectations" + run_spec_suite_for "rspec-mocks" + + if rspec_support_compatible; then + run_spec_suite_for "rspec-support" + fi +else + echo "Skipping the rest of the build on non-MRI rubies" +fi diff --git a/script/test_all b/script/test_all deleted file mode 100755 index af304e6f20..0000000000 --- a/script/test_all +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -set -e -x - -function is_jruby() { - if ruby -e 'exit RUBY_PLATFORM == "java"'; then - return 0 - else - return 1 - fi -} - -# Needed by Bundler 1.3: https://github.com/carlhuda/bundler/issues/2382 -export RUBYOPT='-rrbconfig' - -# idea taken from: http://blog.headius.com/2010/03/jruby-startup-time-tips.html -export JRUBY_OPTS='-X-C' # disable JIT since these processes are so short lived - -# force jRuby to use client mode JVM or a compilation mode thats as close as possible, -# idea taken from https://github.com/jruby/jruby/wiki/Improving-startup-time -export JAVA_OPTS='-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1' - -echo "Bundling Standalone so we can run the specs w/o bundler loaded" -bundle install --standalone --binstubs - -echo "Running all..." -bin/rspec spec -b --format progress --profile - -echo -echo "--------------------------------------------------------------------" -echo - -if is_jruby; then - echo "Skipping one-by-one spec runs due to expensive JVM load time" -else - for file in `find spec -iname '*_spec.rb'`; do - bin/rspec $file -b --format progress - done -fi - -# Prepare RUBYOPT for scenarios that are shelling out to ruby, -# and PATH for those that are using `rspec` or `rake`. -# RUBYOPT="-I${PWD}/bundle -rbundler/setup" \ -# PATH="${PWD}/bin:$PATH" \ -# bin/cucumber - -# For now, use this instead, due to a bug in bundler: -# https://github.com/carlhuda/bundler/issues/2382 -bundle exec bin/cucumber - diff --git a/spec/rspec/core/formatters/text_mate_formatted-2.1.0.html b/spec/rspec/core/formatters/text_mate_formatted-2.1.0.html new file mode 100644 index 0000000000..dff12c25a7 --- /dev/null +++ b/spec/rspec/core/formatters/text_mate_formatted-2.1.0.html @@ -0,0 +1,425 @@ + + + + RSpec results + + + + + + + + +
+ +
+
+

RSpec Code Examples

+
+ +
+ + + +
+ +
+

 

+

 

+
+
+ + +
+
+
+
pending spec with no implementation
+ + + + +
is pending (PENDING: Not yet implemented)
+
+
+
+
+
pending command with block format
+
+
+
+
+
with content that would fail
+ + + + +
is pending (PENDING: No reason given)
+
+
+
+
+
with content that would pass
+ + + + +
+ fails + n.nnnns +
+
RSpec::Core::Pending::PendingExampleFixedError
+
<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `block (3 levels) in &lt;top (required)&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed&#39;
+
16  context "with content that would pass" do
+17    it "fails" do
+18      pending do
+19        expect(1).to eq(1)
+20      end
+
+
+
+
+
+
+
passing spec
+ +
passesn.nnnns
+
+
+
+
+
failing spec
+ + + +
+ fails + n.nnnns +
+
+expected: 2
+     got: 1
+
+(compared using ==)
+
+
<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `block (2 levels) in &lt;top (required)&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed&#39;
+
31describe "failing spec" do
+32  it "fails" do
+33    expect(1).to eq(2)
+34  end
+35end
+
+
+
+
+
+
+
a failing spec with odd backtraces
+ + + +
+ fails with a backtrace that has no file + n.nnnns +
+
foo
+
(erb):1:in `&lt;main&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `block (2 levels) in &lt;top (required)&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/myron/code/rspec-dev/repos/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed&#39;
+
-1# Couldn't get snippet for (erb)
+
+
+ +
+ fails with a backtrace containing an erb file + n.nnnns +
+
Exception
+
<a href="txmt://open?url=file:///foo.html.erb&amp;line=1">/foo.html.erb:1</a> :in `&lt;main&gt;&#39;: foo (RuntimeError)
+
-1# Couldn't get snippet for /foo.html.erb
+
+
+
+
+ + +
+
+ + diff --git a/spec/rspec/core/formatters/text_mate_formatter_spec.rb b/spec/rspec/core/formatters/text_mate_formatter_spec.rb index e564045cb4..9ada5ff926 100644 --- a/spec/rspec/core/formatters/text_mate_formatter_spec.rb +++ b/spec/rspec/core/formatters/text_mate_formatter_spec.rb @@ -72,6 +72,7 @@ module Formatters expect(actual_doc.inner_html).to eq(expected_doc.inner_html) + expect(backtrace_lines).to_not be_empty backtrace_lines.each do |backtrace_line| expect(backtrace_line['href']).to include("txmt://open?url=") end