From 1f9e3b5c806528aa5ac7e585acdd4ce9c880a57b Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Tue, 9 Mar 2021 08:12:33 +0000 Subject: [PATCH 1/4] Fix changelog --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index eba927756..3c8b7c6be 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,5 @@ ### 5.0.0 / 2021-03-09 -[Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.1.1...main) +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.1.1...v5.0.0) Enhancements: From 1195037da1f8d849354ecf71ed5ea4c68dc5caa7 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Wed, 17 Mar 2021 20:57:22 +0000 Subject: [PATCH 2/4] Update readme to refer to 5.0 --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b5098a326..0801aa776 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ They’re also specifications (or _specs,_ for short): detailed explanations of how the application is supposed to behave, expressed in plain English. +Use **[`rspec-rails` 4.x][]** for Rails from 5.0 to 6.0. Use **[`rspec-rails` 3.x][]** for Rails earlier than 5.0. Use **[`rspec-rails` 1.x][]** for Rails 2.x. @@ -21,19 +22,20 @@ Use **[`rspec-rails` 1.x][]** for Rails 2.x. [Ruby on Rails]: https://rubyonrails.org/ [`rspec-rails` 1.x]: https://github.com/dchelimsky/rspec-rails [`rspec-rails` 3.x]: https://github.com/rspec/rspec-rails/tree/3-9-maintenance +[`rspec-rails` 4.x]: https://github.com/rspec/rspec-rails/tree/4-1-maintenance ## Installation -**IMPORTANT** This README / branch refers to the current development build. -See the [`4-1-maintenance` branch on Github](https://github.com/rspec/rspec-rails/tree/4-0-maintenance) if you want or require the latest stable release. +**IMPORTANT** This README / branch refers to the 5.0.x series of releases. +See the [`main` branch on Github](https://github.com/rspec/rspec-rails/tree/main) for more up to date releases. 1. Add `rspec-rails` to **both** the `:development` and `:test` groups of your app’s `Gemfile`: ```ruby - # Run against the latest stable release + # Run against this stable release group :development, :test do - gem 'rspec-rails', '~> 4.1.0' + gem 'rspec-rails', '~> 5.0.0' end # Or, run against the main branch From 3e9cbeabfe7d329b17cb602ebba65b8264c733e6 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Wed, 17 Mar 2021 08:54:09 +0000 Subject: [PATCH 3/4] Merge pull request #2487 from rspec/fix-method-name-truncation-for-multibyte-strings Fix method name truncation for multibyte strings (redux) --- Changelog.md | 8 ++++++++ lib/rspec/rails/example/system_example_group.rb | 2 +- .../rspec/rails/example/system_example_group_spec.rb | 12 ++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 3c8b7c6be..84d8436d4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,11 @@ +### Development +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.0...main) + +Bug Fixes: + +* Limit multibyte example descriptions when used in system tests for #method_name + which ends up as screenshot names etc. (@y-yagi, #2405, #2487) + ### 5.0.0 / 2021-03-09 [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.1.1...v5.0.0) diff --git a/lib/rspec/rails/example/system_example_group.rb b/lib/rspec/rails/example/system_example_group.rb index 59c5606cc..e0f395bce 100644 --- a/lib/rspec/rails/example/system_example_group.rb +++ b/lib/rspec/rails/example/system_example_group.rb @@ -41,7 +41,7 @@ def method_name @method_name ||= [ self.class.name.underscore, RSpec.current_example.description.underscore - ].join("_").tr(CHARS_TO_TRANSLATE.join, "_")[0...200] + "_#{rand(1000)}" + ].join("_").tr(CHARS_TO_TRANSLATE.join, "_").byteslice(0...200).scrub("") + "_#{rand(1000)}" end # Delegates to `Rails.application`. diff --git a/spec/rspec/rails/example/system_example_group_spec.rb b/spec/rspec/rails/example/system_example_group_spec.rb index 533bf79d6..cd5328e2b 100644 --- a/spec/rspec/rails/example/system_example_group_spec.rb +++ b/spec/rspec/rails/example/system_example_group_spec.rb @@ -15,6 +15,18 @@ module RSpec::Rails expect(example.send(:method_name)).to start_with('method_name') end end + + it "handles long method names which include unicode characters" do + group = + RSpec::Core::ExampleGroup.describe do + include SystemExampleGroup + end + + example = group.new + allow(example.class).to receive(:name) { "really long unicode example name - #{'あ'*100}" } + + expect(example.send(:method_name).bytesize).to be <= 210 + end end describe '#driver' do From 4a820db8bf87dc470fab2037ebe3cfe36dd76611 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 18 Mar 2021 12:47:33 +0000 Subject: [PATCH 4/4] v5.0.1 --- Changelog.md | 5 ++++- lib/rspec/rails/version.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 84d8436d4..e35ad1bb6 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ ### Development -[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.0...main) +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.1...5-0-maintenance) + +### 5.0.1 / 2021-03-18 +[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.0...v5.0.1) Bug Fixes: diff --git a/lib/rspec/rails/version.rb b/lib/rspec/rails/version.rb index b6d08fd8b..bbabf5b91 100644 --- a/lib/rspec/rails/version.rb +++ b/lib/rspec/rails/version.rb @@ -3,7 +3,7 @@ module Rails # Version information for RSpec Rails. module Version # Current version of RSpec Rails, in semantic versioning format. - STRING = '5.0.0' + STRING = '5.0.1' end end end