summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2025-05-08 19:41:20 +0900
committerHiroshi SHIBATA <[email protected]>2025-05-09 14:27:28 +0900
commitce6c1778fb90f9685f9e790f111184d622f981be (patch)
treeea453918436bf8252385481bc769c775d30842a6
parent600c616507b258cdf9dbfbc822deb267f3202325 (diff)
Guard CGI examples with Ruby 3.5 and use cgi/escape for related examples
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13275
-rw-r--r--spec/ruby/library/cgi/cookie/domain_spec.rb33
-rw-r--r--spec/ruby/library/cgi/cookie/expires_spec.rb33
-rw-r--r--spec/ruby/library/cgi/cookie/initialize_spec.rb235
-rw-r--r--spec/ruby/library/cgi/cookie/name_spec.rb33
-rw-r--r--spec/ruby/library/cgi/cookie/parse_spec.rb41
-rw-r--r--spec/ruby/library/cgi/cookie/path_spec.rb33
-rw-r--r--spec/ruby/library/cgi/cookie/secure_spec.rb99
-rw-r--r--spec/ruby/library/cgi/cookie/to_s_spec.rb51
-rw-r--r--spec/ruby/library/cgi/cookie/value_spec.rb121
-rw-r--r--spec/ruby/library/cgi/escapeElement_spec.rb6
-rw-r--r--spec/ruby/library/cgi/escapeHTML_spec.rb6
-rw-r--r--spec/ruby/library/cgi/escapeURIComponent_spec.rb6
-rw-r--r--spec/ruby/library/cgi/escape_spec.rb6
-rw-r--r--spec/ruby/library/cgi/htmlextension/a_spec.rb73
-rw-r--r--spec/ruby/library/cgi/htmlextension/base_spec.rb47
-rw-r--r--spec/ruby/library/cgi/htmlextension/blockquote_spec.rb47
-rw-r--r--spec/ruby/library/cgi/htmlextension/br_spec.rb31
-rw-r--r--spec/ruby/library/cgi/htmlextension/caption_spec.rb47
-rw-r--r--spec/ruby/library/cgi/htmlextension/checkbox_group_spec.rb121
-rw-r--r--spec/ruby/library/cgi/htmlextension/checkbox_spec.rb113
-rw-r--r--spec/ruby/library/cgi/htmlextension/doctype_spec.rb41
-rw-r--r--spec/ruby/library/cgi/htmlextension/file_field_spec.rb105
-rw-r--r--spec/ruby/library/cgi/htmlextension/form_spec.rb85
-rw-r--r--spec/ruby/library/cgi/htmlextension/frame_spec.rb21
-rw-r--r--spec/ruby/library/cgi/htmlextension/frameset_spec.rb21
-rw-r--r--spec/ruby/library/cgi/htmlextension/hidden_spec.rb87
-rw-r--r--spec/ruby/library/cgi/htmlextension/html_spec.rb99
-rw-r--r--spec/ruby/library/cgi/htmlextension/image_button_spec.rb101
-rw-r--r--spec/ruby/library/cgi/htmlextension/img_spec.rb123
-rw-r--r--spec/ruby/library/cgi/htmlextension/multipart_form_spec.rb93
-rw-r--r--spec/ruby/library/cgi/htmlextension/password_field_spec.rb123
-rw-r--r--spec/ruby/library/cgi/htmlextension/popup_menu_spec.rb13
-rw-r--r--spec/ruby/library/cgi/htmlextension/radio_button_spec.rb113
-rw-r--r--spec/ruby/library/cgi/htmlextension/radio_group_spec.rb123
-rw-r--r--spec/ruby/library/cgi/htmlextension/reset_spec.rb83
-rw-r--r--spec/ruby/library/cgi/htmlextension/scrolling_list_spec.rb13
-rw-r--r--spec/ruby/library/cgi/htmlextension/submit_spec.rb83
-rw-r--r--spec/ruby/library/cgi/htmlextension/text_field_spec.rb123
-rw-r--r--spec/ruby/library/cgi/htmlextension/textarea_spec.rb107
-rw-r--r--spec/ruby/library/cgi/http_header_spec.rb11
-rw-r--r--spec/ruby/library/cgi/initialize_spec.rb209
-rw-r--r--spec/ruby/library/cgi/out_spec.rb97
-rw-r--r--spec/ruby/library/cgi/parse_spec.rb37
-rw-r--r--spec/ruby/library/cgi/pretty_spec.rb19
-rw-r--r--spec/ruby/library/cgi/print_spec.rb39
-rw-r--r--spec/ruby/library/cgi/queryextension/accept_charset_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/accept_encoding_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/accept_language_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/accept_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/auth_type_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/cache_control_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/content_length_spec.rb39
-rw-r--r--spec/ruby/library/cgi/queryextension/content_type_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/cookies_spec.rb15
-rw-r--r--spec/ruby/library/cgi/queryextension/element_reference_spec.rb41
-rw-r--r--spec/ruby/library/cgi/queryextension/from_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/gateway_interface_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/has_key_spec.rb11
-rw-r--r--spec/ruby/library/cgi/queryextension/host_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/include_spec.rb11
-rw-r--r--spec/ruby/library/cgi/queryextension/key_spec.rb11
-rw-r--r--spec/ruby/library/cgi/queryextension/keys_spec.rb29
-rw-r--r--spec/ruby/library/cgi/queryextension/multipart_spec.rb47
-rw-r--r--spec/ruby/library/cgi/queryextension/negotiate_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/params_spec.rb55
-rw-r--r--spec/ruby/library/cgi/queryextension/path_info_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/path_translated_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/pragma_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/query_string_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/raw_cookie2_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/raw_cookie_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/referer_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/remote_addr_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/remote_host_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/remote_ident_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/remote_user_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/request_method_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/script_name_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/server_name_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/server_port_spec.rb39
-rw-r--r--spec/ruby/library/cgi/queryextension/server_protocol_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/server_software_spec.rb33
-rw-r--r--spec/ruby/library/cgi/queryextension/user_agent_spec.rb33
-rw-r--r--spec/ruby/library/cgi/rfc1123_date_spec.rb15
-rw-r--r--spec/ruby/library/cgi/unescapeElement_spec.rb6
-rw-r--r--spec/ruby/library/cgi/unescapeHTML_spec.rb6
-rw-r--r--spec/ruby/library/cgi/unescape_spec.rb6
87 files changed, 2337 insertions, 2069 deletions
diff --git a/spec/ruby/library/cgi/cookie/domain_spec.rb b/spec/ruby/library/cgi/cookie/domain_spec.rb
index 962609ebaf..622549039f 100644
--- a/spec/ruby/library/cgi/cookie/domain_spec.rb
+++ b/spec/ruby/library/cgi/cookie/domain_spec.rb
@@ -1,23 +1,26 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::Cookie#domain" do
- it "returns self's domain" do
- cookie = CGI::Cookie.new("test-cookie")
- cookie.domain.should be_nil
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- cookie = CGI::Cookie.new("name" => "test-cookie", "domain" => "example.com")
- cookie.domain.should == "example.com"
+ describe "CGI::Cookie#domain" do
+ it "returns self's domain" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.domain.should be_nil
+
+ cookie = CGI::Cookie.new("name" => "test-cookie", "domain" => "example.com")
+ cookie.domain.should == "example.com"
+ end
end
-end
-describe "CGI::Cookie#domain=" do
- it "sets self's domain" do
- cookie = CGI::Cookie.new("test-cookie")
- cookie.domain = "test.com"
- cookie.domain.should == "test.com"
+ describe "CGI::Cookie#domain=" do
+ it "sets self's domain" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.domain = "test.com"
+ cookie.domain.should == "test.com"
- cookie.domain = "example.com"
- cookie.domain.should == "example.com"
+ cookie.domain = "example.com"
+ cookie.domain.should == "example.com"
+ end
end
end
diff --git a/spec/ruby/library/cgi/cookie/expires_spec.rb b/spec/ruby/library/cgi/cookie/expires_spec.rb
index c8f26d01cd..df52a6f41e 100644
--- a/spec/ruby/library/cgi/cookie/expires_spec.rb
+++ b/spec/ruby/library/cgi/cookie/expires_spec.rb
@@ -1,23 +1,26 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::Cookie#expires" do
- it "returns self's expiration date" do
- cookie = CGI::Cookie.new("test-cookie")
- cookie.expires.should be_nil
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- cookie = CGI::Cookie.new("name" => "test-cookie", "expires" => Time.at(1196524602))
- cookie.expires.should == Time.at(1196524602)
+ describe "CGI::Cookie#expires" do
+ it "returns self's expiration date" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.expires.should be_nil
+
+ cookie = CGI::Cookie.new("name" => "test-cookie", "expires" => Time.at(1196524602))
+ cookie.expires.should == Time.at(1196524602)
+ end
end
-end
-describe "CGI::Cookie#expires=" do
- it "sets self's expiration date" do
- cookie = CGI::Cookie.new("test-cookie")
- cookie.expires = Time.at(1196524602)
- cookie.expires.should == Time.at(1196524602)
+ describe "CGI::Cookie#expires=" do
+ it "sets self's expiration date" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.expires = Time.at(1196524602)
+ cookie.expires.should == Time.at(1196524602)
- cookie.expires = Time.at(1196525000)
- cookie.expires.should == Time.at(1196525000)
+ cookie.expires = Time.at(1196525000)
+ cookie.expires.should == Time.at(1196525000)
+ end
end
end
diff --git a/spec/ruby/library/cgi/cookie/initialize_spec.rb b/spec/ruby/library/cgi/cookie/initialize_spec.rb
index 4b6e104b10..ac99d5e4fd 100644
--- a/spec/ruby/library/cgi/cookie/initialize_spec.rb
+++ b/spec/ruby/library/cgi/cookie/initialize_spec.rb
@@ -1,147 +1,150 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::Cookie#initialize when passed String" do
- before :each do
- @cookie = CGI::Cookie.allocate
- end
-
- it "sets the self's name to the passed String" do
- @cookie.send(:initialize, "test-cookie")
- @cookie.name.should == "test-cookie"
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- it "sets the self's value to an empty Array" do
- @cookie.send(:initialize, "test-cookie")
- @cookie.value.should == []
- end
-
- it "sets self to a non-secure cookie" do
- @cookie.send(:initialize, "test")
- @cookie.secure.should be_false
- end
-
- it "does set self's path to an empty String when ENV[\"SCRIPT_NAME\"] is not set" do
- @cookie.send(:initialize, "test-cookie")
- @cookie.path.should == ""
- end
-
- it "does set self's path based on ENV[\"SCRIPT_NAME\"] when ENV[\"SCRIPT_NAME\"] is set" do
- old_script_name = ENV["SCRIPT_NAME"]
+ describe "CGI::Cookie#initialize when passed String" do
+ before :each do
+ @cookie = CGI::Cookie.allocate
+ end
- begin
- ENV["SCRIPT_NAME"] = "some/path/script.rb"
+ it "sets the self's name to the passed String" do
@cookie.send(:initialize, "test-cookie")
- @cookie.path.should == "some/path/"
+ @cookie.name.should == "test-cookie"
+ end
- ENV["SCRIPT_NAME"] = "script.rb"
+ it "sets the self's value to an empty Array" do
@cookie.send(:initialize, "test-cookie")
- @cookie.path.should == ""
+ @cookie.value.should == []
+ end
- ENV["SCRIPT_NAME"] = nil
+ it "sets self to a non-secure cookie" do
+ @cookie.send(:initialize, "test")
+ @cookie.secure.should be_false
+ end
+
+ it "does set self's path to an empty String when ENV[\"SCRIPT_NAME\"] is not set" do
@cookie.send(:initialize, "test-cookie")
@cookie.path.should == ""
- ensure
- ENV["SCRIPT_NAME"] = old_script_name
end
- end
- it "does not set self's expiration date" do
- @cookie.expires.should be_nil
- end
+ it "does set self's path based on ENV[\"SCRIPT_NAME\"] when ENV[\"SCRIPT_NAME\"] is set" do
+ old_script_name = ENV["SCRIPT_NAME"]
- it "does not set self's domain" do
- @cookie.domain.should be_nil
- end
-end
+ begin
+ ENV["SCRIPT_NAME"] = "some/path/script.rb"
+ @cookie.send(:initialize, "test-cookie")
+ @cookie.path.should == "some/path/"
-describe "CGI::Cookie#initialize when passed Hash" do
- before :each do
- @cookie = CGI::Cookie.allocate
- end
+ ENV["SCRIPT_NAME"] = "script.rb"
+ @cookie.send(:initialize, "test-cookie")
+ @cookie.path.should == ""
+
+ ENV["SCRIPT_NAME"] = nil
+ @cookie.send(:initialize, "test-cookie")
+ @cookie.path.should == ""
+ ensure
+ ENV["SCRIPT_NAME"] = old_script_name
+ end
+ end
+
+ it "does not set self's expiration date" do
+ @cookie.expires.should be_nil
+ end
- it "sets self's contents based on the passed Hash" do
- @cookie.send(:initialize,
- 'name' => 'test-cookie',
- 'value' => ["one", "two", "three"],
- 'path' => 'some/path/',
- 'domain' => 'example.com',
- 'expires' => Time.at(1196524602),
- 'secure' => true)
-
- @cookie.name.should == "test-cookie"
- @cookie.value.should == ["one", "two", "three"]
- @cookie.path.should == "some/path/"
- @cookie.domain.should == "example.com"
- @cookie.expires.should == Time.at(1196524602)
- @cookie.secure.should be_true
+ it "does not set self's domain" do
+ @cookie.domain.should be_nil
+ end
end
- it "does set self's path based on ENV[\"SCRIPT_NAME\"] when the Hash has no 'path' entry" do
- old_script_name = ENV["SCRIPT_NAME"]
+ describe "CGI::Cookie#initialize when passed Hash" do
+ before :each do
+ @cookie = CGI::Cookie.allocate
+ end
- begin
- ENV["SCRIPT_NAME"] = "some/path/script.rb"
- @cookie.send(:initialize, 'name' => 'test-cookie')
+ it "sets self's contents based on the passed Hash" do
+ @cookie.send(:initialize,
+ 'name' => 'test-cookie',
+ 'value' => ["one", "two", "three"],
+ 'path' => 'some/path/',
+ 'domain' => 'example.com',
+ 'expires' => Time.at(1196524602),
+ 'secure' => true)
+
+ @cookie.name.should == "test-cookie"
+ @cookie.value.should == ["one", "two", "three"]
@cookie.path.should == "some/path/"
+ @cookie.domain.should == "example.com"
+ @cookie.expires.should == Time.at(1196524602)
+ @cookie.secure.should be_true
+ end
- ENV["SCRIPT_NAME"] = "script.rb"
- @cookie.send(:initialize, 'name' => 'test-cookie')
- @cookie.path.should == ""
+ it "does set self's path based on ENV[\"SCRIPT_NAME\"] when the Hash has no 'path' entry" do
+ old_script_name = ENV["SCRIPT_NAME"]
- ENV["SCRIPT_NAME"] = nil
- @cookie.send(:initialize, 'name' => 'test-cookie')
- @cookie.path.should == ""
- ensure
- ENV["SCRIPT_NAME"] = old_script_name
+ begin
+ ENV["SCRIPT_NAME"] = "some/path/script.rb"
+ @cookie.send(:initialize, 'name' => 'test-cookie')
+ @cookie.path.should == "some/path/"
+
+ ENV["SCRIPT_NAME"] = "script.rb"
+ @cookie.send(:initialize, 'name' => 'test-cookie')
+ @cookie.path.should == ""
+
+ ENV["SCRIPT_NAME"] = nil
+ @cookie.send(:initialize, 'name' => 'test-cookie')
+ @cookie.path.should == ""
+ ensure
+ ENV["SCRIPT_NAME"] = old_script_name
+ end
end
- end
- it "tries to convert the Hash's 'value' to an Array using #Array" do
- obj = mock("Converted To Array")
- obj.should_receive(:to_ary).and_return(["1", "2", "3"])
- @cookie.send(:initialize,
- 'name' => 'test-cookie',
- 'value' => obj)
- @cookie.value.should == [ "1", "2", "3" ]
-
- obj = mock("Converted To Array")
- obj.should_receive(:to_a).and_return(["one", "two", "three"])
- @cookie.send(:initialize,
- 'name' => 'test-cookie',
- 'value' => obj)
- @cookie.value.should == [ "one", "two", "three" ]
-
- obj = mock("Put into an Array")
- @cookie.send(:initialize,
- 'name' => 'test-cookie',
- 'value' => obj)
- @cookie.value.should == [ obj ]
- end
+ it "tries to convert the Hash's 'value' to an Array using #Array" do
+ obj = mock("Converted To Array")
+ obj.should_receive(:to_ary).and_return(["1", "2", "3"])
+ @cookie.send(:initialize,
+ 'name' => 'test-cookie',
+ 'value' => obj)
+ @cookie.value.should == [ "1", "2", "3" ]
+
+ obj = mock("Converted To Array")
+ obj.should_receive(:to_a).and_return(["one", "two", "three"])
+ @cookie.send(:initialize,
+ 'name' => 'test-cookie',
+ 'value' => obj)
+ @cookie.value.should == [ "one", "two", "three" ]
+
+ obj = mock("Put into an Array")
+ @cookie.send(:initialize,
+ 'name' => 'test-cookie',
+ 'value' => obj)
+ @cookie.value.should == [ obj ]
+ end
- it "raises a ArgumentError when the passed Hash has no 'name' entry" do
- -> { @cookie.send(:initialize, {}) }.should raise_error(ArgumentError)
- -> { @cookie.send(:initialize, "value" => "test") }.should raise_error(ArgumentError)
+ it "raises a ArgumentError when the passed Hash has no 'name' entry" do
+ -> { @cookie.send(:initialize, {}) }.should raise_error(ArgumentError)
+ -> { @cookie.send(:initialize, "value" => "test") }.should raise_error(ArgumentError)
+ end
end
-end
-describe "CGI::Cookie#initialize when passed String, values ..." do
- before :each do
- @cookie = CGI::Cookie.allocate
- end
+ describe "CGI::Cookie#initialize when passed String, values ..." do
+ before :each do
+ @cookie = CGI::Cookie.allocate
+ end
- it "sets the self's name to the passed String" do
- @cookie.send(:initialize, "test-cookie", "one", "two", "three")
- @cookie.name.should == "test-cookie"
- end
+ it "sets the self's name to the passed String" do
+ @cookie.send(:initialize, "test-cookie", "one", "two", "three")
+ @cookie.name.should == "test-cookie"
+ end
- it "sets the self's value to an Array containing all passed values" do
- @cookie.send(:initialize, "test-cookie", "one", "two", "three")
- @cookie.value.should == ["one", "two", "three"]
- end
+ it "sets the self's value to an Array containing all passed values" do
+ @cookie.send(:initialize, "test-cookie", "one", "two", "three")
+ @cookie.value.should == ["one", "two", "three"]
+ end
- it "sets self to a non-secure cookie" do
- @cookie.send(:initialize, "test", "one", "two", "three")
- @cookie.secure.should be_false
+ it "sets self to a non-secure cookie" do
+ @cookie.send(:initialize, "test", "one", "two", "three")
+ @cookie.secure.should be_false
+ end
end
end
diff --git a/spec/ruby/library/cgi/cookie/name_spec.rb b/spec/ruby/library/cgi/cookie/name_spec.rb
index 326a43ade3..712628180b 100644
--- a/spec/ruby/library/cgi/cookie/name_spec.rb
+++ b/spec/ruby/library/cgi/cookie/name_spec.rb
@@ -1,23 +1,26 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::Cookie#name" do
- it "returns self's name" do
- cookie = CGI::Cookie.new("test-cookie")
- cookie.name.should == "test-cookie"
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- cookie = CGI::Cookie.new("name" => "another-cookie")
- cookie.name.should == "another-cookie"
+ describe "CGI::Cookie#name" do
+ it "returns self's name" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.name.should == "test-cookie"
+
+ cookie = CGI::Cookie.new("name" => "another-cookie")
+ cookie.name.should == "another-cookie"
+ end
end
-end
-describe "CGI::Cookie#name=" do
- it "sets self's expiration date" do
- cookie = CGI::Cookie.new("test-cookie")
- cookie.name = "another-name"
- cookie.name.should == "another-name"
+ describe "CGI::Cookie#name=" do
+ it "sets self's expiration date" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.name = "another-name"
+ cookie.name.should == "another-name"
- cookie.name = "and-one-more"
- cookie.name.should == "and-one-more"
+ cookie.name = "and-one-more"
+ cookie.name.should == "and-one-more"
+ end
end
end
diff --git a/spec/ruby/library/cgi/cookie/parse_spec.rb b/spec/ruby/library/cgi/cookie/parse_spec.rb
index d484c7bad9..ecc78d77dc 100644
--- a/spec/ruby/library/cgi/cookie/parse_spec.rb
+++ b/spec/ruby/library/cgi/cookie/parse_spec.rb
@@ -1,26 +1,29 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::Cookie.parse" do
- it "parses a raw cookie string into a hash of Cookies" do
- expected = { "test-cookie" => ["one", "two", "three"] }
- CGI::Cookie.parse("test-cookie=one&two&three").should == expected
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- expected = { "second-cookie" => ["three", "four"], "first-cookie" => ["one", "two"] }
- CGI::Cookie.parse("first-cookie=one&two;second-cookie=three&four").should == expected
- end
+ describe "CGI::Cookie.parse" do
+ it "parses a raw cookie string into a hash of Cookies" do
+ expected = { "test-cookie" => ["one", "two", "three"] }
+ CGI::Cookie.parse("test-cookie=one&two&three").should == expected
- it "does not use , for cookie separators" do
- expected = {
- "first-cookie" => ["one", "two"],
- "second-cookie" => ["three", "four,third_cookie=five", "six"]
- }
- CGI::Cookie.parse("first-cookie=one&two;second-cookie=three&four,third_cookie=five&six").should == expected
- end
+ expected = { "second-cookie" => ["three", "four"], "first-cookie" => ["one", "two"] }
+ CGI::Cookie.parse("first-cookie=one&two;second-cookie=three&four").should == expected
+ end
+
+ it "does not use , for cookie separators" do
+ expected = {
+ "first-cookie" => ["one", "two"],
+ "second-cookie" => ["three", "four,third_cookie=five", "six"]
+ }
+ CGI::Cookie.parse("first-cookie=one&two;second-cookie=three&four,third_cookie=five&six").should == expected
+ end
- it "unescapes the Cookie values" do
- cookie = "test-cookie=+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E"
- expected = { "test-cookie" => [ " !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ] }
- CGI::Cookie.parse(cookie).should == expected
+ it "unescapes the Cookie values" do
+ cookie = "test-cookie=+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E"
+ expected = { "test-cookie" => [ " !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ] }
+ CGI::Cookie.parse(cookie).should == expected
+ end
end
end
diff --git a/spec/ruby/library/cgi/cookie/path_spec.rb b/spec/ruby/library/cgi/cookie/path_spec.rb
index 8a2f05aa50..010e87a6b8 100644
--- a/spec/ruby/library/cgi/cookie/path_spec.rb
+++ b/spec/ruby/library/cgi/cookie/path_spec.rb
@@ -1,23 +1,26 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::Cookie#path" do
- it "returns self's path" do
- cookie = CGI::Cookie.new("test-cookie")
- cookie.path.should == ""
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- cookie = CGI::Cookie.new("name" => "test-cookie", "path" => "/some/path/")
- cookie.path.should == "/some/path/"
+ describe "CGI::Cookie#path" do
+ it "returns self's path" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.path.should == ""
+
+ cookie = CGI::Cookie.new("name" => "test-cookie", "path" => "/some/path/")
+ cookie.path.should == "/some/path/"
+ end
end
-end
-describe "CGI::Cookie#path=" do
- it "sets self's path" do
- cookie = CGI::Cookie.new("test-cookie")
- cookie.path = "/some/path/"
- cookie.path.should == "/some/path/"
+ describe "CGI::Cookie#path=" do
+ it "sets self's path" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.path = "/some/path/"
+ cookie.path.should == "/some/path/"
- cookie.path = "/another/path/"
- cookie.path.should == "/another/path/"
+ cookie.path = "/another/path/"
+ cookie.path.should == "/another/path/"
+ end
end
end
diff --git a/spec/ruby/library/cgi/cookie/secure_spec.rb b/spec/ruby/library/cgi/cookie/secure_spec.rb
index 694bc2eeed..b526897250 100644
--- a/spec/ruby/library/cgi/cookie/secure_spec.rb
+++ b/spec/ruby/library/cgi/cookie/secure_spec.rb
@@ -1,70 +1,73 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::Cookie#secure" do
- before :each do
- @cookie = CGI::Cookie.new("test-cookie")
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- it "returns whether self is a secure cookie or not" do
- @cookie.secure = true
- @cookie.secure.should be_true
+ describe "CGI::Cookie#secure" do
+ before :each do
+ @cookie = CGI::Cookie.new("test-cookie")
+ end
- @cookie.secure = false
- @cookie.secure.should be_false
- end
-end
+ it "returns whether self is a secure cookie or not" do
+ @cookie.secure = true
+ @cookie.secure.should be_true
-describe "CGI::Cookie#secure= when passed true" do
- before :each do
- @cookie = CGI::Cookie.new("test-cookie")
+ @cookie.secure = false
+ @cookie.secure.should be_false
+ end
end
- it "returns true" do
- (@cookie.secure = true).should be_true
- end
+ describe "CGI::Cookie#secure= when passed true" do
+ before :each do
+ @cookie = CGI::Cookie.new("test-cookie")
+ end
- it "sets self to a secure cookie" do
- @cookie.secure = true
- @cookie.secure.should be_true
- end
-end
+ it "returns true" do
+ (@cookie.secure = true).should be_true
+ end
-describe "CGI::Cookie#secure= when passed false" do
- before :each do
- @cookie = CGI::Cookie.new("test-cookie")
+ it "sets self to a secure cookie" do
+ @cookie.secure = true
+ @cookie.secure.should be_true
+ end
end
- it "returns false" do
- (@cookie.secure = false).should be_false
- end
+ describe "CGI::Cookie#secure= when passed false" do
+ before :each do
+ @cookie = CGI::Cookie.new("test-cookie")
+ end
- it "sets self to a non-secure cookie" do
- @cookie.secure = false
- @cookie.secure.should be_false
- end
-end
+ it "returns false" do
+ (@cookie.secure = false).should be_false
+ end
-describe "CGI::Cookie#secure= when passed Object" do
- before :each do
- @cookie = CGI::Cookie.new("test-cookie")
+ it "sets self to a non-secure cookie" do
+ @cookie.secure = false
+ @cookie.secure.should be_false
+ end
end
- it "does not change self's secure value" do
- @cookie.secure = false
+ describe "CGI::Cookie#secure= when passed Object" do
+ before :each do
+ @cookie = CGI::Cookie.new("test-cookie")
+ end
+
+ it "does not change self's secure value" do
+ @cookie.secure = false
- @cookie.secure = Object.new
- @cookie.secure.should be_false
+ @cookie.secure = Object.new
+ @cookie.secure.should be_false
- @cookie.secure = "Test"
- @cookie.secure.should be_false
+ @cookie.secure = "Test"
+ @cookie.secure.should be_false
- @cookie.secure = true
+ @cookie.secure = true
- @cookie.secure = Object.new
- @cookie.secure.should be_true
+ @cookie.secure = Object.new
+ @cookie.secure.should be_true
- @cookie.secure = "Test"
- @cookie.secure.should be_true
+ @cookie.secure = "Test"
+ @cookie.secure.should be_true
+ end
end
end
diff --git a/spec/ruby/library/cgi/cookie/to_s_spec.rb b/spec/ruby/library/cgi/cookie/to_s_spec.rb
index da15e6ed2a..34326f672b 100644
--- a/spec/ruby/library/cgi/cookie/to_s_spec.rb
+++ b/spec/ruby/library/cgi/cookie/to_s_spec.rb
@@ -1,33 +1,36 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::Cookie#to_s" do
- it "returns a String representation of self" do
- cookie = CGI::Cookie.new("test-cookie")
- cookie.to_s.should == "test-cookie=; path="
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- cookie = CGI::Cookie.new("test-cookie", "value")
- cookie.to_s.should == "test-cookie=value; path="
+ describe "CGI::Cookie#to_s" do
+ it "returns a String representation of self" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.to_s.should == "test-cookie=; path="
- cookie = CGI::Cookie.new("test-cookie", "one", "two", "three")
- cookie.to_s.should == "test-cookie=one&two&three; path="
+ cookie = CGI::Cookie.new("test-cookie", "value")
+ cookie.to_s.should == "test-cookie=value; path="
- cookie = CGI::Cookie.new(
- 'name' => 'test-cookie',
- 'value' => ["one", "two", "three"],
- 'path' => 'some/path/',
- 'domain' => 'example.com',
- 'expires' => Time.at(1196524602),
- 'secure' => true)
- cookie.to_s.should == "test-cookie=one&two&three; domain=example.com; path=some/path/; expires=Sat, 01 Dec 2007 15:56:42 GMT; secure"
- end
+ cookie = CGI::Cookie.new("test-cookie", "one", "two", "three")
+ cookie.to_s.should == "test-cookie=one&two&three; path="
- it "escapes the self's values" do
- cookie = CGI::Cookie.new("test-cookie", " !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}")
- cookie.to_s.should == "test-cookie=+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D; path="
- end
+ cookie = CGI::Cookie.new(
+ 'name' => 'test-cookie',
+ 'value' => ["one", "two", "three"],
+ 'path' => 'some/path/',
+ 'domain' => 'example.com',
+ 'expires' => Time.at(1196524602),
+ 'secure' => true)
+ cookie.to_s.should == "test-cookie=one&two&three; domain=example.com; path=some/path/; expires=Sat, 01 Dec 2007 15:56:42 GMT; secure"
+ end
+
+ it "escapes the self's values" do
+ cookie = CGI::Cookie.new("test-cookie", " !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}")
+ cookie.to_s.should == "test-cookie=+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D; path="
+ end
- it "does not escape tilde" do
- cookie = CGI::Cookie.new("test-cookie", "~").to_s.should == "test-cookie=~; path="
+ it "does not escape tilde" do
+ cookie = CGI::Cookie.new("test-cookie", "~").to_s.should == "test-cookie=~; path="
+ end
end
end
diff --git a/spec/ruby/library/cgi/cookie/value_spec.rb b/spec/ruby/library/cgi/cookie/value_spec.rb
index 1d5da3a3ac..e7c91b55b9 100644
--- a/spec/ruby/library/cgi/cookie/value_spec.rb
+++ b/spec/ruby/library/cgi/cookie/value_spec.rb
@@ -1,76 +1,79 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::Cookie#value" do
- it "returns self's value" do
- cookie = CGI::Cookie.new("test-cookie")
- cookie.value.should == []
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- cookie = CGI::Cookie.new("test-cookie", "one")
- cookie.value.should == ["one"]
+ describe "CGI::Cookie#value" do
+ it "returns self's value" do
+ cookie = CGI::Cookie.new("test-cookie")
+ cookie.value.should == []
- cookie = CGI::Cookie.new("test-cookie", "one", "two", "three")
- cookie.value.should == ["one", "two", "three"]
+ cookie = CGI::Cookie.new("test-cookie", "one")
+ cookie.value.should == ["one"]
- cookie = CGI::Cookie.new("name" => "test-cookie", "value" => ["one", "two", "three"])
- cookie.value.should == ["one", "two", "three"]
- end
+ cookie = CGI::Cookie.new("test-cookie", "one", "two", "three")
+ cookie.value.should == ["one", "two", "three"]
- it "is in synch with self" do
- fail = []
- [
- :pop,
- :shift,
- [:<<, "Hello"],
- [:push, "Hello"],
- [:unshift, "World"],
- [:replace, ["A", "B"]],
- [:[]=, 1, "Set"],
- [:delete, "first"],
- [:delete_at, 0],
- ].each do |method, *args|
- cookie1 = CGI::Cookie.new("test-cookie", "first", "second")
- cookie2 = CGI::Cookie.new("test-cookie", "first", "second")
- cookie1.send(method, *args)
- cookie2.value.send(method, *args)
- fail << method unless cookie1.value == cookie2.value
+ cookie = CGI::Cookie.new("name" => "test-cookie", "value" => ["one", "two", "three"])
+ cookie.value.should == ["one", "two", "three"]
end
- fail.should be_empty
- end
-end
-describe "CGI::Cookie#value=" do
- before :each do
- @cookie = CGI::Cookie.new("test-cookie")
+ it "is in synch with self" do
+ fail = []
+ [
+ :pop,
+ :shift,
+ [:<<, "Hello"],
+ [:push, "Hello"],
+ [:unshift, "World"],
+ [:replace, ["A", "B"]],
+ [:[]=, 1, "Set"],
+ [:delete, "first"],
+ [:delete_at, 0],
+ ].each do |method, *args|
+ cookie1 = CGI::Cookie.new("test-cookie", "first", "second")
+ cookie2 = CGI::Cookie.new("test-cookie", "first", "second")
+ cookie1.send(method, *args)
+ cookie2.value.send(method, *args)
+ fail << method unless cookie1.value == cookie2.value
+ end
+ fail.should be_empty
+ end
end
- it "sets self's value" do
- @cookie.value = ["one"]
- @cookie.value.should == ["one"]
+ describe "CGI::Cookie#value=" do
+ before :each do
+ @cookie = CGI::Cookie.new("test-cookie")
+ end
- @cookie.value = ["one", "two", "three"]
- @cookie.value.should == ["one", "two", "three"]
- end
+ it "sets self's value" do
+ @cookie.value = ["one"]
+ @cookie.value.should == ["one"]
- it "automatically converts the passed Object to an Array using #Array" do
- @cookie.value = "test"
- @cookie.value.should == ["test"]
+ @cookie.value = ["one", "two", "three"]
+ @cookie.value.should == ["one", "two", "three"]
+ end
- obj = mock("to_a")
- obj.should_receive(:to_a).and_return(["1", "2"])
- @cookie.value = obj
- @cookie.value.should == ["1", "2"]
+ it "automatically converts the passed Object to an Array using #Array" do
+ @cookie.value = "test"
+ @cookie.value.should == ["test"]
- obj = mock("to_ary")
- obj.should_receive(:to_ary).and_return(["1", "2"])
- @cookie.value = obj
- @cookie.value.should == ["1", "2"]
- end
+ obj = mock("to_a")
+ obj.should_receive(:to_a).and_return(["1", "2"])
+ @cookie.value = obj
+ @cookie.value.should == ["1", "2"]
- it "does keep self and the values in sync" do
- @cookie.value = ["one", "two", "three"]
- @cookie[0].should == "one"
- @cookie[1].should == "two"
- @cookie[2].should == "three"
+ obj = mock("to_ary")
+ obj.should_receive(:to_ary).and_return(["1", "2"])
+ @cookie.value = obj
+ @cookie.value.should == ["1", "2"]
+ end
+
+ it "does keep self and the values in sync" do
+ @cookie.value = ["one", "two", "three"]
+ @cookie[0].should == "one"
+ @cookie[1].should == "two"
+ @cookie[2].should == "three"
+ end
end
end
diff --git a/spec/ruby/library/cgi/escapeElement_spec.rb b/spec/ruby/library/cgi/escapeElement_spec.rb
index 148926c453..528433d252 100644
--- a/spec/ruby/library/cgi/escapeElement_spec.rb
+++ b/spec/ruby/library/cgi/escapeElement_spec.rb
@@ -1,5 +1,9 @@
require_relative '../../spec_helper'
-require 'cgi'
+begin
+ require 'cgi/escape'
+rescue LoadError
+ require 'cgi'
+end
describe "CGI.escapeElement when passed String, elements, ..." do
it "escapes only the tags of the passed elements in the passed String" do
diff --git a/spec/ruby/library/cgi/escapeHTML_spec.rb b/spec/ruby/library/cgi/escapeHTML_spec.rb
index 421aac5d4a..6e70e87ed7 100644
--- a/spec/ruby/library/cgi/escapeHTML_spec.rb
+++ b/spec/ruby/library/cgi/escapeHTML_spec.rb
@@ -1,5 +1,9 @@
require_relative '../../spec_helper'
-require 'cgi'
+begin
+ require 'cgi/escape'
+rescue LoadError
+ require 'cgi'
+end
describe "CGI.escapeHTML" do
it "escapes special HTML characters (&\"<>') in the passed argument" do
diff --git a/spec/ruby/library/cgi/escapeURIComponent_spec.rb b/spec/ruby/library/cgi/escapeURIComponent_spec.rb
index f05795a2f5..ace15eea60 100644
--- a/spec/ruby/library/cgi/escapeURIComponent_spec.rb
+++ b/spec/ruby/library/cgi/escapeURIComponent_spec.rb
@@ -1,5 +1,9 @@
require_relative '../../spec_helper'
-require 'cgi'
+begin
+ require 'cgi/escape'
+rescue LoadError
+ require 'cgi'
+end
ruby_version_is "3.2" do
describe "CGI.escapeURIComponent" do
diff --git a/spec/ruby/library/cgi/escape_spec.rb b/spec/ruby/library/cgi/escape_spec.rb
index c599a73cf0..55eb0b66c2 100644
--- a/spec/ruby/library/cgi/escape_spec.rb
+++ b/spec/ruby/library/cgi/escape_spec.rb
@@ -1,5 +1,9 @@
require_relative '../../spec_helper'
-require 'cgi'
+begin
+ require 'cgi/escape'
+rescue LoadError
+ require 'cgi'
+end
describe "CGI.escape" do
it "url-encodes the passed argument" do
diff --git a/spec/ruby/library/cgi/htmlextension/a_spec.rb b/spec/ruby/library/cgi/htmlextension/a_spec.rb
index 05b4c2d14c..16a0552bac 100644
--- a/spec/ruby/library/cgi/htmlextension/a_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/a_spec.rb
@@ -1,49 +1,52 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#a" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed a String" do
- it "returns an 'a'-element, using the passed String as the 'href'-attribute" do
- output = @html.a("http://www.example.com")
- output.should equal_element("A", "HREF" => "http://www.example.com")
+ describe "CGI::HtmlExtension#a" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "includes the passed block's return value when passed a block" do
- output = @html.a("http://www.example.com") { "Example" }
- output.should equal_element("A", { "HREF" => "http://www.example.com" }, "Example")
- end
- end
+ describe "when passed a String" do
+ it "returns an 'a'-element, using the passed String as the 'href'-attribute" do
+ output = @html.a("http://www.example.com")
+ output.should equal_element("A", "HREF" => "http://www.example.com")
+ end
- describe "when passed a Hash" do
- it "returns an 'a'-element, using the passed Hash for attributes" do
- attributes = {"HREF" => "http://www.example.com", "TARGET" => "_top"}
- @html.a(attributes).should equal_element("A", attributes)
+ it "includes the passed block's return value when passed a block" do
+ output = @html.a("http://www.example.com") { "Example" }
+ output.should equal_element("A", { "HREF" => "http://www.example.com" }, "Example")
+ end
end
- it "includes the passed block's return value when passed a block" do
- attributes = {"HREF" => "http://www.example.com", "TARGET" => "_top"}
- @html.a(attributes) { "Example" }.should equal_element("A", attributes, "Example")
- end
- end
+ describe "when passed a Hash" do
+ it "returns an 'a'-element, using the passed Hash for attributes" do
+ attributes = {"HREF" => "http://www.example.com", "TARGET" => "_top"}
+ @html.a(attributes).should equal_element("A", attributes)
+ end
- describe "when each HTML generation" do
- it "returns the doctype declaration for HTML3" do
- CGISpecs.cgi_new("html3").a.should == %(<A HREF=""></A>)
- CGISpecs.cgi_new("html3").a { "link text" }.should == %(<A HREF="">link text</A>)
+ it "includes the passed block's return value when passed a block" do
+ attributes = {"HREF" => "http://www.example.com", "TARGET" => "_top"}
+ @html.a(attributes) { "Example" }.should equal_element("A", attributes, "Example")
+ end
end
- it "returns the doctype declaration for HTML4" do
- CGISpecs.cgi_new("html4").a.should == %(<A HREF=""></A>)
- CGISpecs.cgi_new("html4").a { "link text" }.should == %(<A HREF="">link text</A>)
- end
- it "returns the doctype declaration for the Transitional version of HTML4" do
- CGISpecs.cgi_new("html4Tr").a.should == %(<A HREF=""></A>)
- CGISpecs.cgi_new("html4Tr").a { "link text" }.should == %(<A HREF="">link text</A>)
+ describe "when each HTML generation" do
+ it "returns the doctype declaration for HTML3" do
+ CGISpecs.cgi_new("html3").a.should == %(<A HREF=""></A>)
+ CGISpecs.cgi_new("html3").a { "link text" }.should == %(<A HREF="">link text</A>)
+ end
+
+ it "returns the doctype declaration for HTML4" do
+ CGISpecs.cgi_new("html4").a.should == %(<A HREF=""></A>)
+ CGISpecs.cgi_new("html4").a { "link text" }.should == %(<A HREF="">link text</A>)
+ end
+ it "returns the doctype declaration for the Transitional version of HTML4" do
+ CGISpecs.cgi_new("html4Tr").a.should == %(<A HREF=""></A>)
+ CGISpecs.cgi_new("html4Tr").a { "link text" }.should == %(<A HREF="">link text</A>)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/base_spec.rb b/spec/ruby/library/cgi/htmlextension/base_spec.rb
index 877ac321cd..a4c4a61614 100644
--- a/spec/ruby/library/cgi/htmlextension/base_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/base_spec.rb
@@ -1,33 +1,36 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#base" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when bassed a String" do
- it "returns a 'base'-element, using the passed String as the 'href'-attribute" do
- output = @html.base("http://www.example.com")
- output.should equal_element("BASE", {"HREF" => "http://www.example.com"}, nil, not_closed: true)
+ describe "CGI::HtmlExtension#base" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "ignores a passed block" do
- output = @html.base("http://www.example.com") { "Example" }
- output.should equal_element("BASE", {"HREF" => "http://www.example.com"}, nil, not_closed: true)
- end
- end
+ describe "when bassed a String" do
+ it "returns a 'base'-element, using the passed String as the 'href'-attribute" do
+ output = @html.base("http://www.example.com")
+ output.should equal_element("BASE", {"HREF" => "http://www.example.com"}, nil, not_closed: true)
+ end
- describe "when passed a Hash" do
- it "returns a 'base'-element, using the passed Hash for attributes" do
- output = @html.base("HREF" => "http://www.example.com", "ID" => "test")
- output.should equal_element("BASE", {"HREF" => "http://www.example.com", "ID" => "test"}, nil, not_closed: true)
+ it "ignores a passed block" do
+ output = @html.base("http://www.example.com") { "Example" }
+ output.should equal_element("BASE", {"HREF" => "http://www.example.com"}, nil, not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.base("HREF" => "http://www.example.com", "ID" => "test") { "Example" }
- output.should equal_element("BASE", {"HREF" => "http://www.example.com", "ID" => "test"}, nil, not_closed: true)
+ describe "when passed a Hash" do
+ it "returns a 'base'-element, using the passed Hash for attributes" do
+ output = @html.base("HREF" => "http://www.example.com", "ID" => "test")
+ output.should equal_element("BASE", {"HREF" => "http://www.example.com", "ID" => "test"}, nil, not_closed: true)
+ end
+
+ it "ignores a passed block" do
+ output = @html.base("HREF" => "http://www.example.com", "ID" => "test") { "Example" }
+ output.should equal_element("BASE", {"HREF" => "http://www.example.com", "ID" => "test"}, nil, not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/blockquote_spec.rb b/spec/ruby/library/cgi/htmlextension/blockquote_spec.rb
index a7b833b1c5..f8d4ca310e 100644
--- a/spec/ruby/library/cgi/htmlextension/blockquote_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/blockquote_spec.rb
@@ -1,33 +1,36 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#blockquote" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed a String" do
- it "returns a 'blockquote'-element, using the passed String for the 'cite'-attribute" do
- output = @html.blockquote("http://www.example.com/quotes/foo.html")
- output.should equal_element("BLOCKQUOTE", "CITE" => "http://www.example.com/quotes/foo.html")
+ describe "CGI::HtmlExtension#blockquote" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "includes the passed block's return value when passed a block" do
- output = @html.blockquote("http://www.example.com/quotes/foo.html") { "Foo!" }
- output.should equal_element("BLOCKQUOTE", { "CITE" => "http://www.example.com/quotes/foo.html" }, "Foo!")
- end
- end
+ describe "when passed a String" do
+ it "returns a 'blockquote'-element, using the passed String for the 'cite'-attribute" do
+ output = @html.blockquote("http://www.example.com/quotes/foo.html")
+ output.should equal_element("BLOCKQUOTE", "CITE" => "http://www.example.com/quotes/foo.html")
+ end
- describe "when passed a Hash" do
- it "returns a 'blockquote'-element, using the passed Hash for attributes" do
- output = @html.blockquote("CITE" => "http://www.example.com/quotes/foo.html", "ID" => "test")
- output.should equal_element("BLOCKQUOTE", "CITE" => "http://www.example.com/quotes/foo.html", "ID" => "test")
+ it "includes the passed block's return value when passed a block" do
+ output = @html.blockquote("http://www.example.com/quotes/foo.html") { "Foo!" }
+ output.should equal_element("BLOCKQUOTE", { "CITE" => "http://www.example.com/quotes/foo.html" }, "Foo!")
+ end
end
- it "includes the passed block's return value when passed a block" do
- output = @html.blockquote("CITE" => "http://www.example.com/quotes/foo.html", "ID" => "test") { "Foo!" }
- output.should equal_element("BLOCKQUOTE", {"CITE" => "http://www.example.com/quotes/foo.html", "ID" => "test"}, "Foo!")
+ describe "when passed a Hash" do
+ it "returns a 'blockquote'-element, using the passed Hash for attributes" do
+ output = @html.blockquote("CITE" => "http://www.example.com/quotes/foo.html", "ID" => "test")
+ output.should equal_element("BLOCKQUOTE", "CITE" => "http://www.example.com/quotes/foo.html", "ID" => "test")
+ end
+
+ it "includes the passed block's return value when passed a block" do
+ output = @html.blockquote("CITE" => "http://www.example.com/quotes/foo.html", "ID" => "test") { "Foo!" }
+ output.should equal_element("BLOCKQUOTE", {"CITE" => "http://www.example.com/quotes/foo.html", "ID" => "test"}, "Foo!")
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/br_spec.rb b/spec/ruby/library/cgi/htmlextension/br_spec.rb
index dfca121884..45909a2db7 100644
--- a/spec/ruby/library/cgi/htmlextension/br_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/br_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#br" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when each HTML generation" do
- it "returns the doctype declaration for HTML3" do
- CGISpecs.cgi_new("html3").br.should == "<BR>"
+ describe "CGI::HtmlExtension#br" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "returns the doctype declaration for HTML4" do
- CGISpecs.cgi_new("html4").br.should == "<BR>"
- end
- it "returns the doctype declaration for the Transitional version of HTML4" do
- CGISpecs.cgi_new("html4Tr").br.should == "<BR>"
+ describe "when each HTML generation" do
+ it "returns the doctype declaration for HTML3" do
+ CGISpecs.cgi_new("html3").br.should == "<BR>"
+ end
+
+ it "returns the doctype declaration for HTML4" do
+ CGISpecs.cgi_new("html4").br.should == "<BR>"
+ end
+ it "returns the doctype declaration for the Transitional version of HTML4" do
+ CGISpecs.cgi_new("html4Tr").br.should == "<BR>"
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/caption_spec.rb b/spec/ruby/library/cgi/htmlextension/caption_spec.rb
index 16615028b8..74f0a098f4 100644
--- a/spec/ruby/library/cgi/htmlextension/caption_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/caption_spec.rb
@@ -1,33 +1,36 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#caption" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed a String" do
- it "returns a 'caption'-element, using the passed String for the 'align'-attribute" do
- output = @html.caption("left")
- output.should equal_element("CAPTION", "ALIGN" => "left")
+ describe "CGI::HtmlExtension#caption" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "includes the passed block's return value when passed a block" do
- output = @html.caption("left") { "Capital Cities" }
- output.should equal_element("CAPTION", {"ALIGN" => "left"}, "Capital Cities")
- end
- end
+ describe "when passed a String" do
+ it "returns a 'caption'-element, using the passed String for the 'align'-attribute" do
+ output = @html.caption("left")
+ output.should equal_element("CAPTION", "ALIGN" => "left")
+ end
- describe "when passed a Hash" do
- it "returns a 'caption'-element, using the passed Hash for attributes" do
- output = @html.caption("ALIGN" => "left", "ID" => "test")
- output.should equal_element("CAPTION", "ALIGN" => "left", "ID" => "test")
+ it "includes the passed block's return value when passed a block" do
+ output = @html.caption("left") { "Capital Cities" }
+ output.should equal_element("CAPTION", {"ALIGN" => "left"}, "Capital Cities")
+ end
end
- it "includes the passed block's return value when passed a block" do
- output = @html.caption("ALIGN" => "left", "ID" => "test") { "Capital Cities" }
- output.should equal_element("CAPTION", {"ALIGN" => "left", "ID" => "test"}, "Capital Cities")
+ describe "when passed a Hash" do
+ it "returns a 'caption'-element, using the passed Hash for attributes" do
+ output = @html.caption("ALIGN" => "left", "ID" => "test")
+ output.should equal_element("CAPTION", "ALIGN" => "left", "ID" => "test")
+ end
+
+ it "includes the passed block's return value when passed a block" do
+ output = @html.caption("ALIGN" => "left", "ID" => "test") { "Capital Cities" }
+ output.should equal_element("CAPTION", {"ALIGN" => "left", "ID" => "test"}, "Capital Cities")
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/checkbox_group_spec.rb b/spec/ruby/library/cgi/htmlextension/checkbox_group_spec.rb
index 64f852cc52..1acfe62fda 100644
--- a/spec/ruby/library/cgi/htmlextension/checkbox_group_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/checkbox_group_spec.rb
@@ -1,76 +1,79 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#checkbox_group" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed name, values ..." do
- it "returns a sequence of 'checkbox'-elements with the passed name and the passed values" do
- output = CGISpecs.split(@html.checkbox_group("test", "foo", "bar", "baz"))
- output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
+ describe "CGI::HtmlExtension#checkbox_group" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "allows passing a value inside an Array" do
- output = CGISpecs.split(@html.checkbox_group("test", ["foo"], "bar", ["baz"]))
- output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
- end
+ describe "when passed name, values ..." do
+ it "returns a sequence of 'checkbox'-elements with the passed name and the passed values" do
+ output = CGISpecs.split(@html.checkbox_group("test", "foo", "bar", "baz"))
+ output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
+ end
- it "allows passing a value as an Array containing the value and the checked state or a label" do
- output = CGISpecs.split(@html.checkbox_group("test", ["foo"], ["bar", true], ["baz", "label for baz"]))
- output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "baz"}, "label for baz", not_closed: true)
- end
+ it "allows passing a value inside an Array" do
+ output = CGISpecs.split(@html.checkbox_group("test", ["foo"], "bar", ["baz"]))
+ output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
+ end
- it "allows passing a value as an Array containing the value, a label and the checked state" do
- output = CGISpecs.split(@html.checkbox_group("test", ["foo", "label for foo", true], ["bar", "label for bar", false], ["baz", "label for baz", true]))
- output[0].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "checkbox", "VALUE" => "foo"}, "label for foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "bar"}, "label for bar", not_closed: true)
- output[2].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "checkbox", "VALUE" => "baz"}, "label for baz", not_closed: true)
- end
+ it "allows passing a value as an Array containing the value and the checked state or a label" do
+ output = CGISpecs.split(@html.checkbox_group("test", ["foo"], ["bar", true], ["baz", "label for baz"]))
+ output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "baz"}, "label for baz", not_closed: true)
+ end
- it "returns an empty String when passed no values" do
- @html.checkbox_group("test").should == ""
- end
+ it "allows passing a value as an Array containing the value, a label and the checked state" do
+ output = CGISpecs.split(@html.checkbox_group("test", ["foo", "label for foo", true], ["bar", "label for bar", false], ["baz", "label for baz", true]))
+ output[0].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "checkbox", "VALUE" => "foo"}, "label for foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "bar"}, "label for bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "checkbox", "VALUE" => "baz"}, "label for baz", not_closed: true)
+ end
+
+ it "returns an empty String when passed no values" do
+ @html.checkbox_group("test").should == ""
+ end
- it "ignores a passed block" do
- output = CGISpecs.split(@html.checkbox_group("test", "foo", "bar", "baz") { "test" })
- output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
+ it "ignores a passed block" do
+ output = CGISpecs.split(@html.checkbox_group("test", "foo", "bar", "baz") { "test" })
+ output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
+ end
end
- end
- describe "when passed Hash" do
- it "uses the passed Hash to generate the checkbox sequence" do
- output = CGISpecs.split(@html.checkbox_group("NAME" => "name", "VALUES" => ["foo", "bar", "baz"]))
- output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
+ describe "when passed Hash" do
+ it "uses the passed Hash to generate the checkbox sequence" do
+ output = CGISpecs.split(@html.checkbox_group("NAME" => "name", "VALUES" => ["foo", "bar", "baz"]))
+ output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
- output = CGISpecs.split(@html.checkbox_group("NAME" => "name", "VALUES" => [["foo"], ["bar", true], "baz"]))
- output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "name", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
+ output = CGISpecs.split(@html.checkbox_group("NAME" => "name", "VALUES" => [["foo"], ["bar", true], "baz"]))
+ output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "name", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
- output = CGISpecs.split(@html.checkbox_group("NAME" => "name", "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"]))
- output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "1"}, "Foo", not_closed: true)
- output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "name", "TYPE" => "checkbox", "VALUE" => "2"}, "Bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "Baz"}, "Baz", not_closed: true)
- end
+ output = CGISpecs.split(@html.checkbox_group("NAME" => "name", "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"]))
+ output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "1"}, "Foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "name", "TYPE" => "checkbox", "VALUE" => "2"}, "Bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "Baz"}, "Baz", not_closed: true)
+ end
- it "ignores a passed block" do
- output = CGISpecs.split(@html.checkbox_group("NAME" => "name", "VALUES" => ["foo", "bar", "baz"]) { "test" })
- output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
+ it "ignores a passed block" do
+ output = CGISpecs.split(@html.checkbox_group("NAME" => "name", "VALUES" => ["foo", "bar", "baz"]) { "test" })
+ output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "checkbox", "VALUE" => "baz"}, "baz", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/checkbox_spec.rb b/spec/ruby/library/cgi/htmlextension/checkbox_spec.rb
index af76fa1da9..ba410f31de 100644
--- a/spec/ruby/library/cgi/htmlextension/checkbox_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/checkbox_spec.rb
@@ -1,77 +1,80 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#checkbox" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns a checkbox-'input'-element without a name" do
- output = @html.checkbox
- output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "checkbox"}, "", not_closed: true)
+ describe "CGI::HtmlExtension#checkbox" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "ignores a passed block" do
- output = @html.checkbox { "test" }
- output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "checkbox"}, "", not_closed: true)
- end
- end
+ describe "when passed no arguments" do
+ it "returns a checkbox-'input'-element without a name" do
+ output = @html.checkbox
+ output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "checkbox"}, "", not_closed: true)
+ end
- describe "when passed name" do
- it "returns a checkbox-'input'-element with the passed name" do
- output = @html.checkbox("test")
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.checkbox { "test" }
+ output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "checkbox"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.checkbox("test") { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox"}, "", not_closed: true)
- end
- end
+ describe "when passed name" do
+ it "returns a checkbox-'input'-element with the passed name" do
+ output = @html.checkbox("test")
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox"}, "", not_closed: true)
+ end
- describe "CGI::HtmlExtension#checkbox when passed name, value" do
- it "returns a checkbox-'input'-element with the passed name and value" do
- output = @html.checkbox("test", "test-value")
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.checkbox("test") { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.checkbox("test", "test-value") { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
+ describe "CGI::HtmlExtension#checkbox when passed name, value" do
+ it "returns a checkbox-'input'-element with the passed name and value" do
+ output = @html.checkbox("test", "test-value")
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
+ end
+
+ it "ignores a passed block" do
+ output = @html.checkbox("test", "test-value") { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
+ end
end
- end
- describe "when passed name, value, checked" do
- it "returns a checked checkbox-'input'-element with the passed name and value when checked is true" do
- output = @html.checkbox("test", "test-value", true)
- output.should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
+ describe "when passed name, value, checked" do
+ it "returns a checked checkbox-'input'-element with the passed name and value when checked is true" do
+ output = @html.checkbox("test", "test-value", true)
+ output.should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
- output = @html.checkbox("test", "test-value", false)
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
+ output = @html.checkbox("test", "test-value", false)
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
- output = @html.checkbox("test", "test-value", nil)
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
- end
+ output = @html.checkbox("test", "test-value", nil)
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
+ end
- it "ignores a passed block" do
- output = @html.checkbox("test", "test-value", nil) { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.checkbox("test", "test-value", nil) { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "checkbox", "VALUE" => "test-value"}, "", not_closed: true)
+ end
end
- end
- describe "when passed Hash" do
- it "returns a checkbox-'input'-element using the passed Hash for attributes" do
- attributes = {"NAME" => "test", "VALUE" => "test-value", "CHECKED" => true}
- output = @html.checkbox(attributes)
- output.should equal_element("INPUT", attributes, "", not_closed: true)
- end
+ describe "when passed Hash" do
+ it "returns a checkbox-'input'-element using the passed Hash for attributes" do
+ attributes = {"NAME" => "test", "VALUE" => "test-value", "CHECKED" => true}
+ output = @html.checkbox(attributes)
+ output.should equal_element("INPUT", attributes, "", not_closed: true)
+ end
- it "ignores a passed block" do
- attributes = {"NAME" => "test", "VALUE" => "test-value", "CHECKED" => true}
- output = @html.checkbox(attributes) { "test" }
- output.should equal_element("INPUT", attributes, "", not_closed: true)
+ it "ignores a passed block" do
+ attributes = {"NAME" => "test", "VALUE" => "test-value", "CHECKED" => true}
+ output = @html.checkbox(attributes) { "test" }
+ output.should equal_element("INPUT", attributes, "", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/doctype_spec.rb b/spec/ruby/library/cgi/htmlextension/doctype_spec.rb
index 9a28a8883b..49501ac8f7 100644
--- a/spec/ruby/library/cgi/htmlextension/doctype_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/doctype_spec.rb
@@ -1,27 +1,30 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#doctype" do
- describe "when each HTML generation" do
- it "returns the doctype declaration for HTML3" do
- expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">'
- CGISpecs.cgi_new("html3").doctype.should == expect
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- it "returns the doctype declaration for HTML4" do
- expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
- CGISpecs.cgi_new("html4").doctype.should == expect
- end
+ describe "CGI::HtmlExtension#doctype" do
+ describe "when each HTML generation" do
+ it "returns the doctype declaration for HTML3" do
+ expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">'
+ CGISpecs.cgi_new("html3").doctype.should == expect
+ end
- it "returns the doctype declaration for the Frameset version of HTML4" do
- expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
- CGISpecs.cgi_new("html4Fr").doctype.should == expect
- end
+ it "returns the doctype declaration for HTML4" do
+ expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
+ CGISpecs.cgi_new("html4").doctype.should == expect
+ end
+
+ it "returns the doctype declaration for the Frameset version of HTML4" do
+ expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'
+ CGISpecs.cgi_new("html4Fr").doctype.should == expect
+ end
- it "returns the doctype declaration for the Transitional version of HTML4" do
- expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
- CGISpecs.cgi_new("html4Tr").doctype.should == expect
+ it "returns the doctype declaration for the Transitional version of HTML4" do
+ expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
+ CGISpecs.cgi_new("html4Tr").doctype.should == expect
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/file_field_spec.rb b/spec/ruby/library/cgi/htmlextension/file_field_spec.rb
index 2a0632fd58..b8ef0b2045 100644
--- a/spec/ruby/library/cgi/htmlextension/file_field_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/file_field_spec.rb
@@ -1,72 +1,75 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#file_field" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns a file-'input'-element without a name and a size of 20" do
- output = @html.file_field
- output.should equal_element("INPUT", {"SIZE" => 20, "NAME" => "", "TYPE" => "file"}, "", not_closed: true)
+ describe "CGI::HtmlExtension#file_field" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "ignores a passed block" do
- output = @html.file_field { "test" }
- output.should equal_element("INPUT", {"SIZE" => 20, "NAME" => "", "TYPE" => "file"}, "", not_closed: true)
- end
- end
+ describe "when passed no arguments" do
+ it "returns a file-'input'-element without a name and a size of 20" do
+ output = @html.file_field
+ output.should equal_element("INPUT", {"SIZE" => 20, "NAME" => "", "TYPE" => "file"}, "", not_closed: true)
+ end
- describe "when passed name" do
- it "returns a checkbox-'input'-element with the passed name" do
- output = @html.file_field("Example")
- output.should equal_element("INPUT", {"SIZE" => 20, "NAME" => "Example", "TYPE" => "file"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.file_field { "test" }
+ output.should equal_element("INPUT", {"SIZE" => 20, "NAME" => "", "TYPE" => "file"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.file_field("Example") { "test" }
- output.should equal_element("INPUT", {"SIZE" => 20, "NAME" => "Example", "TYPE" => "file"}, "", not_closed: true)
- end
- end
+ describe "when passed name" do
+ it "returns a checkbox-'input'-element with the passed name" do
+ output = @html.file_field("Example")
+ output.should equal_element("INPUT", {"SIZE" => 20, "NAME" => "Example", "TYPE" => "file"}, "", not_closed: true)
+ end
- describe "when passed name, size" do
- it "returns a checkbox-'input'-element with the passed name and size" do
- output = @html.file_field("Example", 40)
- output.should equal_element("INPUT", {"SIZE" => 40, "NAME" => "Example", "TYPE" => "file"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.file_field("Example") { "test" }
+ output.should equal_element("INPUT", {"SIZE" => 20, "NAME" => "Example", "TYPE" => "file"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.file_field("Example", 40) { "test" }
- output.should equal_element("INPUT", {"SIZE" => 40, "NAME" => "Example", "TYPE" => "file"}, "", not_closed: true)
- end
- end
+ describe "when passed name, size" do
+ it "returns a checkbox-'input'-element with the passed name and size" do
+ output = @html.file_field("Example", 40)
+ output.should equal_element("INPUT", {"SIZE" => 40, "NAME" => "Example", "TYPE" => "file"}, "", not_closed: true)
+ end
- describe "when passed name, size, maxlength" do
- it "returns a checkbox-'input'-element with the passed name, size and maxlength" do
- output = @html.file_field("Example", 40, 100)
- output.should equal_element("INPUT", {"SIZE" => 40, "NAME" => "Example", "TYPE" => "file", "MAXLENGTH" => 100}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.file_field("Example", 40) { "test" }
+ output.should equal_element("INPUT", {"SIZE" => 40, "NAME" => "Example", "TYPE" => "file"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.file_field("Example", 40, 100) { "test" }
- output.should equal_element("INPUT", {"SIZE" => 40, "NAME" => "Example", "TYPE" => "file", "MAXLENGTH" => 100}, "", not_closed: true)
+ describe "when passed name, size, maxlength" do
+ it "returns a checkbox-'input'-element with the passed name, size and maxlength" do
+ output = @html.file_field("Example", 40, 100)
+ output.should equal_element("INPUT", {"SIZE" => 40, "NAME" => "Example", "TYPE" => "file", "MAXLENGTH" => 100}, "", not_closed: true)
+ end
+
+ it "ignores a passed block" do
+ output = @html.file_field("Example", 40, 100) { "test" }
+ output.should equal_element("INPUT", {"SIZE" => 40, "NAME" => "Example", "TYPE" => "file", "MAXLENGTH" => 100}, "", not_closed: true)
+ end
end
- end
- describe "when passed a Hash" do
- it "returns a file-'input'-element using the passed Hash for attributes" do
- output = @html.file_field("NAME" => "test", "SIZE" => 40)
- output.should equal_element("INPUT", {"NAME" => "test", "SIZE" => 40}, "", not_closed: true)
+ describe "when passed a Hash" do
+ it "returns a file-'input'-element using the passed Hash for attributes" do
+ output = @html.file_field("NAME" => "test", "SIZE" => 40)
+ output.should equal_element("INPUT", {"NAME" => "test", "SIZE" => 40}, "", not_closed: true)
- output = @html.file_field("NAME" => "test", "MAXLENGTH" => 100)
- output.should equal_element("INPUT", {"NAME" => "test", "MAXLENGTH" => 100}, "", not_closed: true)
- end
+ output = @html.file_field("NAME" => "test", "MAXLENGTH" => 100)
+ output.should equal_element("INPUT", {"NAME" => "test", "MAXLENGTH" => 100}, "", not_closed: true)
+ end
- it "ignores a passed block" do
- output = @html.file_field("NAME" => "test", "SIZE" => 40) { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "SIZE" => 40}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.file_field("NAME" => "test", "SIZE" => 40) { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "SIZE" => 40}, "", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/form_spec.rb b/spec/ruby/library/cgi/htmlextension/form_spec.rb
index 8c0ac97735..510ce27b77 100644
--- a/spec/ruby/library/cgi/htmlextension/form_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/form_spec.rb
@@ -1,58 +1,61 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#form" do
- before :each do
- @html = CGISpecs.cgi_new
- @html.stub!(:script_name).and_return("/path/to/some/script")
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns a 'form'-element" do
- output = @html.form
- output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "post", "ACTION" => "/path/to/some/script"}, "")
+ describe "CGI::HtmlExtension#form" do
+ before :each do
+ @html = CGISpecs.cgi_new
+ @html.stub!(:script_name).and_return("/path/to/some/script")
end
- it "includes the return value of the passed block when passed a block" do
- output = @html.form { "test" }
- output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "post", "ACTION" => "/path/to/some/script"}, "test")
- end
- end
+ describe "when passed no arguments" do
+ it "returns a 'form'-element" do
+ output = @html.form
+ output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "post", "ACTION" => "/path/to/some/script"}, "")
+ end
- describe "when passed method" do
- it "returns a 'form'-element with the passed method" do
- output = @html.form("get")
- output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ACTION" => "/path/to/some/script"}, "")
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.form { "test" }
+ output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "post", "ACTION" => "/path/to/some/script"}, "test")
+ end
end
- it "includes the return value of the passed block when passed a block" do
- output = @html.form("get") { "test" }
- output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ACTION" => "/path/to/some/script"}, "test")
- end
- end
+ describe "when passed method" do
+ it "returns a 'form'-element with the passed method" do
+ output = @html.form("get")
+ output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ACTION" => "/path/to/some/script"}, "")
+ end
- describe "when passed method, action" do
- it "returns a 'form'-element with the passed method and the passed action" do
- output = @html.form("get", "/some/other/script")
- output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ACTION" => "/some/other/script"}, "")
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.form("get") { "test" }
+ output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ACTION" => "/path/to/some/script"}, "test")
+ end
end
- it "includes the return value of the passed block when passed a block" do
- output = @html.form("get", "/some/other/script") { "test" }
- output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ACTION" => "/some/other/script"}, "test")
- end
- end
+ describe "when passed method, action" do
+ it "returns a 'form'-element with the passed method and the passed action" do
+ output = @html.form("get", "/some/other/script")
+ output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ACTION" => "/some/other/script"}, "")
+ end
- describe "when passed method, action, enctype" do
- it "returns a 'form'-element with the passed method, action and enctype" do
- output = @html.form("get", "/some/other/script", "multipart/form-data")
- output.should equal_element("FORM", {"ENCTYPE" => "multipart/form-data", "METHOD" => "get", "ACTION" => "/some/other/script"}, "")
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.form("get", "/some/other/script") { "test" }
+ output.should equal_element("FORM", {"ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ACTION" => "/some/other/script"}, "test")
+ end
end
- it "includes the return value of the passed block when passed a block" do
- output = @html.form("get", "/some/other/script", "multipart/form-data") { "test" }
- output.should equal_element("FORM", {"ENCTYPE" => "multipart/form-data", "METHOD" => "get", "ACTION" => "/some/other/script"}, "test")
+ describe "when passed method, action, enctype" do
+ it "returns a 'form'-element with the passed method, action and enctype" do
+ output = @html.form("get", "/some/other/script", "multipart/form-data")
+ output.should equal_element("FORM", {"ENCTYPE" => "multipart/form-data", "METHOD" => "get", "ACTION" => "/some/other/script"}, "")
+ end
+
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.form("get", "/some/other/script", "multipart/form-data") { "test" }
+ output.should equal_element("FORM", {"ENCTYPE" => "multipart/form-data", "METHOD" => "get", "ACTION" => "/some/other/script"}, "test")
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/frame_spec.rb b/spec/ruby/library/cgi/htmlextension/frame_spec.rb
index 2ddd4e1ef0..0dc30e94f7 100644
--- a/spec/ruby/library/cgi/htmlextension/frame_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/frame_spec.rb
@@ -1,14 +1,17 @@
require_relative '../../../spec_helper'
-require_relative 'fixtures/common'
-require 'cgi'
-describe "CGI::HtmlExtension#frame" do
- before :each do
- @html = CGISpecs.cgi_new("html4Fr")
- end
+ruby_version_is ""..."3.5" do
+ require_relative 'fixtures/common'
+ require 'cgi'
+
+ describe "CGI::HtmlExtension#frame" do
+ before :each do
+ @html = CGISpecs.cgi_new("html4Fr")
+ end
- it "initializes the HTML Generation methods for the Frameset version of HTML4" do
- @html.frameset.should == "<FRAMESET></FRAMESET>"
- @html.frameset { "link text" }.should == "<FRAMESET>link text</FRAMESET>"
+ it "initializes the HTML Generation methods for the Frameset version of HTML4" do
+ @html.frameset.should == "<FRAMESET></FRAMESET>"
+ @html.frameset { "link text" }.should == "<FRAMESET>link text</FRAMESET>"
+ end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/frameset_spec.rb b/spec/ruby/library/cgi/htmlextension/frameset_spec.rb
index baeb446593..a37b5f537d 100644
--- a/spec/ruby/library/cgi/htmlextension/frameset_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/frameset_spec.rb
@@ -1,14 +1,17 @@
require_relative '../../../spec_helper'
-require_relative 'fixtures/common'
-require 'cgi'
-describe "CGI::HtmlExtension#frameset" do
- before :each do
- @html = CGISpecs.cgi_new("html4Fr")
- end
+ruby_version_is ""..."3.5" do
+ require_relative 'fixtures/common'
+ require 'cgi'
+
+ describe "CGI::HtmlExtension#frameset" do
+ before :each do
+ @html = CGISpecs.cgi_new("html4Fr")
+ end
- it "initializes the HTML Generation methods for the Frameset version of HTML4" do
- @html.frameset.should == "<FRAMESET></FRAMESET>"
- @html.frameset { "link text" }.should == "<FRAMESET>link text</FRAMESET>"
+ it "initializes the HTML Generation methods for the Frameset version of HTML4" do
+ @html.frameset.should == "<FRAMESET></FRAMESET>"
+ @html.frameset { "link text" }.should == "<FRAMESET>link text</FRAMESET>"
+ end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/hidden_spec.rb b/spec/ruby/library/cgi/htmlextension/hidden_spec.rb
index 52ebd8c261..5771058fa3 100644
--- a/spec/ruby/library/cgi/htmlextension/hidden_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/hidden_spec.rb
@@ -1,59 +1,62 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#hidden" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns an hidden-'input'-element without a name" do
- output = @html.hidden
- output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "hidden"}, "", not_closed: true)
+ describe "CGI::HtmlExtension#hidden" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "ignores a passed block" do
- output = @html.hidden { "test" }
- output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "hidden"}, "", not_closed: true)
- end
- end
+ describe "when passed no arguments" do
+ it "returns an hidden-'input'-element without a name" do
+ output = @html.hidden
+ output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "hidden"}, "", not_closed: true)
+ end
- describe "when passed name" do
- it "returns an hidden-'input'-element with the passed name" do
- output = @html.hidden("test")
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "hidden"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.hidden { "test" }
+ output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "hidden"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.hidden("test") { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "hidden"}, "", not_closed: true)
- end
- end
+ describe "when passed name" do
+ it "returns an hidden-'input'-element with the passed name" do
+ output = @html.hidden("test")
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "hidden"}, "", not_closed: true)
+ end
- describe "when passed name, value" do
- it "returns an hidden-'input'-element with the passed name and value" do
- output = @html.hidden("test", "some value")
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "hidden", "VALUE" => "some value"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.hidden("test") { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "hidden"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.hidden("test", "some value") { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "hidden", "VALUE" => "some value"}, "", not_closed: true)
- end
- end
+ describe "when passed name, value" do
+ it "returns an hidden-'input'-element with the passed name and value" do
+ output = @html.hidden("test", "some value")
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "hidden", "VALUE" => "some value"}, "", not_closed: true)
+ end
- describe "when passed Hash" do
- it "returns a checkbox-'input'-element using the passed Hash for attributes" do
- attributes = { "NAME" => "test", "VALUE" => "some value" }
- output = @html.hidden("test", "some value")
- output.should equal_element("INPUT", attributes, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.hidden("test", "some value") { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "hidden", "VALUE" => "some value"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- attributes = { "NAME" => "test", "VALUE" => "some value" }
- output = @html.hidden("test", "some value") { "test" }
- output.should equal_element("INPUT", attributes, "", not_closed: true)
+ describe "when passed Hash" do
+ it "returns a checkbox-'input'-element using the passed Hash for attributes" do
+ attributes = { "NAME" => "test", "VALUE" => "some value" }
+ output = @html.hidden("test", "some value")
+ output.should equal_element("INPUT", attributes, "", not_closed: true)
+ end
+
+ it "ignores a passed block" do
+ attributes = { "NAME" => "test", "VALUE" => "some value" }
+ output = @html.hidden("test", "some value") { "test" }
+ output.should equal_element("INPUT", attributes, "", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/html_spec.rb b/spec/ruby/library/cgi/htmlextension/html_spec.rb
index 5d89c82086..0e4052dcc4 100644
--- a/spec/ruby/library/cgi/htmlextension/html_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/html_spec.rb
@@ -1,66 +1,69 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#html" do
- before :each do
- @html = CGISpecs.cgi_new
- @html.stub!(:doctype).and_return("<!DOCTYPE SUPA-FUNKAY-RUBYSPEC-DOCTYPE>")
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns a self's doctype and an 'html'-element" do
- expected = '<!DOCTYPE SUPA-FUNKAY-RUBYSPEC-DOCTYPE><HTML>'
- @html.html.should == expected
+ describe "CGI::HtmlExtension#html" do
+ before :each do
+ @html = CGISpecs.cgi_new
+ @html.stub!(:doctype).and_return("<!DOCTYPE SUPA-FUNKAY-RUBYSPEC-DOCTYPE>")
end
- it "includes the passed block when passed a block" do
- expected = '<!DOCTYPE SUPA-FUNKAY-RUBYSPEC-DOCTYPE><HTML>test</HTML>'
- @html.html { "test" }.should == expected
- end
- end
+ describe "when passed no arguments" do
+ it "returns a self's doctype and an 'html'-element" do
+ expected = '<!DOCTYPE SUPA-FUNKAY-RUBYSPEC-DOCTYPE><HTML>'
+ @html.html.should == expected
+ end
- describe "when passed 'PRETTY'" do
- it "returns pretty output when the passed String is 'PRETTY" do
- expected = "<!DOCTYPE SUPA-FUNKAY-RUBYSPEC-DOCTYPE>\n<HTML>\n"
- @html.html("PRETTY").should == expected
+ it "includes the passed block when passed a block" do
+ expected = '<!DOCTYPE SUPA-FUNKAY-RUBYSPEC-DOCTYPE><HTML>test</HTML>'
+ @html.html { "test" }.should == expected
+ end
end
- it "includes the passed block when passed a block" do
- expected = "<!DOCTYPE SUPA-FUNKAY-RUBYSPEC-DOCTYPE>\n<HTML>\n test\n</HTML>\n"
- @html.html("PRETTY") { "test" }.should == expected
- end
- end
+ describe "when passed 'PRETTY'" do
+ it "returns pretty output when the passed String is 'PRETTY" do
+ expected = "<!DOCTYPE SUPA-FUNKAY-RUBYSPEC-DOCTYPE>\n<HTML>\n"
+ @html.html("PRETTY").should == expected
+ end
- describe "when passed a Hash" do
- it "returns an 'html'-element using the passed Hash for attributes" do
- expected = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML BLA="TEST">'
- @html.html("DOCTYPE" => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">', "BLA" => "TEST").should == expected
+ it "includes the passed block when passed a block" do
+ expected = "<!DOCTYPE SUPA-FUNKAY-RUBYSPEC-DOCTYPE>\n<HTML>\n test\n</HTML>\n"
+ @html.html("PRETTY") { "test" }.should == expected
+ end
end
- it "omits the doctype when the Hash contains a 'DOCTYPE' entry that's false or nil" do
- @html.html("DOCTYPE" => false).should == "<HTML>"
- @html.html("DOCTYPE" => nil).should == "<HTML>"
- end
- end
+ describe "when passed a Hash" do
+ it "returns an 'html'-element using the passed Hash for attributes" do
+ expected = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML BLA="TEST">'
+ @html.html("DOCTYPE" => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">', "BLA" => "TEST").should == expected
+ end
- describe "when each HTML generation" do
- it "returns the doctype declaration for HTML3" do
- expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">'
- CGISpecs.cgi_new("html3").html.should == expect + "<HTML>"
- CGISpecs.cgi_new("html3").html { "html body" }.should == expect + "<HTML>html body</HTML>"
+ it "omits the doctype when the Hash contains a 'DOCTYPE' entry that's false or nil" do
+ @html.html("DOCTYPE" => false).should == "<HTML>"
+ @html.html("DOCTYPE" => nil).should == "<HTML>"
+ end
end
- it "returns the doctype declaration for HTML4" do
- expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
- CGISpecs.cgi_new("html4").html.should == expect + "<HTML>"
- CGISpecs.cgi_new("html4").html { "html body" }.should == expect + "<HTML>html body</HTML>"
- end
+ describe "when each HTML generation" do
+ it "returns the doctype declaration for HTML3" do
+ expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">'
+ CGISpecs.cgi_new("html3").html.should == expect + "<HTML>"
+ CGISpecs.cgi_new("html3").html { "html body" }.should == expect + "<HTML>html body</HTML>"
+ end
+
+ it "returns the doctype declaration for HTML4" do
+ expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'
+ CGISpecs.cgi_new("html4").html.should == expect + "<HTML>"
+ CGISpecs.cgi_new("html4").html { "html body" }.should == expect + "<HTML>html body</HTML>"
+ end
- it "returns the doctype declaration for the Transitional version of HTML4" do
- expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
- CGISpecs.cgi_new("html4Tr").html.should == expect + "<HTML>"
- CGISpecs.cgi_new("html4Tr").html { "html body" }.should == expect + "<HTML>html body</HTML>"
+ it "returns the doctype declaration for the Transitional version of HTML4" do
+ expect = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
+ CGISpecs.cgi_new("html4Tr").html.should == expect + "<HTML>"
+ CGISpecs.cgi_new("html4Tr").html { "html body" }.should == expect + "<HTML>html body</HTML>"
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/image_button_spec.rb b/spec/ruby/library/cgi/htmlextension/image_button_spec.rb
index d14bec9ca3..cd7f1ae4f7 100644
--- a/spec/ruby/library/cgi/htmlextension/image_button_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/image_button_spec.rb
@@ -1,69 +1,72 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#image_button" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns an image-'input'-element without a source image" do
- output = @html.image_button
- output.should equal_element("INPUT", {"SRC" => "", "TYPE" => "image"}, "", not_closed: true)
+ describe "CGI::HtmlExtension#image_button" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "ignores a passed block" do
- output = @html.image_button { "test" }
- output.should equal_element("INPUT", {"SRC" => "", "TYPE" => "image"}, "", not_closed: true)
- end
- end
+ describe "when passed no arguments" do
+ it "returns an image-'input'-element without a source image" do
+ output = @html.image_button
+ output.should equal_element("INPUT", {"SRC" => "", "TYPE" => "image"}, "", not_closed: true)
+ end
- describe "when passed src" do
- it "returns an image-'input'-element with the passed src" do
- output = @html.image_button("/path/to/image.png")
- output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.image_button { "test" }
+ output.should equal_element("INPUT", {"SRC" => "", "TYPE" => "image"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.image_button("/path/to/image.png") { "test" }
- output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image"}, "", not_closed: true)
- end
- end
+ describe "when passed src" do
+ it "returns an image-'input'-element with the passed src" do
+ output = @html.image_button("/path/to/image.png")
+ output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image"}, "", not_closed: true)
+ end
- describe "when passed src, name" do
- it "returns an image-'input'-element with the passed src and name" do
- output = @html.image_button("/path/to/image.png", "test")
- output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image", "NAME" => "test"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.image_button("/path/to/image.png") { "test" }
+ output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.image_button("/path/to/image.png", "test") { "test" }
- output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image", "NAME" => "test"}, "", not_closed: true)
- end
- end
+ describe "when passed src, name" do
+ it "returns an image-'input'-element with the passed src and name" do
+ output = @html.image_button("/path/to/image.png", "test")
+ output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image", "NAME" => "test"}, "", not_closed: true)
+ end
- describe "when passed src, name, alt" do
- it "returns an image-'input'-element with the passed src, name and alt" do
- output = @html.image_button("/path/to/image.png", "test", "alternative")
- output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image", "NAME" => "test", "ALT" => "alternative"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.image_button("/path/to/image.png", "test") { "test" }
+ output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image", "NAME" => "test"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.image_button("/path/to/image.png", "test", "alternative") { "test" }
- output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image", "NAME" => "test", "ALT" => "alternative"}, "", not_closed: true)
- end
- end
+ describe "when passed src, name, alt" do
+ it "returns an image-'input'-element with the passed src, name and alt" do
+ output = @html.image_button("/path/to/image.png", "test", "alternative")
+ output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image", "NAME" => "test", "ALT" => "alternative"}, "", not_closed: true)
+ end
- describe "when passed Hash" do
- it "returns a image-'input'-element using the passed Hash for attributes" do
- output = @html.image_button("NAME" => "test", "VALUE" => "test-value")
- output.should equal_element("INPUT", {"SRC" => "", "TYPE" => "image", "NAME" => "test", "VALUE" => "test-value"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.image_button("/path/to/image.png", "test", "alternative") { "test" }
+ output.should equal_element("INPUT", {"SRC" => "/path/to/image.png", "TYPE" => "image", "NAME" => "test", "ALT" => "alternative"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.image_button("NAME" => "test", "VALUE" => "test-value") { "test" }
- output.should equal_element("INPUT", {"SRC" => "", "TYPE" => "image", "NAME" => "test", "VALUE" => "test-value"}, "", not_closed: true)
+ describe "when passed Hash" do
+ it "returns a image-'input'-element using the passed Hash for attributes" do
+ output = @html.image_button("NAME" => "test", "VALUE" => "test-value")
+ output.should equal_element("INPUT", {"SRC" => "", "TYPE" => "image", "NAME" => "test", "VALUE" => "test-value"}, "", not_closed: true)
+ end
+
+ it "ignores a passed block" do
+ output = @html.image_button("NAME" => "test", "VALUE" => "test-value") { "test" }
+ output.should equal_element("INPUT", {"SRC" => "", "TYPE" => "image", "NAME" => "test", "VALUE" => "test-value"}, "", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/img_spec.rb b/spec/ruby/library/cgi/htmlextension/img_spec.rb
index 994ae7fedf..193d3dca26 100644
--- a/spec/ruby/library/cgi/htmlextension/img_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/img_spec.rb
@@ -1,83 +1,86 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#img" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns an 'img'-element without an src-url or alt-text" do
- output = @html.img
- output.should equal_element("IMG", { "SRC" => "", "ALT" => "" }, "", not_closed: true)
+ describe "CGI::HtmlExtension#img" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "ignores a passed block" do
- output = @html.img { "test" }
- output.should equal_element("IMG", { "SRC" => "", "ALT" => "" }, "", not_closed: true)
- end
- end
+ describe "when passed no arguments" do
+ it "returns an 'img'-element without an src-url or alt-text" do
+ output = @html.img
+ output.should equal_element("IMG", { "SRC" => "", "ALT" => "" }, "", not_closed: true)
+ end
- describe "when passed src" do
- it "returns an 'img'-element with the passed src-url" do
- output = @html.img("/path/to/some/image.png")
- output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "" }, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.img { "test" }
+ output.should equal_element("IMG", { "SRC" => "", "ALT" => "" }, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.img("/path/to/some/image.png")
- output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "" }, "", not_closed: true)
- end
- end
+ describe "when passed src" do
+ it "returns an 'img'-element with the passed src-url" do
+ output = @html.img("/path/to/some/image.png")
+ output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "" }, "", not_closed: true)
+ end
- describe "when passed src, alt" do
- it "returns an 'img'-element with the passed src-url and the passed alt-text" do
- output = @html.img("/path/to/some/image.png", "Alternative")
- output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "Alternative" }, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.img("/path/to/some/image.png")
+ output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "" }, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.img("/path/to/some/image.png", "Alternative") { "test" }
- output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "Alternative" }, "", not_closed: true)
- end
- end
+ describe "when passed src, alt" do
+ it "returns an 'img'-element with the passed src-url and the passed alt-text" do
+ output = @html.img("/path/to/some/image.png", "Alternative")
+ output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "Alternative" }, "", not_closed: true)
+ end
- describe "when passed src, alt, width" do
- it "returns an 'img'-element with the passed src-url, the passed alt-text and the passed width" do
- output = @html.img("/path/to/some/image.png", "Alternative", 40)
- output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "Alternative", "WIDTH" => "40" }, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.img("/path/to/some/image.png", "Alternative") { "test" }
+ output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "Alternative" }, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.img("/path/to/some/image.png", "Alternative", 40) { "test" }
- output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "Alternative", "WIDTH" => "40" }, "", not_closed: true)
- end
- end
+ describe "when passed src, alt, width" do
+ it "returns an 'img'-element with the passed src-url, the passed alt-text and the passed width" do
+ output = @html.img("/path/to/some/image.png", "Alternative", 40)
+ output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "Alternative", "WIDTH" => "40" }, "", not_closed: true)
+ end
- describe "when passed src, alt, width, height" do
- it "returns an 'img'-element with the passed src-url, the passed alt-text, the passed width and the passed height" do
- output = @html.img("/path/to/some/image.png", "Alternative", 40, 60)
- output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "Alternative", "WIDTH" => "40", "HEIGHT" => "60" }, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.img("/path/to/some/image.png", "Alternative", 40) { "test" }
+ output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "Alternative", "WIDTH" => "40" }, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.img { "test" }
- output.should equal_element("IMG", { "SRC" => "", "ALT" => "" }, "", not_closed: true)
- end
- end
+ describe "when passed src, alt, width, height" do
+ it "returns an 'img'-element with the passed src-url, the passed alt-text, the passed width and the passed height" do
+ output = @html.img("/path/to/some/image.png", "Alternative", 40, 60)
+ output.should equal_element("IMG", { "SRC" => "/path/to/some/image.png", "ALT" => "Alternative", "WIDTH" => "40", "HEIGHT" => "60" }, "", not_closed: true)
+ end
- describe "when passed Hash" do
- it "returns an 'img'-element with the passed Hash as attributes" do
- attributes = { "SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50 }
- output = @html.img(attributes)
- output.should equal_element("IMG", attributes, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.img { "test" }
+ output.should equal_element("IMG", { "SRC" => "", "ALT" => "" }, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- attributes = { "SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50 }
- output = @html.img(attributes) { "test" }
- output.should equal_element("IMG", attributes, "", not_closed: true)
+ describe "when passed Hash" do
+ it "returns an 'img'-element with the passed Hash as attributes" do
+ attributes = { "SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50 }
+ output = @html.img(attributes)
+ output.should equal_element("IMG", attributes, "", not_closed: true)
+ end
+
+ it "ignores a passed block" do
+ attributes = { "SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50 }
+ output = @html.img(attributes) { "test" }
+ output.should equal_element("IMG", attributes, "", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/multipart_form_spec.rb b/spec/ruby/library/cgi/htmlextension/multipart_form_spec.rb
index 0bf2042a33..e5c16f2475 100644
--- a/spec/ruby/library/cgi/htmlextension/multipart_form_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/multipart_form_spec.rb
@@ -1,64 +1,67 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#multipart_form" do
- before :each do
- @html = CGISpecs.cgi_new
- @html.stub!(:script_name).and_return("/path/to/some/script.rb")
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns a 'form'-element with it's enctype set to multipart" do
- output = @html.multipart_form
- output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post" }, "")
+ describe "CGI::HtmlExtension#multipart_form" do
+ before :each do
+ @html = CGISpecs.cgi_new
+ @html.stub!(:script_name).and_return("/path/to/some/script.rb")
end
- it "includes the return value of the passed block when passed a block" do
- output = @html.multipart_form { "test" }
- output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post" }, "test")
- end
- end
+ describe "when passed no arguments" do
+ it "returns a 'form'-element with it's enctype set to multipart" do
+ output = @html.multipart_form
+ output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post" }, "")
+ end
- describe "when passed action" do
- it "returns a 'form'-element with the passed action" do
- output = @html.multipart_form("/some/other/script.rb")
- output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post", "ACTION" => "/some/other/script.rb" }, "")
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.multipart_form { "test" }
+ output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post" }, "test")
+ end
end
- it "includes the return value of the passed block when passed a block" do
- output = @html.multipart_form("/some/other/script.rb") { "test" }
- output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post", "ACTION" => "/some/other/script.rb" }, "test")
- end
- end
+ describe "when passed action" do
+ it "returns a 'form'-element with the passed action" do
+ output = @html.multipart_form("/some/other/script.rb")
+ output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post", "ACTION" => "/some/other/script.rb" }, "")
+ end
- describe "when passed action, enctype" do
- it "returns a 'form'-element with the passed action and enctype" do
- output = @html.multipart_form("/some/other/script.rb", "application/x-www-form-urlencoded")
- output.should equal_element("FORM", { "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "post", "ACTION" => "/some/other/script.rb" }, "")
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.multipart_form("/some/other/script.rb") { "test" }
+ output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post", "ACTION" => "/some/other/script.rb" }, "test")
+ end
end
- it "includes the return value of the passed block when passed a block" do
- output = @html.multipart_form("/some/other/script.rb", "application/x-www-form-urlencoded") { "test" }
- output.should equal_element("FORM", { "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "post", "ACTION" => "/some/other/script.rb" }, "test")
+ describe "when passed action, enctype" do
+ it "returns a 'form'-element with the passed action and enctype" do
+ output = @html.multipart_form("/some/other/script.rb", "application/x-www-form-urlencoded")
+ output.should equal_element("FORM", { "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "post", "ACTION" => "/some/other/script.rb" }, "")
+ end
+
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.multipart_form("/some/other/script.rb", "application/x-www-form-urlencoded") { "test" }
+ output.should equal_element("FORM", { "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "post", "ACTION" => "/some/other/script.rb" }, "test")
+ end
end
- end
- describe "when passed Hash" do
- it "returns a 'form'-element with the passed Hash as attributes" do
- output = @html.multipart_form("ID" => "test")
- output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post", "ID" => "test" }, "")
+ describe "when passed Hash" do
+ it "returns a 'form'-element with the passed Hash as attributes" do
+ output = @html.multipart_form("ID" => "test")
+ output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post", "ID" => "test" }, "")
- output = @html.multipart_form("ID" => "test", "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get")
- output.should equal_element("FORM", { "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ID" => "test" }, "")
- end
+ output = @html.multipart_form("ID" => "test", "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get")
+ output.should equal_element("FORM", { "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ID" => "test" }, "")
+ end
- it "includes the return value of the passed block when passed a block" do
- output = @html.multipart_form("ID" => "test") { "test" }
- output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post", "ID" => "test" }, "test")
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.multipart_form("ID" => "test") { "test" }
+ output.should equal_element("FORM", { "ENCTYPE" => "multipart/form-data", "METHOD" => "post", "ID" => "test" }, "test")
- output = @html.multipart_form("ID" => "test", "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get") { "test" }
- output.should equal_element("FORM", { "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ID" => "test" }, "test")
+ output = @html.multipart_form("ID" => "test", "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get") { "test" }
+ output.should equal_element("FORM", { "ENCTYPE" => "application/x-www-form-urlencoded", "METHOD" => "get", "ID" => "test" }, "test")
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/password_field_spec.rb b/spec/ruby/library/cgi/htmlextension/password_field_spec.rb
index 683bc428ba..a462bea015 100644
--- a/spec/ruby/library/cgi/htmlextension/password_field_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/password_field_spec.rb
@@ -1,84 +1,87 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#password_field" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns an password-'input'-element without a name" do
- output = @html.password_field
- output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "password", "SIZE" => "40"}, "", not_closed: true)
+ describe "CGI::HtmlExtension#password_field" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "ignores a passed block" do
- output = @html.password_field { "test" }
- output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "password", "SIZE" => "40"}, "", not_closed: true)
- end
- end
+ describe "when passed no arguments" do
+ it "returns an password-'input'-element without a name" do
+ output = @html.password_field
+ output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "password", "SIZE" => "40"}, "", not_closed: true)
+ end
- describe "when passed name" do
- it "returns an password-'input'-element with the passed name" do
- output = @html.password_field("test")
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "SIZE" => "40"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.password_field { "test" }
+ output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "password", "SIZE" => "40"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.password_field("test") { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "SIZE" => "40"}, "", not_closed: true)
- end
- end
+ describe "when passed name" do
+ it "returns an password-'input'-element with the passed name" do
+ output = @html.password_field("test")
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "SIZE" => "40"}, "", not_closed: true)
+ end
- describe "when passed name, value" do
- it "returns an password-'input'-element with the passed name and value" do
- output = @html.password_field("test", "some value")
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "40"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.password_field("test") { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "SIZE" => "40"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.password_field("test", "some value") { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "40"}, "", not_closed: true)
- end
- end
+ describe "when passed name, value" do
+ it "returns an password-'input'-element with the passed name and value" do
+ output = @html.password_field("test", "some value")
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "40"}, "", not_closed: true)
+ end
- describe "when passed name, value, size" do
- it "returns an password-'input'-element with the passed name, value and size" do
- output = @html.password_field("test", "some value", 60)
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "60"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.password_field("test", "some value") { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "40"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.password_field("test", "some value", 60) { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "60"}, "", not_closed: true)
- end
- end
+ describe "when passed name, value, size" do
+ it "returns an password-'input'-element with the passed name, value and size" do
+ output = @html.password_field("test", "some value", 60)
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "60"}, "", not_closed: true)
+ end
- describe "when passed name, value, size, maxlength" do
- it "returns an password-'input'-element with the passed name, value, size and maxlength" do
- output = @html.password_field("test", "some value", 60, 12)
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "60", "MAXLENGTH" => 12}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.password_field("test", "some value", 60) { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "60"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.password_field("test", "some value", 60, 12) { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "60", "MAXLENGTH" => 12}, "", not_closed: true)
+ describe "when passed name, value, size, maxlength" do
+ it "returns an password-'input'-element with the passed name, value, size and maxlength" do
+ output = @html.password_field("test", "some value", 60, 12)
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "60", "MAXLENGTH" => 12}, "", not_closed: true)
+ end
+
+ it "ignores a passed block" do
+ output = @html.password_field("test", "some value", 60, 12) { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "password", "VALUE" => "some value", "SIZE" => "60", "MAXLENGTH" => 12}, "", not_closed: true)
+ end
end
- end
- describe "when passed Hash" do
- it "returns a checkbox-'input'-element using the passed Hash for attributes" do
- output = @html.password_field("NAME" => "test", "VALUE" => "some value")
- output.should equal_element("INPUT", { "NAME" => "test", "VALUE" => "some value", "TYPE" => "password" }, "", not_closed: true)
+ describe "when passed Hash" do
+ it "returns a checkbox-'input'-element using the passed Hash for attributes" do
+ output = @html.password_field("NAME" => "test", "VALUE" => "some value")
+ output.should equal_element("INPUT", { "NAME" => "test", "VALUE" => "some value", "TYPE" => "password" }, "", not_closed: true)
- output = @html.password_field("TYPE" => "hidden")
- output.should equal_element("INPUT", {"TYPE" => "password"}, "", not_closed: true)
- end
+ output = @html.password_field("TYPE" => "hidden")
+ output.should equal_element("INPUT", {"TYPE" => "password"}, "", not_closed: true)
+ end
- it "ignores a passed block" do
- output = @html.password_field("NAME" => "test", "VALUE" => "some value") { "test" }
- output.should equal_element("INPUT", { "NAME" => "test", "VALUE" => "some value", "TYPE" => "password" }, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.password_field("NAME" => "test", "VALUE" => "some value") { "test" }
+ output.should equal_element("INPUT", { "NAME" => "test", "VALUE" => "some value", "TYPE" => "password" }, "", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/popup_menu_spec.rb b/spec/ruby/library/cgi/htmlextension/popup_menu_spec.rb
index 3462be09b0..0ec85e96df 100644
--- a/spec/ruby/library/cgi/htmlextension/popup_menu_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/popup_menu_spec.rb
@@ -1,8 +1,11 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-require_relative 'shared/popup_menu'
-describe "CGI::HtmlExtension#popup_menu" do
- it_behaves_like :cgi_htmlextension_popup_menu, :popup_menu
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
+ require_relative 'shared/popup_menu'
+
+ describe "CGI::HtmlExtension#popup_menu" do
+ it_behaves_like :cgi_htmlextension_popup_menu, :popup_menu
+ end
end
diff --git a/spec/ruby/library/cgi/htmlextension/radio_button_spec.rb b/spec/ruby/library/cgi/htmlextension/radio_button_spec.rb
index 3dc3c879b5..865c16d232 100644
--- a/spec/ruby/library/cgi/htmlextension/radio_button_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/radio_button_spec.rb
@@ -1,77 +1,80 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#radio_button" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns a radio-'input'-element without a name" do
- output = @html.radio_button
- output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "radio"}, "", not_closed: true)
+ describe "CGI::HtmlExtension#radio_button" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "ignores a passed block" do
- output = @html.radio_button { "test" }
- output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "radio"}, "", not_closed: true)
- end
- end
+ describe "when passed no arguments" do
+ it "returns a radio-'input'-element without a name" do
+ output = @html.radio_button
+ output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "radio"}, "", not_closed: true)
+ end
- describe "when passed name" do
- it "returns a radio-'input'-element with the passed name" do
- output = @html.radio_button("test")
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.radio_button { "test" }
+ output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "radio"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.radio_button("test") { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio"}, "", not_closed: true)
- end
- end
+ describe "when passed name" do
+ it "returns a radio-'input'-element with the passed name" do
+ output = @html.radio_button("test")
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio"}, "", not_closed: true)
+ end
- describe "CGI::HtmlExtension#checkbox when passed name, value" do
- it "returns a radio-'input'-element with the passed name and value" do
- output = @html.radio_button("test", "test-value")
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.radio_button("test") { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.radio_button("test", "test-value") { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
+ describe "CGI::HtmlExtension#checkbox when passed name, value" do
+ it "returns a radio-'input'-element with the passed name and value" do
+ output = @html.radio_button("test", "test-value")
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
+ end
+
+ it "ignores a passed block" do
+ output = @html.radio_button("test", "test-value") { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
+ end
end
- end
- describe "when passed name, value, checked" do
- it "returns a checked radio-'input'-element with the passed name and value when checked is true" do
- output = @html.radio_button("test", "test-value", true)
- output.should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
+ describe "when passed name, value, checked" do
+ it "returns a checked radio-'input'-element with the passed name and value when checked is true" do
+ output = @html.radio_button("test", "test-value", true)
+ output.should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
- output = @html.radio_button("test", "test-value", false)
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
+ output = @html.radio_button("test", "test-value", false)
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
- output = @html.radio_button("test", "test-value", nil)
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
- end
+ output = @html.radio_button("test", "test-value", nil)
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
+ end
- it "ignores a passed block" do
- output = @html.radio_button("test", "test-value", nil) { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.radio_button("test", "test-value", nil) { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "test-value"}, "", not_closed: true)
+ end
end
- end
- describe "when passed Hash" do
- it "returns a radio-'input'-element using the passed Hash for attributes" do
- attributes = {"NAME" => "test", "VALUE" => "test-value", "CHECKED" => true}
- output = @html.radio_button(attributes)
- output.should equal_element("INPUT", attributes, "", not_closed: true)
- end
+ describe "when passed Hash" do
+ it "returns a radio-'input'-element using the passed Hash for attributes" do
+ attributes = {"NAME" => "test", "VALUE" => "test-value", "CHECKED" => true}
+ output = @html.radio_button(attributes)
+ output.should equal_element("INPUT", attributes, "", not_closed: true)
+ end
- it "ignores a passed block" do
- attributes = {"NAME" => "test", "VALUE" => "test-value", "CHECKED" => true}
- output = @html.radio_button(attributes) { "test" }
- output.should equal_element("INPUT", attributes, "", not_closed: true)
+ it "ignores a passed block" do
+ attributes = {"NAME" => "test", "VALUE" => "test-value", "CHECKED" => true}
+ output = @html.radio_button(attributes) { "test" }
+ output.should equal_element("INPUT", attributes, "", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/radio_group_spec.rb b/spec/ruby/library/cgi/htmlextension/radio_group_spec.rb
index 1bfd43449d..7381e7183b 100644
--- a/spec/ruby/library/cgi/htmlextension/radio_group_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/radio_group_spec.rb
@@ -1,77 +1,80 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#radio_group" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed name, values ..." do
- it "returns a sequence of 'radio'-elements with the passed name and the passed values" do
- output = CGISpecs.split(@html.radio_group("test", "foo", "bar", "baz"))
- output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
+ describe "CGI::HtmlExtension#radio_group" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "allows passing a value inside an Array" do
- output = CGISpecs.split(@html.radio_group("test", ["foo"], "bar", ["baz"]))
- output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
- end
+ describe "when passed name, values ..." do
+ it "returns a sequence of 'radio'-elements with the passed name and the passed values" do
+ output = CGISpecs.split(@html.radio_group("test", "foo", "bar", "baz"))
+ output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
+ end
- it "allows passing a value as an Array containing the value and the checked state or a label" do
- output = CGISpecs.split(@html.radio_group("test", ["foo"], ["bar", true], ["baz", "label for baz"]))
- output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "label for baz", not_closed: true)
- end
+ it "allows passing a value inside an Array" do
+ output = CGISpecs.split(@html.radio_group("test", ["foo"], "bar", ["baz"]))
+ output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
+ end
- # TODO: CGI does not like passing false instead of true.
- it "allows passing a value as an Array containing the value, a label and the checked state" do
- output = CGISpecs.split(@html.radio_group("test", ["foo", "label for foo", true], ["bar", "label for bar", false], ["baz", "label for baz", true]))
- output[0].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "label for foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "label for bar", not_closed: true)
- output[2].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "label for baz", not_closed: true)
- end
+ it "allows passing a value as an Array containing the value and the checked state or a label" do
+ output = CGISpecs.split(@html.radio_group("test", ["foo"], ["bar", true], ["baz", "label for baz"]))
+ output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "label for baz", not_closed: true)
+ end
- it "returns an empty String when passed no values" do
- @html.radio_group("test").should == ""
- end
+ # TODO: CGI does not like passing false instead of true.
+ it "allows passing a value as an Array containing the value, a label and the checked state" do
+ output = CGISpecs.split(@html.radio_group("test", ["foo", "label for foo", true], ["bar", "label for bar", false], ["baz", "label for baz", true]))
+ output[0].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "label for foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "label for bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "label for baz", not_closed: true)
+ end
+
+ it "returns an empty String when passed no values" do
+ @html.radio_group("test").should == ""
+ end
- it "ignores a passed block" do
- output = CGISpecs.split(@html.radio_group("test", "foo", "bar", "baz") { "test" })
- output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
+ it "ignores a passed block" do
+ output = CGISpecs.split(@html.radio_group("test", "foo", "bar", "baz") { "test" })
+ output[0].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "test", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
+ end
end
- end
- describe "when passed Hash" do
- it "uses the passed Hash to generate the radio sequence" do
- output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => ["foo", "bar", "baz"]))
- output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
+ describe "when passed Hash" do
+ it "uses the passed Hash to generate the radio sequence" do
+ output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => ["foo", "bar", "baz"]))
+ output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
- output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => [["foo"], ["bar", true], "baz"]))
- output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "name", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
+ output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => [["foo"], ["bar", true], "baz"]))
+ output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "name", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
- output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"]))
- output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "1"}, "Foo", not_closed: true)
- output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "name", "TYPE" => "radio", "VALUE" => "2"}, "Bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "Baz"}, "Baz", not_closed: true)
- end
+ output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"]))
+ output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "1"}, "Foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"CHECKED" => true, "NAME" => "name", "TYPE" => "radio", "VALUE" => "2"}, "Bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "Baz"}, "Baz", not_closed: true)
+ end
- it "ignores a passed block" do
- output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => ["foo", "bar", "baz"]) { "test" })
- output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
- output[1].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
- output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
+ it "ignores a passed block" do
+ output = CGISpecs.split(@html.radio_group("NAME" => "name", "VALUES" => ["foo", "bar", "baz"]) { "test" })
+ output[0].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "foo"}, "foo", not_closed: true)
+ output[1].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "bar"}, "bar", not_closed: true)
+ output[2].should equal_element("INPUT", {"NAME" => "name", "TYPE" => "radio", "VALUE" => "baz"}, "baz", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/reset_spec.rb b/spec/ruby/library/cgi/htmlextension/reset_spec.rb
index 86fa25fc8a..d3a5c801fa 100644
--- a/spec/ruby/library/cgi/htmlextension/reset_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/reset_spec.rb
@@ -1,57 +1,60 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#reset" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns a reset-'input'-element" do
- output = @html.reset
- output.should equal_element("INPUT", {"TYPE" => "reset"}, "", not_closed: true)
+ describe "CGI::HtmlExtension#reset" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "ignores a passed block" do
- output = @html.reset { "test" }
- output.should equal_element("INPUT", {"TYPE" => "reset"}, "", not_closed: true)
- end
- end
+ describe "when passed no arguments" do
+ it "returns a reset-'input'-element" do
+ output = @html.reset
+ output.should equal_element("INPUT", {"TYPE" => "reset"}, "", not_closed: true)
+ end
- describe "when passed value" do
- it "returns a reset-'input'-element with the passed value" do
- output = @html.reset("Example")
- output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.reset { "test" }
+ output.should equal_element("INPUT", {"TYPE" => "reset"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.reset("Example") { "test" }
- output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example"}, "", not_closed: true)
- end
- end
+ describe "when passed value" do
+ it "returns a reset-'input'-element with the passed value" do
+ output = @html.reset("Example")
+ output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example"}, "", not_closed: true)
+ end
- describe "when passed value, name" do
- it "returns a reset-'input'-element with the passed value and the passed name" do
- output = @html.reset("Example", "test-name")
- output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example", "NAME" => "test-name"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.reset("Example") { "test" }
+ output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.reset("Example", "test-name") { "test" }
- output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example", "NAME" => "test-name"}, "", not_closed: true)
- end
- end
+ describe "when passed value, name" do
+ it "returns a reset-'input'-element with the passed value and the passed name" do
+ output = @html.reset("Example", "test-name")
+ output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example", "NAME" => "test-name"}, "", not_closed: true)
+ end
- describe "when passed Hash" do
- it "returns a reset-'input'-element with the passed value" do
- output = @html.reset("Example")
- output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.reset("Example", "test-name") { "test" }
+ output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example", "NAME" => "test-name"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.reset("Example") { "test" }
- output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example"}, "", not_closed: true)
+ describe "when passed Hash" do
+ it "returns a reset-'input'-element with the passed value" do
+ output = @html.reset("Example")
+ output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example"}, "", not_closed: true)
+ end
+
+ it "ignores a passed block" do
+ output = @html.reset("Example") { "test" }
+ output.should equal_element("INPUT", {"TYPE" => "reset", "VALUE" => "Example"}, "", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/scrolling_list_spec.rb b/spec/ruby/library/cgi/htmlextension/scrolling_list_spec.rb
index 4eb0c86c1a..aab52d7409 100644
--- a/spec/ruby/library/cgi/htmlextension/scrolling_list_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/scrolling_list_spec.rb
@@ -1,8 +1,11 @@
require_relative '../../../spec_helper'
-require_relative 'fixtures/common'
-require 'cgi'
-require_relative 'shared/popup_menu'
-describe "CGI::HtmlExtension#scrolling_list" do
- it_behaves_like :cgi_htmlextension_popup_menu, :scrolling_list
+ruby_version_is ""..."3.5" do
+ require_relative 'fixtures/common'
+ require 'cgi'
+ require_relative 'shared/popup_menu'
+
+ describe "CGI::HtmlExtension#scrolling_list" do
+ it_behaves_like :cgi_htmlextension_popup_menu, :scrolling_list
+ end
end
diff --git a/spec/ruby/library/cgi/htmlextension/submit_spec.rb b/spec/ruby/library/cgi/htmlextension/submit_spec.rb
index 063891b959..3401b10356 100644
--- a/spec/ruby/library/cgi/htmlextension/submit_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/submit_spec.rb
@@ -1,57 +1,60 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#submit" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns a submit-'input'-element" do
- output = @html.submit
- output.should equal_element("INPUT", {"TYPE" => "submit"}, "", not_closed: true)
+ describe "CGI::HtmlExtension#submit" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "ignores a passed block" do
- output = @html.submit { "test" }
- output.should equal_element("INPUT", {"TYPE" => "submit"}, "", not_closed: true)
- end
- end
+ describe "when passed no arguments" do
+ it "returns a submit-'input'-element" do
+ output = @html.submit
+ output.should equal_element("INPUT", {"TYPE" => "submit"}, "", not_closed: true)
+ end
- describe "when passed value" do
- it "returns a submit-'input'-element with the passed value" do
- output = @html.submit("Example")
- output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.submit { "test" }
+ output.should equal_element("INPUT", {"TYPE" => "submit"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.submit("Example") { "test" }
- output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example"}, "", not_closed: true)
- end
- end
+ describe "when passed value" do
+ it "returns a submit-'input'-element with the passed value" do
+ output = @html.submit("Example")
+ output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example"}, "", not_closed: true)
+ end
- describe "when passed value, name" do
- it "returns a submit-'input'-element with the passed value and the passed name" do
- output = @html.submit("Example", "test-name")
- output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example", "NAME" => "test-name"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.submit("Example") { "test" }
+ output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.submit("Example", "test-name") { "test" }
- output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example", "NAME" => "test-name"}, "", not_closed: true)
- end
- end
+ describe "when passed value, name" do
+ it "returns a submit-'input'-element with the passed value and the passed name" do
+ output = @html.submit("Example", "test-name")
+ output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example", "NAME" => "test-name"}, "", not_closed: true)
+ end
- describe "when passed Hash" do
- it "returns a submit-'input'-element with the passed value" do
- output = @html.submit("Example")
- output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.submit("Example", "test-name") { "test" }
+ output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example", "NAME" => "test-name"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.submit("Example") { "test" }
- output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example"}, "", not_closed: true)
+ describe "when passed Hash" do
+ it "returns a submit-'input'-element with the passed value" do
+ output = @html.submit("Example")
+ output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example"}, "", not_closed: true)
+ end
+
+ it "ignores a passed block" do
+ output = @html.submit("Example") { "test" }
+ output.should equal_element("INPUT", {"TYPE" => "submit", "VALUE" => "Example"}, "", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/text_field_spec.rb b/spec/ruby/library/cgi/htmlextension/text_field_spec.rb
index 44b5a5e69f..4f63dbce59 100644
--- a/spec/ruby/library/cgi/htmlextension/text_field_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/text_field_spec.rb
@@ -1,84 +1,87 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#text_field" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns an text-'input'-element without a name" do
- output = @html.text_field
- output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "text", "SIZE" => "40"}, "", not_closed: true)
+ describe "CGI::HtmlExtension#text_field" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "ignores a passed block" do
- output = @html.text_field { "test" }
- output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "text", "SIZE" => "40"}, "", not_closed: true)
- end
- end
+ describe "when passed no arguments" do
+ it "returns an text-'input'-element without a name" do
+ output = @html.text_field
+ output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "text", "SIZE" => "40"}, "", not_closed: true)
+ end
- describe "when passed name" do
- it "returns an text-'input'-element with the passed name" do
- output = @html.text_field("test")
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "SIZE" => "40"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.text_field { "test" }
+ output.should equal_element("INPUT", {"NAME" => "", "TYPE" => "text", "SIZE" => "40"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.text_field("test") { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "SIZE" => "40"}, "", not_closed: true)
- end
- end
+ describe "when passed name" do
+ it "returns an text-'input'-element with the passed name" do
+ output = @html.text_field("test")
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "SIZE" => "40"}, "", not_closed: true)
+ end
- describe "when passed name, value" do
- it "returns an text-'input'-element with the passed name and value" do
- output = @html.text_field("test", "some value")
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "40"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.text_field("test") { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "SIZE" => "40"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.text_field("test", "some value") { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "40"}, "", not_closed: true)
- end
- end
+ describe "when passed name, value" do
+ it "returns an text-'input'-element with the passed name and value" do
+ output = @html.text_field("test", "some value")
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "40"}, "", not_closed: true)
+ end
- describe "when passed name, value, size" do
- it "returns an text-'input'-element with the passed name, value and size" do
- output = @html.text_field("test", "some value", 60)
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "60"}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.text_field("test", "some value") { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "40"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.text_field("test", "some value", 60) { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "60"}, "", not_closed: true)
- end
- end
+ describe "when passed name, value, size" do
+ it "returns an text-'input'-element with the passed name, value and size" do
+ output = @html.text_field("test", "some value", 60)
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "60"}, "", not_closed: true)
+ end
- describe "when passed name, value, size, maxlength" do
- it "returns an text-'input'-element with the passed name, value, size and maxlength" do
- output = @html.text_field("test", "some value", 60, 12)
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "60", "MAXLENGTH" => 12}, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.text_field("test", "some value", 60) { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "60"}, "", not_closed: true)
+ end
end
- it "ignores a passed block" do
- output = @html.text_field("test", "some value", 60, 12) { "test" }
- output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "60", "MAXLENGTH" => 12}, "", not_closed: true)
+ describe "when passed name, value, size, maxlength" do
+ it "returns an text-'input'-element with the passed name, value, size and maxlength" do
+ output = @html.text_field("test", "some value", 60, 12)
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "60", "MAXLENGTH" => 12}, "", not_closed: true)
+ end
+
+ it "ignores a passed block" do
+ output = @html.text_field("test", "some value", 60, 12) { "test" }
+ output.should equal_element("INPUT", {"NAME" => "test", "TYPE" => "text", "VALUE" => "some value", "SIZE" => "60", "MAXLENGTH" => 12}, "", not_closed: true)
+ end
end
- end
- describe "when passed Hash" do
- it "returns a checkbox-'input'-element using the passed Hash for attributes" do
- output = @html.text_field("NAME" => "test", "VALUE" => "some value")
- output.should equal_element("INPUT", { "NAME" => "test", "VALUE" => "some value", "TYPE" => "text" }, "", not_closed: true)
+ describe "when passed Hash" do
+ it "returns a checkbox-'input'-element using the passed Hash for attributes" do
+ output = @html.text_field("NAME" => "test", "VALUE" => "some value")
+ output.should equal_element("INPUT", { "NAME" => "test", "VALUE" => "some value", "TYPE" => "text" }, "", not_closed: true)
- output = @html.text_field("TYPE" => "hidden")
- output.should equal_element("INPUT", {"TYPE" => "text"}, "", not_closed: true)
- end
+ output = @html.text_field("TYPE" => "hidden")
+ output.should equal_element("INPUT", {"TYPE" => "text"}, "", not_closed: true)
+ end
- it "ignores a passed block" do
- output = @html.text_field("NAME" => "test", "VALUE" => "some value") { "test" }
- output.should equal_element("INPUT", { "NAME" => "test", "VALUE" => "some value", "TYPE" => "text" }, "", not_closed: true)
+ it "ignores a passed block" do
+ output = @html.text_field("NAME" => "test", "VALUE" => "some value") { "test" }
+ output.should equal_element("INPUT", { "NAME" => "test", "VALUE" => "some value", "TYPE" => "text" }, "", not_closed: true)
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/htmlextension/textarea_spec.rb b/spec/ruby/library/cgi/htmlextension/textarea_spec.rb
index db84a973d2..a3881796fd 100644
--- a/spec/ruby/library/cgi/htmlextension/textarea_spec.rb
+++ b/spec/ruby/library/cgi/htmlextension/textarea_spec.rb
@@ -1,73 +1,76 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'fixtures/common'
-describe "CGI::HtmlExtension#textarea" do
- before :each do
- @html = CGISpecs.cgi_new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'fixtures/common'
- describe "when passed no arguments" do
- it "returns an 'textarea'-element without a name" do
- output = @html.textarea
- output.should equal_element("TEXTAREA", {"NAME" => "", "COLS" => "70", "ROWS" => "10"}, "")
+ describe "CGI::HtmlExtension#textarea" do
+ before :each do
+ @html = CGISpecs.cgi_new
end
- it "includes the return value of the passed block when passed a block" do
- output = @html.textarea { "Example" }
- output.should equal_element("TEXTAREA", {"NAME" => "", "COLS" => "70", "ROWS" => "10"}, "Example")
- end
- end
+ describe "when passed no arguments" do
+ it "returns an 'textarea'-element without a name" do
+ output = @html.textarea
+ output.should equal_element("TEXTAREA", {"NAME" => "", "COLS" => "70", "ROWS" => "10"}, "")
+ end
- describe "when passed name" do
- it "returns an 'textarea'-element with the passed name" do
- output = @html.textarea("test")
- output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "70", "ROWS" => "10"}, "")
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.textarea { "Example" }
+ output.should equal_element("TEXTAREA", {"NAME" => "", "COLS" => "70", "ROWS" => "10"}, "Example")
+ end
end
- it "includes the return value of the passed block when passed a block" do
- output = @html.textarea("test") { "Example" }
- output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "70", "ROWS" => "10"}, "Example")
- end
- end
+ describe "when passed name" do
+ it "returns an 'textarea'-element with the passed name" do
+ output = @html.textarea("test")
+ output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "70", "ROWS" => "10"}, "")
+ end
- describe "when passed name, cols" do
- it "returns an 'textarea'-element with the passed name and the passed amount of columns" do
- output = @html.textarea("test", 40)
- output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "40", "ROWS" => "10"}, "")
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.textarea("test") { "Example" }
+ output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "70", "ROWS" => "10"}, "Example")
+ end
end
- it "includes the return value of the passed block when passed a block" do
- output = @html.textarea("test", 40) { "Example" }
- output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "40", "ROWS" => "10"}, "Example")
- end
- end
+ describe "when passed name, cols" do
+ it "returns an 'textarea'-element with the passed name and the passed amount of columns" do
+ output = @html.textarea("test", 40)
+ output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "40", "ROWS" => "10"}, "")
+ end
- describe "when passed name, cols, rows" do
- it "returns an 'textarea'-element with the passed name, the passed amount of columns and the passed number of rows" do
- output = @html.textarea("test", 40, 5)
- output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "40", "ROWS" => "5"}, "")
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.textarea("test", 40) { "Example" }
+ output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "40", "ROWS" => "10"}, "Example")
+ end
end
- it "includes the return value of the passed block when passed a block" do
- output = @html.textarea("test", 40, 5) { "Example" }
- output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "40", "ROWS" => "5"}, "Example")
+ describe "when passed name, cols, rows" do
+ it "returns an 'textarea'-element with the passed name, the passed amount of columns and the passed number of rows" do
+ output = @html.textarea("test", 40, 5)
+ output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "40", "ROWS" => "5"}, "")
+ end
+
+ it "includes the return value of the passed block when passed a block" do
+ output = @html.textarea("test", 40, 5) { "Example" }
+ output.should equal_element("TEXTAREA", {"NAME" => "test", "COLS" => "40", "ROWS" => "5"}, "Example")
+ end
end
- end
- describe "when passed Hash" do
- it "uses the passed Hash as attributes" do
- @html.textarea("ID" => "test").should == '<TEXTAREA ID="test"></TEXTAREA>'
+ describe "when passed Hash" do
+ it "uses the passed Hash as attributes" do
+ @html.textarea("ID" => "test").should == '<TEXTAREA ID="test"></TEXTAREA>'
- attributes = {"ID" => "test-id", "NAME" => "test-name"}
- output = @html.textarea(attributes)
- output.should equal_element("TEXTAREA", attributes, "")
- end
+ attributes = {"ID" => "test-id", "NAME" => "test-name"}
+ output = @html.textarea(attributes)
+ output.should equal_element("TEXTAREA", attributes, "")
+ end
- it "includes the return value of the passed block when passed a block" do
- attributes = {"ID" => "test-id", "NAME" => "test-name"}
- output = @html.textarea(attributes) { "test" }
- output.should equal_element("TEXTAREA", attributes, "test")
+ it "includes the return value of the passed block when passed a block" do
+ attributes = {"ID" => "test-id", "NAME" => "test-name"}
+ output = @html.textarea(attributes) { "test" }
+ output.should equal_element("TEXTAREA", attributes, "test")
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/http_header_spec.rb b/spec/ruby/library/cgi/http_header_spec.rb
index 4094bebed3..173055718b 100644
--- a/spec/ruby/library/cgi/http_header_spec.rb
+++ b/spec/ruby/library/cgi/http_header_spec.rb
@@ -1,8 +1,11 @@
require_relative '../../spec_helper'
-require 'cgi'
-require_relative 'shared/http_header'
+ruby_version_is ""..."3.5" do
+ require 'cgi'
-describe "CGI#http_header" do
- it_behaves_like :cgi_http_header, :http_header
+ require_relative 'shared/http_header'
+
+ describe "CGI#http_header" do
+ it_behaves_like :cgi_http_header, :http_header
+ end
end
diff --git a/spec/ruby/library/cgi/initialize_spec.rb b/spec/ruby/library/cgi/initialize_spec.rb
index 61bc971d49..d46b5a3564 100644
--- a/spec/ruby/library/cgi/initialize_spec.rb
+++ b/spec/ruby/library/cgi/initialize_spec.rb
@@ -1,133 +1,136 @@
require_relative '../../spec_helper'
-require 'cgi'
-describe "CGI#initialize" do
- it "is private" do
- CGI.should have_private_instance_method(:initialize)
- end
-end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
-describe "CGI#initialize when passed no arguments" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.allocate
- end
-
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
-
- it "extends self with CGI::QueryExtension" do
- @cgi.send(:initialize)
- @cgi.should be_kind_of(CGI::QueryExtension)
+ describe "CGI#initialize" do
+ it "is private" do
+ CGI.should have_private_instance_method(:initialize)
+ end
end
- it "does not extend self with CGI::HtmlExtension" do
- @cgi.send(:initialize)
- @cgi.should_not be_kind_of(CGI::HtmlExtension)
- end
+ describe "CGI#initialize when passed no arguments" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.allocate
+ end
- it "does not extend self with any of the other HTML modules" do
- @cgi.send(:initialize)
- @cgi.should_not be_kind_of(CGI::HtmlExtension)
- @cgi.should_not be_kind_of(CGI::Html3)
- @cgi.should_not be_kind_of(CGI::Html4)
- @cgi.should_not be_kind_of(CGI::Html4Tr)
- @cgi.should_not be_kind_of(CGI::Html4Fr)
- end
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "sets #cookies based on ENV['HTTP_COOKIE']" do
- begin
- old_env, ENV["HTTP_COOKIE"] = ENV["HTTP_COOKIE"], "test=test yay"
+ it "extends self with CGI::QueryExtension" do
@cgi.send(:initialize)
- @cgi.cookies.should == { "test"=>[ "test yay" ] }
- ensure
- ENV["HTTP_COOKIE"] = old_env
+ @cgi.should be_kind_of(CGI::QueryExtension)
end
- end
- it "sets #params based on ENV['QUERY_STRING'] when ENV['REQUEST_METHOD'] is GET" do
- begin
- old_env_query, ENV["QUERY_STRING"] = ENV["QUERY_STRING"], "?test=a&test2=b"
- old_env_method, ENV["REQUEST_METHOD"] = ENV["REQUEST_METHOD"], "GET"
+ it "does not extend self with CGI::HtmlExtension" do
@cgi.send(:initialize)
- @cgi.params.should == { "test2" => ["b"], "?test" => ["a"] }
- ensure
- ENV["QUERY_STRING"] = old_env_query
- ENV["REQUEST_METHOD"] = old_env_method
+ @cgi.should_not be_kind_of(CGI::HtmlExtension)
end
- end
- it "sets #params based on ENV['QUERY_STRING'] when ENV['REQUEST_METHOD'] is HEAD" do
- begin
- old_env_query, ENV["QUERY_STRING"] = ENV["QUERY_STRING"], "?test=a&test2=b"
- old_env_method, ENV["REQUEST_METHOD"] = ENV["REQUEST_METHOD"], "HEAD"
+ it "does not extend self with any of the other HTML modules" do
@cgi.send(:initialize)
- @cgi.params.should == { "test2" => ["b"], "?test" => ["a"] }
- ensure
- ENV["QUERY_STRING"] = old_env_query
- ENV["REQUEST_METHOD"] = old_env_method
+ @cgi.should_not be_kind_of(CGI::HtmlExtension)
+ @cgi.should_not be_kind_of(CGI::Html3)
+ @cgi.should_not be_kind_of(CGI::Html4)
+ @cgi.should_not be_kind_of(CGI::Html4Tr)
+ @cgi.should_not be_kind_of(CGI::Html4Fr)
end
- end
-end
-describe "CGI#initialize when passed type" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.allocate
- end
+ it "sets #cookies based on ENV['HTTP_COOKIE']" do
+ begin
+ old_env, ENV["HTTP_COOKIE"] = ENV["HTTP_COOKIE"], "test=test yay"
+ @cgi.send(:initialize)
+ @cgi.cookies.should == { "test"=>[ "test yay" ] }
+ ensure
+ ENV["HTTP_COOKIE"] = old_env
+ end
+ end
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
+ it "sets #params based on ENV['QUERY_STRING'] when ENV['REQUEST_METHOD'] is GET" do
+ begin
+ old_env_query, ENV["QUERY_STRING"] = ENV["QUERY_STRING"], "?test=a&test2=b"
+ old_env_method, ENV["REQUEST_METHOD"] = ENV["REQUEST_METHOD"], "GET"
+ @cgi.send(:initialize)
+ @cgi.params.should == { "test2" => ["b"], "?test" => ["a"] }
+ ensure
+ ENV["QUERY_STRING"] = old_env_query
+ ENV["REQUEST_METHOD"] = old_env_method
+ end
+ end
+
+ it "sets #params based on ENV['QUERY_STRING'] when ENV['REQUEST_METHOD'] is HEAD" do
+ begin
+ old_env_query, ENV["QUERY_STRING"] = ENV["QUERY_STRING"], "?test=a&test2=b"
+ old_env_method, ENV["REQUEST_METHOD"] = ENV["REQUEST_METHOD"], "HEAD"
+ @cgi.send(:initialize)
+ @cgi.params.should == { "test2" => ["b"], "?test" => ["a"] }
+ ensure
+ ENV["QUERY_STRING"] = old_env_query
+ ENV["REQUEST_METHOD"] = old_env_method
+ end
+ end
end
+ describe "CGI#initialize when passed type" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.allocate
+ end
- it "extends self with CGI::QueryExtension" do
- @cgi.send(:initialize, "test")
- @cgi.should be_kind_of(CGI::QueryExtension)
- end
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "extends self with CGI::QueryExtension, CGI::Html3 and CGI::HtmlExtension when the passed type is 'html3'" do
- @cgi.send(:initialize, "html3")
- @cgi.should be_kind_of(CGI::Html3)
- @cgi.should be_kind_of(CGI::HtmlExtension)
- @cgi.should be_kind_of(CGI::QueryExtension)
- @cgi.should_not be_kind_of(CGI::Html4)
- @cgi.should_not be_kind_of(CGI::Html4Tr)
- @cgi.should_not be_kind_of(CGI::Html4Fr)
- end
+ it "extends self with CGI::QueryExtension" do
+ @cgi.send(:initialize, "test")
+ @cgi.should be_kind_of(CGI::QueryExtension)
+ end
- it "extends self with CGI::QueryExtension, CGI::Html4 and CGI::HtmlExtension when the passed type is 'html4'" do
- @cgi.send(:initialize, "html4")
- @cgi.should be_kind_of(CGI::Html4)
- @cgi.should be_kind_of(CGI::HtmlExtension)
- @cgi.should be_kind_of(CGI::QueryExtension)
+ it "extends self with CGI::QueryExtension, CGI::Html3 and CGI::HtmlExtension when the passed type is 'html3'" do
+ @cgi.send(:initialize, "html3")
+ @cgi.should be_kind_of(CGI::Html3)
+ @cgi.should be_kind_of(CGI::HtmlExtension)
+ @cgi.should be_kind_of(CGI::QueryExtension)
- @cgi.should_not be_kind_of(CGI::Html3)
- @cgi.should_not be_kind_of(CGI::Html4Tr)
- @cgi.should_not be_kind_of(CGI::Html4Fr)
- end
+ @cgi.should_not be_kind_of(CGI::Html4)
+ @cgi.should_not be_kind_of(CGI::Html4Tr)
+ @cgi.should_not be_kind_of(CGI::Html4Fr)
+ end
- it "extends self with CGI::QueryExtension, CGI::Html4Tr and CGI::HtmlExtension when the passed type is 'html4Tr'" do
- @cgi.send(:initialize, "html4Tr")
- @cgi.should be_kind_of(CGI::Html4Tr)
- @cgi.should be_kind_of(CGI::HtmlExtension)
- @cgi.should be_kind_of(CGI::QueryExtension)
+ it "extends self with CGI::QueryExtension, CGI::Html4 and CGI::HtmlExtension when the passed type is 'html4'" do
+ @cgi.send(:initialize, "html4")
+ @cgi.should be_kind_of(CGI::Html4)
+ @cgi.should be_kind_of(CGI::HtmlExtension)
+ @cgi.should be_kind_of(CGI::QueryExtension)
- @cgi.should_not be_kind_of(CGI::Html3)
- @cgi.should_not be_kind_of(CGI::Html4)
- @cgi.should_not be_kind_of(CGI::Html4Fr)
- end
+ @cgi.should_not be_kind_of(CGI::Html3)
+ @cgi.should_not be_kind_of(CGI::Html4Tr)
+ @cgi.should_not be_kind_of(CGI::Html4Fr)
+ end
- it "extends self with CGI::QueryExtension, CGI::Html4Tr, CGI::Html4Fr and CGI::HtmlExtension when the passed type is 'html4Fr'" do
- @cgi.send(:initialize, "html4Fr")
- @cgi.should be_kind_of(CGI::Html4Tr)
- @cgi.should be_kind_of(CGI::Html4Fr)
- @cgi.should be_kind_of(CGI::HtmlExtension)
- @cgi.should be_kind_of(CGI::QueryExtension)
+ it "extends self with CGI::QueryExtension, CGI::Html4Tr and CGI::HtmlExtension when the passed type is 'html4Tr'" do
+ @cgi.send(:initialize, "html4Tr")
+ @cgi.should be_kind_of(CGI::Html4Tr)
+ @cgi.should be_kind_of(CGI::HtmlExtension)
+ @cgi.should be_kind_of(CGI::QueryExtension)
- @cgi.should_not be_kind_of(CGI::Html3)
- @cgi.should_not be_kind_of(CGI::Html4)
+ @cgi.should_not be_kind_of(CGI::Html3)
+ @cgi.should_not be_kind_of(CGI::Html4)
+ @cgi.should_not be_kind_of(CGI::Html4Fr)
+ end
+
+ it "extends self with CGI::QueryExtension, CGI::Html4Tr, CGI::Html4Fr and CGI::HtmlExtension when the passed type is 'html4Fr'" do
+ @cgi.send(:initialize, "html4Fr")
+ @cgi.should be_kind_of(CGI::Html4Tr)
+ @cgi.should be_kind_of(CGI::Html4Fr)
+ @cgi.should be_kind_of(CGI::HtmlExtension)
+ @cgi.should be_kind_of(CGI::QueryExtension)
+
+ @cgi.should_not be_kind_of(CGI::Html3)
+ @cgi.should_not be_kind_of(CGI::Html4)
+ end
end
end
diff --git a/spec/ruby/library/cgi/out_spec.rb b/spec/ruby/library/cgi/out_spec.rb
index bc09f5bcbb..c79d000284 100644
--- a/spec/ruby/library/cgi/out_spec.rb
+++ b/spec/ruby/library/cgi/out_spec.rb
@@ -1,51 +1,54 @@
require_relative '../../spec_helper'
-require 'cgi'
-describe "CGI#out" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- $stdout, @old_stdout = IOStub.new, $stdout
- end
-
- after :each do
- $stdout = @old_stdout
- ENV['REQUEST_METHOD'] = @old_request_method
- end
-
- it "it writes a HTMl header based on the passed argument to $stdout" do
- @cgi.out { "" }
- $stdout.should == "Content-Type: text/html\r\nContent-Length: 0\r\n\r\n"
- end
-
- it "appends the block's return value to the HTML header" do
- @cgi.out { "test!" }
- $stdout.should == "Content-Type: text/html\r\nContent-Length: 5\r\n\r\ntest!"
- end
-
- it "automatically sets the Content-Length Header based on the block's return value" do
- @cgi.out { "0123456789" }
- $stdout.should == "Content-Type: text/html\r\nContent-Length: 10\r\n\r\n0123456789"
- end
-
- it "includes Cookies in the @output_cookies field" do
- @cgi.instance_variable_set(:@output_cookies, ["multiple", "cookies"])
- @cgi.out { "" }
- $stdout.should == "Content-Type: text/html\r\nContent-Length: 0\r\nSet-Cookie: multiple\r\nSet-Cookie: cookies\r\n\r\n"
- end
-end
-
-describe "CGI#out when passed no block" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
-
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
-
- it "raises a LocalJumpError" do
- -> { @cgi.out }.should raise_error(LocalJumpError)
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+
+ describe "CGI#out" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ $stdout, @old_stdout = IOStub.new, $stdout
+ end
+
+ after :each do
+ $stdout = @old_stdout
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
+
+ it "it writes a HTMl header based on the passed argument to $stdout" do
+ @cgi.out { "" }
+ $stdout.should == "Content-Type: text/html\r\nContent-Length: 0\r\n\r\n"
+ end
+
+ it "appends the block's return value to the HTML header" do
+ @cgi.out { "test!" }
+ $stdout.should == "Content-Type: text/html\r\nContent-Length: 5\r\n\r\ntest!"
+ end
+
+ it "automatically sets the Content-Length Header based on the block's return value" do
+ @cgi.out { "0123456789" }
+ $stdout.should == "Content-Type: text/html\r\nContent-Length: 10\r\n\r\n0123456789"
+ end
+
+ it "includes Cookies in the @output_cookies field" do
+ @cgi.instance_variable_set(:@output_cookies, ["multiple", "cookies"])
+ @cgi.out { "" }
+ $stdout.should == "Content-Type: text/html\r\nContent-Length: 0\r\nSet-Cookie: multiple\r\nSet-Cookie: cookies\r\n\r\n"
+ end
+ end
+
+ describe "CGI#out when passed no block" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
+
+ it "raises a LocalJumpError" do
+ -> { @cgi.out }.should raise_error(LocalJumpError)
+ end
end
end
diff --git a/spec/ruby/library/cgi/parse_spec.rb b/spec/ruby/library/cgi/parse_spec.rb
index 04539b1226..d35d0d3365 100644
--- a/spec/ruby/library/cgi/parse_spec.rb
+++ b/spec/ruby/library/cgi/parse_spec.rb
@@ -1,24 +1,27 @@
require_relative '../../spec_helper'
-require 'cgi'
-describe "CGI.parse when passed String" do
- it "parses a HTTP Query String into a Hash" do
- CGI.parse("test=test&a=b").should == { "a" => ["b"], "test" => ["test"] }
- CGI.parse("test=1,2,3").should == { "test" => ["1,2,3"] }
- CGI.parse("test=a&a=&b=").should == { "test" => ["a"], "a" => [""], "b" => [""] }
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- it "parses query strings with semicolons in place of ampersands" do
- CGI.parse("test=test;a=b").should == { "a" => ["b"], "test" => ["test"] }
- CGI.parse("test=a;a=;b=").should == { "test" => ["a"], "a" => [""], "b" => [""] }
- end
+ describe "CGI.parse when passed String" do
+ it "parses a HTTP Query String into a Hash" do
+ CGI.parse("test=test&a=b").should == { "a" => ["b"], "test" => ["test"] }
+ CGI.parse("test=1,2,3").should == { "test" => ["1,2,3"] }
+ CGI.parse("test=a&a=&b=").should == { "test" => ["a"], "a" => [""], "b" => [""] }
+ end
- it "allows passing multiple values for one key" do
- CGI.parse("test=1&test=2&test=3").should == { "test" => ["1", "2", "3"] }
- CGI.parse("test[]=1&test[]=2&test[]=3").should == { "test[]" => [ "1", "2", "3" ] }
- end
+ it "parses query strings with semicolons in place of ampersands" do
+ CGI.parse("test=test;a=b").should == { "a" => ["b"], "test" => ["test"] }
+ CGI.parse("test=a;a=;b=").should == { "test" => ["a"], "a" => [""], "b" => [""] }
+ end
+
+ it "allows passing multiple values for one key" do
+ CGI.parse("test=1&test=2&test=3").should == { "test" => ["1", "2", "3"] }
+ CGI.parse("test[]=1&test[]=2&test[]=3").should == { "test[]" => [ "1", "2", "3" ] }
+ end
- it "unescapes keys and values" do
- CGI.parse("hello%3F=hello%21").should == { "hello?" => ["hello!"] }
+ it "unescapes keys and values" do
+ CGI.parse("hello%3F=hello%21").should == { "hello?" => ["hello!"] }
+ end
end
end
diff --git a/spec/ruby/library/cgi/pretty_spec.rb b/spec/ruby/library/cgi/pretty_spec.rb
index a7b7505c15..1fed3bbd2e 100644
--- a/spec/ruby/library/cgi/pretty_spec.rb
+++ b/spec/ruby/library/cgi/pretty_spec.rb
@@ -1,24 +1,27 @@
require_relative '../../spec_helper'
-require 'cgi'
-describe "CGI.pretty when passed html" do
- it "indents the passed html String with two spaces" do
- CGI.pretty("<HTML><BODY></BODY></HTML>").should == <<-EOS
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+
+ describe "CGI.pretty when passed html" do
+ it "indents the passed html String with two spaces" do
+ CGI.pretty("<HTML><BODY></BODY></HTML>").should == <<-EOS
<HTML>
<BODY>
</BODY>
</HTML>
EOS
+ end
end
-end
-describe "CGI.pretty when passed html, indentation_unit" do
- it "indents the passed html String with the passed indentation_unit" do
- CGI.pretty("<HTML><BODY></BODY></HTML>", "\t").should == <<-EOS
+ describe "CGI.pretty when passed html, indentation_unit" do
+ it "indents the passed html String with the passed indentation_unit" do
+ CGI.pretty("<HTML><BODY></BODY></HTML>", "\t").should == <<-EOS
<HTML>
\t<BODY>
\t</BODY>
</HTML>
EOS
+ end
end
end
diff --git a/spec/ruby/library/cgi/print_spec.rb b/spec/ruby/library/cgi/print_spec.rb
index 18ab8d673b..5057c280a0 100644
--- a/spec/ruby/library/cgi/print_spec.rb
+++ b/spec/ruby/library/cgi/print_spec.rb
@@ -1,26 +1,29 @@
require_relative '../../spec_helper'
-require 'cgi'
-describe "CGI#print" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI#print" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
- it "passes all arguments to $stdout.print" do
- $stdout.should_receive(:print).with("test")
- @cgi.print("test")
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- $stdout.should_receive(:print).with("one", "two", "three", ["four", "five"])
- @cgi.print("one", "two", "three", ["four", "five"])
- end
+ it "passes all arguments to $stdout.print" do
+ $stdout.should_receive(:print).with("test")
+ @cgi.print("test")
+
+ $stdout.should_receive(:print).with("one", "two", "three", ["four", "five"])
+ @cgi.print("one", "two", "three", ["four", "five"])
+ end
- it "returns the result of calling $stdout.print" do
- $stdout.should_receive(:print).with("test").and_return(:expected)
- @cgi.print("test").should == :expected
+ it "returns the result of calling $stdout.print" do
+ $stdout.should_receive(:print).with("test").and_return(:expected)
+ @cgi.print("test").should == :expected
+ end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/accept_charset_spec.rb b/spec/ruby/library/cgi/queryextension/accept_charset_spec.rb
index 0487569b9c..9bfc833a3b 100644
--- a/spec/ruby/library/cgi/queryextension/accept_charset_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/accept_charset_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#accept_charset" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#accept_charset" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_ACCEPT_CHARSET']" do
- old_value, ENV['HTTP_ACCEPT_CHARSET'] = ENV['HTTP_ACCEPT_CHARSET'], "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
- begin
- @cgi.accept_charset.should == "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
- ensure
- ENV['HTTP_ACCEPT_CHARSET'] = old_value
+ it "returns ENV['HTTP_ACCEPT_CHARSET']" do
+ old_value, ENV['HTTP_ACCEPT_CHARSET'] = ENV['HTTP_ACCEPT_CHARSET'], "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
+ begin
+ @cgi.accept_charset.should == "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
+ ensure
+ ENV['HTTP_ACCEPT_CHARSET'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/accept_encoding_spec.rb b/spec/ruby/library/cgi/queryextension/accept_encoding_spec.rb
index 35ff3c2b30..f0d7f2058a 100644
--- a/spec/ruby/library/cgi/queryextension/accept_encoding_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/accept_encoding_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#accept_encoding" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#accept_encoding" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_ACCEPT_ENCODING']" do
- old_value, ENV['HTTP_ACCEPT_ENCODING'] = ENV['HTTP_ACCEPT_ENCODING'], "gzip,deflate"
- begin
- @cgi.accept_encoding.should == "gzip,deflate"
- ensure
- ENV['HTTP_ACCEPT_ENCODING'] = old_value
+ it "returns ENV['HTTP_ACCEPT_ENCODING']" do
+ old_value, ENV['HTTP_ACCEPT_ENCODING'] = ENV['HTTP_ACCEPT_ENCODING'], "gzip,deflate"
+ begin
+ @cgi.accept_encoding.should == "gzip,deflate"
+ ensure
+ ENV['HTTP_ACCEPT_ENCODING'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/accept_language_spec.rb b/spec/ruby/library/cgi/queryextension/accept_language_spec.rb
index 4a15d58914..e3dfcd0324 100644
--- a/spec/ruby/library/cgi/queryextension/accept_language_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/accept_language_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#accept_language" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#accept_language" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_ACCEPT_LANGUAGE']" do
- old_value, ENV['HTTP_ACCEPT_LANGUAGE'] = ENV['HTTP_ACCEPT_LANGUAGE'], "en-us,en;q=0.5"
- begin
- @cgi.accept_language.should == "en-us,en;q=0.5"
- ensure
- ENV['HTTP_ACCEPT_LANGUAGE'] = old_value
+ it "returns ENV['HTTP_ACCEPT_LANGUAGE']" do
+ old_value, ENV['HTTP_ACCEPT_LANGUAGE'] = ENV['HTTP_ACCEPT_LANGUAGE'], "en-us,en;q=0.5"
+ begin
+ @cgi.accept_language.should == "en-us,en;q=0.5"
+ ensure
+ ENV['HTTP_ACCEPT_LANGUAGE'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/accept_spec.rb b/spec/ruby/library/cgi/queryextension/accept_spec.rb
index af5209ffbe..9370a885a4 100644
--- a/spec/ruby/library/cgi/queryextension/accept_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/accept_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#accept" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#accept" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_ACCEPT']" do
- old_value, ENV['HTTP_ACCEPT'] = ENV['HTTP_ACCEPT'], "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
- begin
- @cgi.accept.should == "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
- ensure
- ENV['HTTP_ACCEPT'] = old_value
+ it "returns ENV['HTTP_ACCEPT']" do
+ old_value, ENV['HTTP_ACCEPT'] = ENV['HTTP_ACCEPT'], "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
+ begin
+ @cgi.accept.should == "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
+ ensure
+ ENV['HTTP_ACCEPT'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/auth_type_spec.rb b/spec/ruby/library/cgi/queryextension/auth_type_spec.rb
index 25318269b1..c858436037 100644
--- a/spec/ruby/library/cgi/queryextension/auth_type_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/auth_type_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#auth_type" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#auth_type" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['AUTH_TYPE']" do
- old_value, ENV['AUTH_TYPE'] = ENV['AUTH_TYPE'], "Basic"
- begin
- @cgi.auth_type.should == "Basic"
- ensure
- ENV['AUTH_TYPE'] = old_value
+ it "returns ENV['AUTH_TYPE']" do
+ old_value, ENV['AUTH_TYPE'] = ENV['AUTH_TYPE'], "Basic"
+ begin
+ @cgi.auth_type.should == "Basic"
+ ensure
+ ENV['AUTH_TYPE'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/cache_control_spec.rb b/spec/ruby/library/cgi/queryextension/cache_control_spec.rb
index 0471307c22..d42421126c 100644
--- a/spec/ruby/library/cgi/queryextension/cache_control_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/cache_control_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#cache_control" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#cache_control" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_CACHE_CONTROL']" do
- old_value, ENV['HTTP_CACHE_CONTROL'] = ENV['HTTP_CACHE_CONTROL'], "no-cache"
- begin
- @cgi.cache_control.should == "no-cache"
- ensure
- ENV['HTTP_CACHE_CONTROL'] = old_value
+ it "returns ENV['HTTP_CACHE_CONTROL']" do
+ old_value, ENV['HTTP_CACHE_CONTROL'] = ENV['HTTP_CACHE_CONTROL'], "no-cache"
+ begin
+ @cgi.cache_control.should == "no-cache"
+ ensure
+ ENV['HTTP_CACHE_CONTROL'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/content_length_spec.rb b/spec/ruby/library/cgi/queryextension/content_length_spec.rb
index de823f7119..2e3dca6f58 100644
--- a/spec/ruby/library/cgi/queryextension/content_length_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/content_length_spec.rb
@@ -1,26 +1,29 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#content_length" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#content_length" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['CONTENT_LENGTH'] as Integer" do
- old_value = ENV['CONTENT_LENGTH']
- begin
- ENV['CONTENT_LENGTH'] = nil
- @cgi.content_length.should be_nil
+ it "returns ENV['CONTENT_LENGTH'] as Integer" do
+ old_value = ENV['CONTENT_LENGTH']
+ begin
+ ENV['CONTENT_LENGTH'] = nil
+ @cgi.content_length.should be_nil
- ENV['CONTENT_LENGTH'] = "100"
- @cgi.content_length.should eql(100)
- ensure
- ENV['CONTENT_LENGTH'] = old_value
+ ENV['CONTENT_LENGTH'] = "100"
+ @cgi.content_length.should eql(100)
+ ensure
+ ENV['CONTENT_LENGTH'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/content_type_spec.rb b/spec/ruby/library/cgi/queryextension/content_type_spec.rb
index 49b8389c87..ce1be28571 100644
--- a/spec/ruby/library/cgi/queryextension/content_type_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/content_type_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#content_type" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#content_type" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['CONTENT_TYPE']" do
- old_value, ENV['CONTENT_TYPE'] = ENV['CONTENT_TYPE'], "text/html"
- begin
- @cgi.content_type.should == "text/html"
- ensure
- ENV['CONTENT_TYPE'] = old_value
+ it "returns ENV['CONTENT_TYPE']" do
+ old_value, ENV['CONTENT_TYPE'] = ENV['CONTENT_TYPE'], "text/html"
+ begin
+ @cgi.content_type.should == "text/html"
+ ensure
+ ENV['CONTENT_TYPE'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/cookies_spec.rb b/spec/ruby/library/cgi/queryextension/cookies_spec.rb
index 4befd61ab7..029ad5991a 100644
--- a/spec/ruby/library/cgi/queryextension/cookies_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/cookies_spec.rb
@@ -1,10 +1,13 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#cookies" do
- it "needs to be reviewed for spec completeness"
-end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+
+ describe "CGI::QueryExtension#cookies" do
+ it "needs to be reviewed for spec completeness"
+ end
-describe "CGI::QueryExtension#cookies=" do
- it "needs to be reviewed for spec completeness"
+ describe "CGI::QueryExtension#cookies=" do
+ it "needs to be reviewed for spec completeness"
+ end
end
diff --git a/spec/ruby/library/cgi/queryextension/element_reference_spec.rb b/spec/ruby/library/cgi/queryextension/element_reference_spec.rb
index 6ac5b46407..df1c372ab7 100644
--- a/spec/ruby/library/cgi/queryextension/element_reference_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/element_reference_spec.rb
@@ -1,27 +1,30 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#[]" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- ENV['QUERY_STRING'], @old_query_string = "one=a&two=b&two=c", ENV['QUERY_STRING']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- ENV['QUERY_STRING'] = @old_query_string
- end
+ describe "CGI::QueryExtension#[]" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ ENV['QUERY_STRING'], @old_query_string = "one=a&two=b&two=c", ENV['QUERY_STRING']
+ @cgi = CGI.new
+ end
- it "it returns the value for the parameter with the given key" do
- @cgi["one"].should == "a"
- end
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ ENV['QUERY_STRING'] = @old_query_string
+ end
- it "only returns the first value for parameters with multiple values" do
- @cgi["two"].should == "b"
- end
+ it "it returns the value for the parameter with the given key" do
+ @cgi["one"].should == "a"
+ end
+
+ it "only returns the first value for parameters with multiple values" do
+ @cgi["two"].should == "b"
+ end
- it "returns a String" do
- @cgi["one"].should be_kind_of(String)
+ it "returns a String" do
+ @cgi["one"].should be_kind_of(String)
+ end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/from_spec.rb b/spec/ruby/library/cgi/queryextension/from_spec.rb
index 04a992cfc7..8d278f5318 100644
--- a/spec/ruby/library/cgi/queryextension/from_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/from_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#from" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#from" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_FROM']" do
- old_value, ENV['HTTP_FROM'] = ENV['HTTP_FROM'], "googlebot(at)googlebot.com"
- begin
- @cgi.from.should == "googlebot(at)googlebot.com"
- ensure
- ENV['HTTP_FROM'] = old_value
+ it "returns ENV['HTTP_FROM']" do
+ old_value, ENV['HTTP_FROM'] = ENV['HTTP_FROM'], "googlebot(at)googlebot.com"
+ begin
+ @cgi.from.should == "googlebot(at)googlebot.com"
+ ensure
+ ENV['HTTP_FROM'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/gateway_interface_spec.rb b/spec/ruby/library/cgi/queryextension/gateway_interface_spec.rb
index 3ead5bd8bf..d519b80e32 100644
--- a/spec/ruby/library/cgi/queryextension/gateway_interface_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/gateway_interface_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#gateway_interface" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#gateway_interface" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['GATEWAY_INTERFACE']" do
- old_value, ENV['GATEWAY_INTERFACE'] = ENV['GATEWAY_INTERFACE'], "CGI/1.1"
- begin
- @cgi.gateway_interface.should == "CGI/1.1"
- ensure
- ENV['GATEWAY_INTERFACE'] = old_value
+ it "returns ENV['GATEWAY_INTERFACE']" do
+ old_value, ENV['GATEWAY_INTERFACE'] = ENV['GATEWAY_INTERFACE'], "CGI/1.1"
+ begin
+ @cgi.gateway_interface.should == "CGI/1.1"
+ ensure
+ ENV['GATEWAY_INTERFACE'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/has_key_spec.rb b/spec/ruby/library/cgi/queryextension/has_key_spec.rb
index 525b45b507..5892ecaf77 100644
--- a/spec/ruby/library/cgi/queryextension/has_key_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/has_key_spec.rb
@@ -1,7 +1,10 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'shared/has_key'
-describe "CGI::QueryExtension#has_key?" do
- it_behaves_like :cgi_query_extension_has_key_p, :has_key?
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'shared/has_key'
+
+ describe "CGI::QueryExtension#has_key?" do
+ it_behaves_like :cgi_query_extension_has_key_p, :has_key?
+ end
end
diff --git a/spec/ruby/library/cgi/queryextension/host_spec.rb b/spec/ruby/library/cgi/queryextension/host_spec.rb
index e820e0afc3..2eaf1330c0 100644
--- a/spec/ruby/library/cgi/queryextension/host_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/host_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#host" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#host" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_HOST']" do
- old_value, ENV['HTTP_HOST'] = ENV['HTTP_HOST'], "localhost"
- begin
- @cgi.host.should == "localhost"
- ensure
- ENV['HTTP_HOST'] = old_value
+ it "returns ENV['HTTP_HOST']" do
+ old_value, ENV['HTTP_HOST'] = ENV['HTTP_HOST'], "localhost"
+ begin
+ @cgi.host.should == "localhost"
+ ensure
+ ENV['HTTP_HOST'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/include_spec.rb b/spec/ruby/library/cgi/queryextension/include_spec.rb
index 12365ea284..18520c4aaf 100644
--- a/spec/ruby/library/cgi/queryextension/include_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/include_spec.rb
@@ -1,7 +1,10 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'shared/has_key'
-describe "CGI::QueryExtension#include?" do
- it_behaves_like :cgi_query_extension_has_key_p, :include?
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'shared/has_key'
+
+ describe "CGI::QueryExtension#include?" do
+ it_behaves_like :cgi_query_extension_has_key_p, :include?
+ end
end
diff --git a/spec/ruby/library/cgi/queryextension/key_spec.rb b/spec/ruby/library/cgi/queryextension/key_spec.rb
index d0f1e4cee2..c8c5870eba 100644
--- a/spec/ruby/library/cgi/queryextension/key_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/key_spec.rb
@@ -1,7 +1,10 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require_relative 'shared/has_key'
-describe "CGI::QueryExtension#key?" do
- it_behaves_like :cgi_query_extension_has_key_p, :key?
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require_relative 'shared/has_key'
+
+ describe "CGI::QueryExtension#key?" do
+ it_behaves_like :cgi_query_extension_has_key_p, :key?
+ end
end
diff --git a/spec/ruby/library/cgi/queryextension/keys_spec.rb b/spec/ruby/library/cgi/queryextension/keys_spec.rb
index 14d77180fa..0c35404103 100644
--- a/spec/ruby/library/cgi/queryextension/keys_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/keys_spec.rb
@@ -1,20 +1,23 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#keys" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- ENV['QUERY_STRING'], @old_query_string = "one=a&two=b", ENV['QUERY_STRING']
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- @cgi = CGI.new
- end
+ describe "CGI::QueryExtension#keys" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ ENV['QUERY_STRING'], @old_query_string = "one=a&two=b", ENV['QUERY_STRING']
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- ENV['QUERY_STRING'] = @old_query_string
- end
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ ENV['QUERY_STRING'] = @old_query_string
+ end
- it "returns all parameter keys as an Array" do
- @cgi.keys.sort.should == ["one", "two"]
+ it "returns all parameter keys as an Array" do
+ @cgi.keys.sort.should == ["one", "two"]
+ end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/multipart_spec.rb b/spec/ruby/library/cgi/queryextension/multipart_spec.rb
index ced4cb05a1..72c8073a5a 100644
--- a/spec/ruby/library/cgi/queryextension/multipart_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/multipart_spec.rb
@@ -1,20 +1,22 @@
require_relative '../../../spec_helper'
-require 'cgi'
-require "stringio"
-describe "CGI::QueryExtension#multipart?" do
- before :each do
- @old_stdin = $stdin
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+ require "stringio"
- @old_request_method = ENV['REQUEST_METHOD']
- @old_content_type = ENV['CONTENT_TYPE']
- @old_content_length = ENV['CONTENT_LENGTH']
+ describe "CGI::QueryExtension#multipart?" do
+ before :each do
+ @old_stdin = $stdin
- ENV['REQUEST_METHOD'] = "POST"
- ENV["CONTENT_TYPE"] = "multipart/form-data; boundary=---------------------------1137522503144128232716531729"
- ENV["CONTENT_LENGTH"] = "222"
+ @old_request_method = ENV['REQUEST_METHOD']
+ @old_content_type = ENV['CONTENT_TYPE']
+ @old_content_length = ENV['CONTENT_LENGTH']
- $stdin = StringIO.new <<-EOS
+ ENV['REQUEST_METHOD'] = "POST"
+ ENV["CONTENT_TYPE"] = "multipart/form-data; boundary=---------------------------1137522503144128232716531729"
+ ENV["CONTENT_LENGTH"] = "222"
+
+ $stdin = StringIO.new <<-EOS
-----------------------------1137522503144128232716531729\r
Content-Disposition: form-data; name="file"; filename=""\r
Content-Type: application/octet-stream\r
@@ -23,18 +25,19 @@ Content-Type: application/octet-stream\r
-----------------------------1137522503144128232716531729--\r
EOS
- @cgi = CGI.new
- end
+ @cgi = CGI.new
+ end
- after :each do
- $stdin = @old_stdin
+ after :each do
+ $stdin = @old_stdin
- ENV['REQUEST_METHOD'] = @old_request_method
- ENV['CONTENT_TYPE'] = @old_content_type
- ENV['CONTENT_LENGTH'] = @old_content_length
- end
+ ENV['REQUEST_METHOD'] = @old_request_method
+ ENV['CONTENT_TYPE'] = @old_content_type
+ ENV['CONTENT_LENGTH'] = @old_content_length
+ end
- it "returns true if the current Request is a multipart request" do
- @cgi.multipart?.should be_true
+ it "returns true if the current Request is a multipart request" do
+ @cgi.multipart?.should be_true
+ end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/negotiate_spec.rb b/spec/ruby/library/cgi/queryextension/negotiate_spec.rb
index b6fe036042..c159c6cfe2 100644
--- a/spec/ruby/library/cgi/queryextension/negotiate_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/negotiate_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#negotiate" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#negotiate" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_NEGOTIATE']" do
- old_value, ENV['HTTP_NEGOTIATE'] = ENV['HTTP_NEGOTIATE'], "trans"
- begin
- @cgi.negotiate.should == "trans"
- ensure
- ENV['HTTP_NEGOTIATE'] = old_value
+ it "returns ENV['HTTP_NEGOTIATE']" do
+ old_value, ENV['HTTP_NEGOTIATE'] = ENV['HTTP_NEGOTIATE'], "trans"
+ begin
+ @cgi.negotiate.should == "trans"
+ ensure
+ ENV['HTTP_NEGOTIATE'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/params_spec.rb b/spec/ruby/library/cgi/queryextension/params_spec.rb
index f4449e3c8a..e8b447f227 100644
--- a/spec/ruby/library/cgi/queryextension/params_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/params_spec.rb
@@ -1,37 +1,40 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#params" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- ENV['QUERY_STRING'], @old_query_string = "one=a&two=b&two=c&three", ENV['QUERY_STRING']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['QUERY_STRING'] = @old_query_string
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#params" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ ENV['QUERY_STRING'], @old_query_string = "one=a&two=b&two=c&three", ENV['QUERY_STRING']
+ @cgi = CGI.new
+ end
- it "returns the parsed HTTP Query Params" do
- @cgi.params.should == {"three"=>[], "two"=>["b", "c"], "one"=>["a"]}
- end
-end
+ after :each do
+ ENV['QUERY_STRING'] = @old_query_string
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
-describe "CGI::QueryExtension#params=" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
+ it "returns the parsed HTTP Query Params" do
+ @cgi.params.should == {"three"=>[], "two"=>["b", "c"], "one"=>["a"]}
+ end
end
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#params=" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "sets the HTTP Query Params to the passed argument" do
- @cgi.params.should == {}
+ it "sets the HTTP Query Params to the passed argument" do
+ @cgi.params.should == {}
- @cgi.params = {"one"=>["a"], "two"=>["b", "c"]}
- @cgi.params.should == {"one"=>["a"], "two"=>["b", "c"]}
+ @cgi.params = {"one"=>["a"], "two"=>["b", "c"]}
+ @cgi.params.should == {"one"=>["a"], "two"=>["b", "c"]}
+ end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/path_info_spec.rb b/spec/ruby/library/cgi/queryextension/path_info_spec.rb
index 9785df85f1..9054f1cfd3 100644
--- a/spec/ruby/library/cgi/queryextension/path_info_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/path_info_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#path_info" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#path_info" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['PATH_INFO']" do
- old_value, ENV['PATH_INFO'] = ENV['PATH_INFO'], "/test/path"
- begin
- @cgi.path_info.should == "/test/path"
- ensure
- ENV['PATH_INFO'] = old_value
+ it "returns ENV['PATH_INFO']" do
+ old_value, ENV['PATH_INFO'] = ENV['PATH_INFO'], "/test/path"
+ begin
+ @cgi.path_info.should == "/test/path"
+ ensure
+ ENV['PATH_INFO'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/path_translated_spec.rb b/spec/ruby/library/cgi/queryextension/path_translated_spec.rb
index 417a749341..4b17f6c01b 100644
--- a/spec/ruby/library/cgi/queryextension/path_translated_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/path_translated_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#path_translated" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#path_translated" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['PATH_TRANSLATED']" do
- old_value, ENV['PATH_TRANSLATED'] = ENV['PATH_TRANSLATED'], "/full/path/to/dir"
- begin
- @cgi.path_translated.should == "/full/path/to/dir"
- ensure
- ENV['PATH_TRANSLATED'] = old_value
+ it "returns ENV['PATH_TRANSLATED']" do
+ old_value, ENV['PATH_TRANSLATED'] = ENV['PATH_TRANSLATED'], "/full/path/to/dir"
+ begin
+ @cgi.path_translated.should == "/full/path/to/dir"
+ ensure
+ ENV['PATH_TRANSLATED'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/pragma_spec.rb b/spec/ruby/library/cgi/queryextension/pragma_spec.rb
index 02d5c91221..c6a9c5b973 100644
--- a/spec/ruby/library/cgi/queryextension/pragma_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/pragma_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#pragma" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#pragma" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_PRAGMA']" do
- old_value, ENV['HTTP_PRAGMA'] = ENV['HTTP_PRAGMA'], "no-cache"
- begin
- @cgi.pragma.should == "no-cache"
- ensure
- ENV['HTTP_PRAGMA'] = old_value
+ it "returns ENV['HTTP_PRAGMA']" do
+ old_value, ENV['HTTP_PRAGMA'] = ENV['HTTP_PRAGMA'], "no-cache"
+ begin
+ @cgi.pragma.should == "no-cache"
+ ensure
+ ENV['HTTP_PRAGMA'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/query_string_spec.rb b/spec/ruby/library/cgi/queryextension/query_string_spec.rb
index a6b454a7eb..ef3cb9c8fb 100644
--- a/spec/ruby/library/cgi/queryextension/query_string_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/query_string_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#query_string" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#query_string" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['QUERY_STRING']" do
- old_value, ENV['QUERY_STRING'] = ENV['QUERY_STRING'], "one=a&two=b"
- begin
- @cgi.query_string.should == "one=a&two=b"
- ensure
- ENV['QUERY_STRING'] = old_value
+ it "returns ENV['QUERY_STRING']" do
+ old_value, ENV['QUERY_STRING'] = ENV['QUERY_STRING'], "one=a&two=b"
+ begin
+ @cgi.query_string.should == "one=a&two=b"
+ ensure
+ ENV['QUERY_STRING'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/raw_cookie2_spec.rb b/spec/ruby/library/cgi/queryextension/raw_cookie2_spec.rb
index 3d7072e346..07ef00e8c5 100644
--- a/spec/ruby/library/cgi/queryextension/raw_cookie2_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/raw_cookie2_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#raw_cookie2" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#raw_cookie2" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_COOKIE2']" do
- old_value, ENV['HTTP_COOKIE2'] = ENV['HTTP_COOKIE2'], "some_cookie=data"
- begin
- @cgi.raw_cookie2.should == "some_cookie=data"
- ensure
- ENV['HTTP_COOKIE2'] = old_value
+ it "returns ENV['HTTP_COOKIE2']" do
+ old_value, ENV['HTTP_COOKIE2'] = ENV['HTTP_COOKIE2'], "some_cookie=data"
+ begin
+ @cgi.raw_cookie2.should == "some_cookie=data"
+ ensure
+ ENV['HTTP_COOKIE2'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/raw_cookie_spec.rb b/spec/ruby/library/cgi/queryextension/raw_cookie_spec.rb
index ede7b9ff87..f1ebb8ad82 100644
--- a/spec/ruby/library/cgi/queryextension/raw_cookie_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/raw_cookie_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#raw_cookie" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#raw_cookie" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_COOKIE']" do
- old_value, ENV['HTTP_COOKIE'] = ENV['HTTP_COOKIE'], "some_cookie=data"
- begin
- @cgi.raw_cookie.should == "some_cookie=data"
- ensure
- ENV['HTTP_COOKIE'] = old_value
+ it "returns ENV['HTTP_COOKIE']" do
+ old_value, ENV['HTTP_COOKIE'] = ENV['HTTP_COOKIE'], "some_cookie=data"
+ begin
+ @cgi.raw_cookie.should == "some_cookie=data"
+ ensure
+ ENV['HTTP_COOKIE'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/referer_spec.rb b/spec/ruby/library/cgi/queryextension/referer_spec.rb
index 6cd5dc96f8..737253eac9 100644
--- a/spec/ruby/library/cgi/queryextension/referer_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/referer_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#referer" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#referer" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_REFERER']" do
- old_value, ENV['HTTP_REFERER'] = ENV['HTTP_REFERER'], "example.com"
- begin
- @cgi.referer.should == "example.com"
- ensure
- ENV['HTTP_REFERER'] = old_value
+ it "returns ENV['HTTP_REFERER']" do
+ old_value, ENV['HTTP_REFERER'] = ENV['HTTP_REFERER'], "example.com"
+ begin
+ @cgi.referer.should == "example.com"
+ ensure
+ ENV['HTTP_REFERER'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/remote_addr_spec.rb b/spec/ruby/library/cgi/queryextension/remote_addr_spec.rb
index 0259402b23..e2cc696ae2 100644
--- a/spec/ruby/library/cgi/queryextension/remote_addr_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/remote_addr_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#remote_addr" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#remote_addr" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['REMOTE_ADDR']" do
- old_value, ENV['REMOTE_ADDR'] = ENV['REMOTE_ADDR'], "127.0.0.1"
- begin
- @cgi.remote_addr.should == "127.0.0.1"
- ensure
- ENV['REMOTE_ADDR'] = old_value
+ it "returns ENV['REMOTE_ADDR']" do
+ old_value, ENV['REMOTE_ADDR'] = ENV['REMOTE_ADDR'], "127.0.0.1"
+ begin
+ @cgi.remote_addr.should == "127.0.0.1"
+ ensure
+ ENV['REMOTE_ADDR'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/remote_host_spec.rb b/spec/ruby/library/cgi/queryextension/remote_host_spec.rb
index cf77e0031b..c4db9e4ffe 100644
--- a/spec/ruby/library/cgi/queryextension/remote_host_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/remote_host_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#remote_host" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#remote_host" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['REMOTE_HOST']" do
- old_value, ENV['REMOTE_HOST'] = ENV['REMOTE_HOST'], "test.host"
- begin
- @cgi.remote_host.should == "test.host"
- ensure
- ENV['REMOTE_HOST'] = old_value
+ it "returns ENV['REMOTE_HOST']" do
+ old_value, ENV['REMOTE_HOST'] = ENV['REMOTE_HOST'], "test.host"
+ begin
+ @cgi.remote_host.should == "test.host"
+ ensure
+ ENV['REMOTE_HOST'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/remote_ident_spec.rb b/spec/ruby/library/cgi/queryextension/remote_ident_spec.rb
index 5b51d6b8ee..d507b7d7be 100644
--- a/spec/ruby/library/cgi/queryextension/remote_ident_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/remote_ident_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#remote_ident" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#remote_ident" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['REMOTE_IDENT']" do
- old_value, ENV['REMOTE_IDENT'] = ENV['REMOTE_IDENT'], "no-idea-what-this-is-for"
- begin
- @cgi.remote_ident.should == "no-idea-what-this-is-for"
- ensure
- ENV['REMOTE_IDENT'] = old_value
+ it "returns ENV['REMOTE_IDENT']" do
+ old_value, ENV['REMOTE_IDENT'] = ENV['REMOTE_IDENT'], "no-idea-what-this-is-for"
+ begin
+ @cgi.remote_ident.should == "no-idea-what-this-is-for"
+ ensure
+ ENV['REMOTE_IDENT'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/remote_user_spec.rb b/spec/ruby/library/cgi/queryextension/remote_user_spec.rb
index 1a93bb6561..ceee410797 100644
--- a/spec/ruby/library/cgi/queryextension/remote_user_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/remote_user_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#remote_user" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#remote_user" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['REMOTE_USER']" do
- old_value, ENV['REMOTE_USER'] = ENV['REMOTE_USER'], "username"
- begin
- @cgi.remote_user.should == "username"
- ensure
- ENV['REMOTE_USER'] = old_value
+ it "returns ENV['REMOTE_USER']" do
+ old_value, ENV['REMOTE_USER'] = ENV['REMOTE_USER'], "username"
+ begin
+ @cgi.remote_user.should == "username"
+ ensure
+ ENV['REMOTE_USER'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/request_method_spec.rb b/spec/ruby/library/cgi/queryextension/request_method_spec.rb
index eabdd6998b..b540280261 100644
--- a/spec/ruby/library/cgi/queryextension/request_method_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/request_method_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#request_method" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#request_method" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['REQUEST_METHOD']" do
- old_value, ENV['REQUEST_METHOD'] = ENV['REQUEST_METHOD'], "GET"
- begin
- @cgi.request_method.should == "GET"
- ensure
- ENV['REQUEST_METHOD'] = old_value
+ it "returns ENV['REQUEST_METHOD']" do
+ old_value, ENV['REQUEST_METHOD'] = ENV['REQUEST_METHOD'], "GET"
+ begin
+ @cgi.request_method.should == "GET"
+ ensure
+ ENV['REQUEST_METHOD'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/script_name_spec.rb b/spec/ruby/library/cgi/queryextension/script_name_spec.rb
index 341b7b6fea..49a7847eff 100644
--- a/spec/ruby/library/cgi/queryextension/script_name_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/script_name_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#script_name" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#script_name" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['SCRIPT_NAME']" do
- old_value, ENV['SCRIPT_NAME'] = ENV['SCRIPT_NAME'], "/path/to/script.rb"
- begin
- @cgi.script_name.should == "/path/to/script.rb"
- ensure
- ENV['SCRIPT_NAME'] = old_value
+ it "returns ENV['SCRIPT_NAME']" do
+ old_value, ENV['SCRIPT_NAME'] = ENV['SCRIPT_NAME'], "/path/to/script.rb"
+ begin
+ @cgi.script_name.should == "/path/to/script.rb"
+ ensure
+ ENV['SCRIPT_NAME'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/server_name_spec.rb b/spec/ruby/library/cgi/queryextension/server_name_spec.rb
index b12aaf8c5c..ee5d754ad3 100644
--- a/spec/ruby/library/cgi/queryextension/server_name_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/server_name_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#server_name" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#server_name" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['SERVER_NAME']" do
- old_value, ENV['SERVER_NAME'] = ENV['SERVER_NAME'], "localhost"
- begin
- @cgi.server_name.should == "localhost"
- ensure
- ENV['SERVER_NAME'] = old_value
+ it "returns ENV['SERVER_NAME']" do
+ old_value, ENV['SERVER_NAME'] = ENV['SERVER_NAME'], "localhost"
+ begin
+ @cgi.server_name.should == "localhost"
+ ensure
+ ENV['SERVER_NAME'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/server_port_spec.rb b/spec/ruby/library/cgi/queryextension/server_port_spec.rb
index 0e688a99bf..c4f8df78cf 100644
--- a/spec/ruby/library/cgi/queryextension/server_port_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/server_port_spec.rb
@@ -1,26 +1,29 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#server_port" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#server_port" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['SERVER_PORT'] as Integer" do
- old_value = ENV['SERVER_PORT']
- begin
- ENV['SERVER_PORT'] = nil
- @cgi.server_port.should be_nil
+ it "returns ENV['SERVER_PORT'] as Integer" do
+ old_value = ENV['SERVER_PORT']
+ begin
+ ENV['SERVER_PORT'] = nil
+ @cgi.server_port.should be_nil
- ENV['SERVER_PORT'] = "3000"
- @cgi.server_port.should eql(3000)
- ensure
- ENV['SERVER_PORT'] = old_value
+ ENV['SERVER_PORT'] = "3000"
+ @cgi.server_port.should eql(3000)
+ ensure
+ ENV['SERVER_PORT'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/server_protocol_spec.rb b/spec/ruby/library/cgi/queryextension/server_protocol_spec.rb
index f9dcf3c5b8..35d3b8add1 100644
--- a/spec/ruby/library/cgi/queryextension/server_protocol_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/server_protocol_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#server_protocol" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#server_protocol" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['SERVER_PROTOCOL']" do
- old_value, ENV['SERVER_PROTOCOL'] = ENV['SERVER_PROTOCOL'], "HTTP/1.1"
- begin
- @cgi.server_protocol.should == "HTTP/1.1"
- ensure
- ENV['SERVER_PROTOCOL'] = old_value
+ it "returns ENV['SERVER_PROTOCOL']" do
+ old_value, ENV['SERVER_PROTOCOL'] = ENV['SERVER_PROTOCOL'], "HTTP/1.1"
+ begin
+ @cgi.server_protocol.should == "HTTP/1.1"
+ ensure
+ ENV['SERVER_PROTOCOL'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/server_software_spec.rb b/spec/ruby/library/cgi/queryextension/server_software_spec.rb
index df349cdf2e..d4fcceb379 100644
--- a/spec/ruby/library/cgi/queryextension/server_software_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/server_software_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#server_software" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#server_software" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['SERVER_SOFTWARE']" do
- old_value, ENV['SERVER_SOFTWARE'] = ENV['SERVER_SOFTWARE'], "Server/1.0.0"
- begin
- @cgi.server_software.should == "Server/1.0.0"
- ensure
- ENV['SERVER_SOFTWARE'] = old_value
+ it "returns ENV['SERVER_SOFTWARE']" do
+ old_value, ENV['SERVER_SOFTWARE'] = ENV['SERVER_SOFTWARE'], "Server/1.0.0"
+ begin
+ @cgi.server_software.should == "Server/1.0.0"
+ ensure
+ ENV['SERVER_SOFTWARE'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/queryextension/user_agent_spec.rb b/spec/ruby/library/cgi/queryextension/user_agent_spec.rb
index ec5ef187dd..070a779123 100644
--- a/spec/ruby/library/cgi/queryextension/user_agent_spec.rb
+++ b/spec/ruby/library/cgi/queryextension/user_agent_spec.rb
@@ -1,22 +1,25 @@
require_relative '../../../spec_helper'
-require 'cgi'
-describe "CGI::QueryExtension#user_agent" do
- before :each do
- ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
- @cgi = CGI.new
- end
+ruby_version_is ""..."3.5" do
+ require 'cgi'
- after :each do
- ENV['REQUEST_METHOD'] = @old_request_method
- end
+ describe "CGI::QueryExtension#user_agent" do
+ before :each do
+ ENV['REQUEST_METHOD'], @old_request_method = "GET", ENV['REQUEST_METHOD']
+ @cgi = CGI.new
+ end
+
+ after :each do
+ ENV['REQUEST_METHOD'] = @old_request_method
+ end
- it "returns ENV['HTTP_USER_AGENT']" do
- old_value, ENV['HTTP_USER_AGENT'] = ENV['HTTP_USER_AGENT'], "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; de-de) AppleWebKit/527+ (KHTML, like Gecko) Version/3.1 Safari/525.13"
- begin
- @cgi.user_agent.should == "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; de-de) AppleWebKit/527+ (KHTML, like Gecko) Version/3.1 Safari/525.13"
- ensure
- ENV['HTTP_USER_AGENT'] = old_value
+ it "returns ENV['HTTP_USER_AGENT']" do
+ old_value, ENV['HTTP_USER_AGENT'] = ENV['HTTP_USER_AGENT'], "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; de-de) AppleWebKit/527+ (KHTML, like Gecko) Version/3.1 Safari/525.13"
+ begin
+ @cgi.user_agent.should == "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; de-de) AppleWebKit/527+ (KHTML, like Gecko) Version/3.1 Safari/525.13"
+ ensure
+ ENV['HTTP_USER_AGENT'] = old_value
+ end
end
end
end
diff --git a/spec/ruby/library/cgi/rfc1123_date_spec.rb b/spec/ruby/library/cgi/rfc1123_date_spec.rb
index 6904eeabaa..2641b40e94 100644
--- a/spec/ruby/library/cgi/rfc1123_date_spec.rb
+++ b/spec/ruby/library/cgi/rfc1123_date_spec.rb
@@ -1,10 +1,13 @@
require_relative '../../spec_helper'
-require 'cgi'
-describe "CGI.rfc1123_date when passed Time" do
- it "returns the passed Time formatted in RFC1123 ('Sat, 01 Dec 2007 15:56:42 GMT')" do
- input = Time.at(1196524602)
- expected = 'Sat, 01 Dec 2007 15:56:42 GMT'
- CGI.rfc1123_date(input).should == expected
+ruby_version_is ""..."3.5" do
+ require 'cgi'
+
+ describe "CGI.rfc1123_date when passed Time" do
+ it "returns the passed Time formatted in RFC1123 ('Sat, 01 Dec 2007 15:56:42 GMT')" do
+ input = Time.at(1196524602)
+ expected = 'Sat, 01 Dec 2007 15:56:42 GMT'
+ CGI.rfc1123_date(input).should == expected
+ end
end
end
diff --git a/spec/ruby/library/cgi/unescapeElement_spec.rb b/spec/ruby/library/cgi/unescapeElement_spec.rb
index ae4d50b076..3453393282 100644
--- a/spec/ruby/library/cgi/unescapeElement_spec.rb
+++ b/spec/ruby/library/cgi/unescapeElement_spec.rb
@@ -1,5 +1,9 @@
require_relative '../../spec_helper'
-require 'cgi'
+begin
+ require 'cgi/escape'
+rescue LoadError
+ require 'cgi'
+end
describe "CGI.unescapeElement when passed String, elements, ..." do
it "unescapes only the tags of the passed elements in the passed String" do
diff --git a/spec/ruby/library/cgi/unescapeHTML_spec.rb b/spec/ruby/library/cgi/unescapeHTML_spec.rb
index 84b30c6aa6..e43dcc83e5 100644
--- a/spec/ruby/library/cgi/unescapeHTML_spec.rb
+++ b/spec/ruby/library/cgi/unescapeHTML_spec.rb
@@ -1,5 +1,9 @@
require_relative '../../spec_helper'
-require 'cgi'
+begin
+ require 'cgi/escape'
+rescue LoadError
+ require 'cgi'
+end
describe "CGI.unescapeHTML" do
it "unescapes '&amp; &lt; &gt; &quot;' to '& < > \"'" do
diff --git a/spec/ruby/library/cgi/unescape_spec.rb b/spec/ruby/library/cgi/unescape_spec.rb
index c593e24b4a..52e1cb0243 100644
--- a/spec/ruby/library/cgi/unescape_spec.rb
+++ b/spec/ruby/library/cgi/unescape_spec.rb
@@ -1,6 +1,10 @@
# -*- encoding: utf-8 -*-
require_relative '../../spec_helper'
-require 'cgi'
+begin
+ require 'cgi/escape'
+rescue LoadError
+ require 'cgi'
+end
describe "CGI.unescape" do
it "url-decodes the passed argument" do