Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passing --filter="...." correctly escapes the spaces into "%20" and not "+" #595

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/teaspoon/console.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "teaspoon/environment"
require "teaspoon/utility"
require "erb"

module Teaspoon
class Console
Expand Down Expand Up @@ -108,7 +109,10 @@ def url_for(suite, console = true)

def filter(suite)
parts = []
parts << "grep=#{CGI.escape(options[:filter])}" if options[:filter].present?
# Using ERB::Util.url_encode instead of CGI.escape as CGI.escape will convert
# the space ' ' into a '+' and not into "%20". The JS on the front end expects
# %20
parts << "grep=#{ERB::Util.url_encode(options[:filter])}" if options[:filter].present?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that seems to make sense

(@suites[suite] || options[:files] || []).flatten.each { |file| parts << "file[]=#{CGI.escape(file)}" }
"#{parts.join('&')}" if parts.present?
end
Expand Down
5 changes: 3 additions & 2 deletions teaspoon.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Gem::Specification.new do |s|
s.files = Dir["{app,lib,bin}/**/*"] + ["MIT.LICENSE", "README.md", "CHANGELOG.md"]
s.executables = ["teaspoon"]

s.required_ruby_version = ">= 2.5"
s.add_dependency "railties", ">= 4.2.11"
s.required_ruby_version = ">= 2.4"
s.add_dependency "railties", ">= 3.2.5"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why allowing ruby 2.4 and rails 3.2 ?

s.add_dependency "erb"
s.add_development_dependency "simplecov", "< 0.18"
end