rspec-legacy_formatters 1.0.1 → 1.0.2

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
- SHA1:
3
- metadata.gz: 6a31dc262c49513ace20c235d84088138bc04d36
4
- data.tar.gz: 0076604dd5968e361cd466ff74f409080a54a2d6
2
+ SHA256:
3
+ metadata.gz: 9258440c0f471843e037dfff906d2c3fd84897041bf53365b854274a13fe46bd
4
+ data.tar.gz: 11c826f1b8524715b8627ace825265eb1ee22da05f9807fa3feeb955e467edea
5
5
  SHA512:
6
- metadata.gz: dc72aefd2143eddacef4d38e09897b2a24e2863256cde5ffba23882ce679d0bcd48a61785b43357e4b5e52cbcc5157ae480a6e915a66c17efcd013ef1194830e
7
- data.tar.gz: 484dc289429ea35e674809dfd7f1c4ed6916c7878ac48d174c1c43b2f081cf60fb24dcd23c0e96e6e9eeb6275545c51e6c338ce33238fda5fb21b65cf931fd6a
6
+ metadata.gz: 6010d1ceb9431f0d4f39f3143932944b03bb5a2ad1b15a923e2af06c10386099b844f4e971488ee595a6dc49e4f91cae64a1cc5b73a558132aca452f22982766
7
+ data.tar.gz: 1073890d5d8c29c3f9e17a22ab55da4331ff0b0a1728f12dbd38af99c6da56732b66d9fcc45c5d896af93e2754a0adefa5d6a937437e5ab23ad4867979018b17
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.gitignore CHANGED
@@ -9,3 +9,6 @@ tmp
9
9
  bin
10
10
  bundle
11
11
  Gemfile-custom
12
+ smoke_specs/.rspec
13
+ smoke_specs/specs.out
14
+ smoke_specs/spec/examples.txt
@@ -1,21 +1,54 @@
1
1
  # This file was generated on 2014-03-30T13:16:22-07:00 from the rspec-dev repo.
2
2
  # DO NOT modify it by hand as your changes will get lost the next time it is generated.
3
3
 
4
+ # In order to install old Rubies, we need to use old Ubuntu distibution.
5
+ dist: trusty
6
+ language: ruby
7
+ email: false
8
+
4
9
  bundler_args: "--binstubs --standalone --without documentation --path ../bundle"
5
10
  script: "script/run_build"
11
+ before_install:
12
+ - gem update bundler
6
13
  rvm:
7
14
  - 1.8.7
8
15
  - 1.9.2
9
16
  - 1.9.3
10
- - 2.0
17
+ - 2.0.0
11
18
  - 2.1
12
- - 2.2
19
+ - 2.2.10
20
+ - 2.3.8
21
+ - 2.4.6
22
+ - 2.5.5
23
+ - 2.6.3
13
24
  - ree
14
25
  - jruby-18mode
15
26
  - jruby
16
- - rbx-2
27
+ - rbx-3
17
28
  matrix:
18
29
  include:
19
30
  - rvm: jruby
20
31
  env: JRUBY_OPTS='--2.0'
32
+ - rvm: 2.6.3
33
+ env: RSPEC_VERSION='3-0-maintenance'
34
+ - rvm: 2.6.3
35
+ env: RSPEC_VERSION='3-1-maintenance'
36
+ - rvm: 2.6.3
37
+ env: RSPEC_VERSION='3-2-maintenance'
38
+ - rvm: 2.6.3
39
+ env: RSPEC_VERSION='3-3-maintenance'
40
+ - rvm: 2.6.3
41
+ env: RSPEC_VERSION='3-4-maintenance'
42
+ - rvm: 2.6.3
43
+ env: RSPEC_VERSION='3-5-maintenance'
44
+ - rvm: 2.6.3
45
+ env: RSPEC_VERSION='3-6-maintenance'
46
+ - rvm: 2.6.3
47
+ env: RSPEC_VERSION='3-7-maintenance''
48
+ - rvm: 2.6.3
49
+ env: RSPEC_VERSION='3-8-maintenance''
50
+ allow_failures:
51
+ - rvm: jruby
52
+ env: JRUBY_OPTS='--2.0'
53
+ - rvm: rbx-3
21
54
  fast_finish: true
@@ -1,3 +1,10 @@
1
+ ### 1.0.2 / 2019-09-18
2
+
3
+ Bug Fixes:
4
+
5
+ * Fix formatters using / extending the legacy HTML formatter which would crash
6
+ due to a change in the `SnippetExtractor` in RSpec 3.4. (Jon Rowe, #22)
7
+
1
8
  ### 1.0.1 / 2015-11-05
2
9
  [Full Changelog](http://github.com/rspec/rspec-legacy_formatters/compare/v1.0.0...v1.0.1)
3
10
 
data/Gemfile CHANGED
@@ -8,8 +8,20 @@ platforms :ruby do
8
8
  gem 'github-markup', '0.7.2'
9
9
  end
10
10
 
11
+ if RUBY_VERSION < '2.2.0' && !!(RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/)
12
+ gem 'ffi', '< 1.10'
13
+ elsif RUBY_VERSION < '2.0'
14
+ gem 'ffi', '< 1.9.19' # ffi dropped Ruby 1.8 support in 1.9.19
15
+ elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
16
+ gem 'ffi', '< 1.11.0'
17
+ else
18
+ gem 'ffi', '~> 1.11.0'
19
+ end
20
+
11
21
  gem 'simplecov', '~> 0.8'
12
22
 
23
+ gem 'contracts', '< 0.16' if RUBY_VERSION < '1.9.0'
24
+
13
25
  platforms :ruby_18, :jruby do
14
26
  gem 'json'
15
27
  end
@@ -1,5 +1,6 @@
1
1
  require 'rspec/legacy_formatters/base_text_formatter'
2
2
  require 'rspec/legacy_formatters/html_printer'
3
+ require 'rspec/legacy_formatters/snippet_extractor'
3
4
 
4
5
  module RSpec
5
6
  module Core
@@ -1,6 +1,8 @@
1
1
  module RSpec
2
2
  module Core
3
3
  module Formatters
4
+ remove_const :SnippetExtractor
5
+
4
6
  # @api private
5
7
  #
6
8
  # Extracts code snippets by looking at the backtrace of the passed error and applies synax highlighting and line numbers using html.
@@ -25,6 +27,14 @@ module RSpec
25
27
  @@converter = LegacyNullConverter
26
28
  end
27
29
 
30
+ # Copied from the 3.4 version, but with default overrides to cope with
31
+ # our usage
32
+ def initialize(source=nil, beginning_line_number=nil, max_line_count=nil)
33
+ @source = source
34
+ @beginning_line_number = beginning_line_number
35
+ @max_line_count = max_line_count
36
+ end
37
+
28
38
  # @api private
29
39
  #
30
40
  # Extract lines of code corresponding to a backtrace.
@@ -36,7 +46,9 @@ module RSpec
36
46
  def snippet(backtrace)
37
47
  raw_code, line = snippet_for(backtrace[0])
38
48
  highlighted = @@converter.convert(raw_code)
39
- highlighted << "\n<span class=\"comment\"># gem install syntax to get syntax highlighting</span>" if @@converter.is_a?(NullConverter)
49
+ if LegacyNullConverter == @@converter || (defined?(NullConverter) && @@converter.is_a?(NullConverter))
50
+ highlighted << "\n<span class=\"comment\"># gem install syntax to get syntax highlighting</span>"
51
+ end
40
52
  post_process(highlighted, line)
41
53
  end
42
54
 
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec LegacyFormatters.
4
4
  module Version
5
5
  # Current version of RSpec LegacyFormatters, in semantic versioning format.
6
- STRING = '1.0.1'
6
+ STRING = '1.0.2'
7
7
  end
8
8
  end
9
9
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Jon Rowe"]
10
10
  spec.email = ["hello@jonrowe.co.uk"]
11
11
  spec.email = "rspec@googlegroups.com"
12
- spec.homepage = "http://github.com/rspec/rspec-legacy_formatters"
12
+ spec.homepage = "https://github.com/rspec/rspec-legacy_formatters"
13
13
  spec.summary = "rspec-legacy_formatters-#{RSpec::LegacyFormatters::Version::STRING}"
14
14
  spec.description = %q{Support for RSpec 2.x formatters on 3.x}
15
15
  spec.license = "MIT"
@@ -59,18 +59,20 @@ function rspec_support_compatible {
59
59
  fi
60
60
  }
61
61
 
62
- function documentation_enforced {
63
- if [ -x ./bin/yard ]; then
62
+ function rspec_version_defined {
63
+ if [ "$RSPEC_VERSION" != "" ]; then
64
64
  return 0
65
65
  else
66
66
  return 1
67
67
  fi
68
68
  }
69
69
 
70
- function clone_repo {
71
- if [ ! -d $1 ]; then # don't clone if the dir is already there
72
- travis_retry git clone git://github.com/rspec/$1 --depth 1 --branch $MAINTENANCE_BRANCH
73
- fi;
70
+ function documentation_enforced {
71
+ if [ -x ./bin/yard ]; then
72
+ return 0
73
+ else
74
+ return 1
75
+ fi
74
76
  }
75
77
 
76
78
  function run_specs_and_record_done {
@@ -85,6 +87,57 @@ function run_specs_and_record_done {
85
87
  $rspec_bin spec --backtrace --format progress --profile --format progress --out $SPECS_HAVE_RUN_FILE
86
88
  }
87
89
 
90
+ function run_specs_as_version {
91
+ if [ ! -f ./smoke_specs/$SPECS_HAVE_RUN_FILE ]; then # don't rerun specs that have already run
92
+ pushd ./smoke_specs
93
+ echo
94
+ echo "Running smoke specs for $RSPEC_VERSION"
95
+ echo
96
+ unset BUNDLE_GEMFILE
97
+ bundle_install_flags=`cat ../.travis.yml | grep bundler_args | tr -d '"' | grep -o " .*"`
98
+ travis_retry bundle install $bundle_install_flags
99
+ cp ../.rspec .rspec
100
+
101
+ # First check that we can run our spec suite
102
+ bin/rspec ../spec --format NyanCatFormatter --format NyanCatFormatter
103
+
104
+ set +e
105
+ # Then check RSpec 2.x formatters
106
+ bin/rspec spec -r ../lib/rspec/legacy_formatters/documentation_formatter.rb --format RSpec::Core::Formatters::DocumentationFormatter
107
+ local documentation_status=$?
108
+
109
+ bin/rspec spec -r ../lib/rspec/legacy_formatters/json_formatter.rb --format RSpec::Core::Formatters::JsonFormatter
110
+ local json_status=$?
111
+
112
+ bin/rspec spec -r ../lib/rspec/legacy_formatters/html_formatter.rb --format RSpec::Core::Formatters::HtmlFormatter
113
+ local html_status=$?
114
+
115
+ bin/rspec spec -r ../lib/rspec/legacy_formatters/progress_formatter.rb --format RSpec::Core::Formatters::ProgressFormatter
116
+ local progress_status=$?
117
+
118
+ # Then check we can run the smoke suite
119
+ bin/rspec spec --format NyanCatFormatter --format NyanCatFormatter --out $SPECS_HAVE_RUN_FILE
120
+ local status=$?
121
+ set -e
122
+ popd
123
+ # 42 is set in the rspec config for the smoke tests,
124
+ # so we can differentiate between crashes and real failures
125
+ if
126
+ (test $status = 42) &&
127
+ (test $documentation_status = 42) &&
128
+ (test $json_status = 42) &&
129
+ (test $html_status = 42) &&
130
+ (test $progress_status = 42)
131
+ then
132
+ echo "Build passed"
133
+ return 0
134
+ else
135
+ echo "Build failed"
136
+ return 1
137
+ fi
138
+ fi;
139
+ }
140
+
88
141
  function run_cukes {
89
142
  if [ -d features ]; then
90
143
  # force jRuby to use client mode JVM or a compilation mode thats as close as possible,
@@ -109,26 +162,6 @@ function run_cukes {
109
162
  fi
110
163
  }
111
164
 
112
- function run_specs_one_by_one {
113
- for file in `find spec -iname '*_spec.rb'`; do
114
- bin/rspec $file -b --format progress
115
- done
116
- }
117
-
118
- function run_spec_suite_for {
119
- if [ ! -f ../$1/$SPECS_HAVE_RUN_FILE ]; then # don't rerun specs that have already run
120
- pushd ../$1
121
- echo
122
- echo "Running specs for $1"
123
- echo
124
- unset BUNDLE_GEMFILE
125
- bundle_install_flags=`cat .travis.yml | grep bundler_args | tr -d '"' | grep -o " .*"`
126
- travis_retry bundle install $bundle_install_flags
127
- run_specs_and_record_done
128
- popd
129
- fi;
130
- }
131
-
132
165
  function check_documentation_coverage {
133
166
  bin/yard stats --list-undoc | ruby -e "
134
167
  while line = gets
@@ -5,9 +5,14 @@
5
5
  set -e -x
6
6
  source script/functions.sh
7
7
 
8
- run_specs_and_record_done
9
- run_cukes
8
+ # We can't run our normal specs with all versions of rspec
9
+ if rspec_version_defined; then
10
+ run_specs_as_version
11
+ else
12
+ run_specs_and_record_done
13
+ run_cukes
10
14
 
11
- if documentation_enforced; then
12
- check_documentation_coverage
15
+ if documentation_enforced; then
16
+ check_documentation_coverage
17
+ fi
13
18
  fi
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rspec", :github => "rspec/rspec", :branch => ENV['RSPEC_VERSION']
4
+ %w[core mocks expectations support].each do |name|
5
+ gem "rspec-#{name}", :github => "rspec/rspec-#{name}", :branch => ENV['RSPEC_VERSION']
6
+ end
7
+
8
+ gem 'rspec-legacy_formatters', path: '../'
9
+ gem 'nyan-cat-formatter', '0.5.2'
@@ -0,0 +1,11 @@
1
+ RSpec.configure { |c| c.failure_exit_code = 42 }
2
+
3
+ RSpec.describe 'Prove that legacy formatters runs on this version' do
4
+ specify "success for #{ENV['RSPEC_VERSION']}" do
5
+ expect(true).to be true
6
+ end
7
+
8
+ specify "failure for #{ENV['RSPEC_VERSION']}" do
9
+ expect(true).to be false
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ require 'rspec/support/spec'
2
+
3
+ require 'rspec/core/formatters/console_codes'
4
+
5
+ # This MUST be loaded early, before rspec-core's formatters are loaded.
6
+ require 'rspec/legacy_formatters'
7
+
8
+ Dir['../spec/support/**/*.rb'].map { |f| require f }
@@ -42,6 +42,7 @@ module FormatterSupport
42
42
  def example
43
43
  instance_double("RSpec::Core::Example",
44
44
  :description => "Example",
45
+ :example_group => group,
45
46
  :full_description => "Example",
46
47
  :execution_result => instance_double(RSpec::Core::Example::ExecutionResult, :exception => Exception.new).as_null_object ,
47
48
  :metadata => {}
@@ -49,7 +50,12 @@ module FormatterSupport
49
50
  end
50
51
 
51
52
  def group
52
- class_double "RSpec::Core::ExampleGroup", :description => "Group"
53
+ class_double(
54
+ "RSpec::Core::ExampleGroup",
55
+ :description => "Group",
56
+ :parent_groups => [],
57
+ :top_level? => false
58
+ )
53
59
  end
54
60
 
55
61
  def start_notification(count)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-legacy_formatters
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Rowe
@@ -43,7 +43,7 @@ cert_chain:
43
43
  ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
44
44
  F3MdtaDehhjC
45
45
  -----END CERTIFICATE-----
46
- date: 2015-11-06 00:00:00.000000000 Z
46
+ date: 2019-09-18 00:00:00.000000000 Z
47
47
  dependencies:
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rspec
@@ -214,12 +214,15 @@ files:
214
214
  - rspec-legacy_formatters.gemspec
215
215
  - script/functions.sh
216
216
  - script/run_build
217
+ - smoke_specs/Gemfile
218
+ - smoke_specs/spec/sample_spec.rb
219
+ - smoke_specs/spec/spec_helper.rb
217
220
  - spec/rspec/legacy_formatters_spec.rb
218
221
  - spec/spec_helper.rb
219
222
  - spec/support/formatter_support.rb
220
223
  - spec/support/legacy_formatter_using_sub_classing_example.rb
221
224
  - spec/support/old_style_formatter_example.rb
222
- homepage: http://github.com/rspec/rspec-legacy_formatters
225
+ homepage: https://github.com/rspec/rspec-legacy_formatters
223
226
  licenses:
224
227
  - MIT
225
228
  metadata: {}
@@ -239,9 +242,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
242
  - !ruby/object:Gem::Version
240
243
  version: '0'
241
244
  requirements: []
242
- rubyforge_project:
243
- rubygems_version: 2.2.2
245
+ rubygems_version: 3.0.3
244
246
  signing_key:
245
247
  specification_version: 4
246
- summary: rspec-legacy_formatters-1.0.1
248
+ summary: rspec-legacy_formatters-1.0.2
247
249
  test_files: []
metadata.gz.sig CHANGED
Binary file