mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@875a09e
This commit is contained in:
parent
a06301b103
commit
5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions
|
@ -21,7 +21,7 @@ describe "URI.join" do
|
|||
end
|
||||
|
||||
it "raises an error if given no argument" do
|
||||
lambda {
|
||||
-> {
|
||||
URI.join
|
||||
}.should raise_error(ArgumentError)
|
||||
end
|
||||
|
|
|
@ -84,7 +84,7 @@ describe "URI::Mailto.build" do
|
|||
end
|
||||
|
||||
bad.each do |x|
|
||||
lambda { URI::MailTo.build(x) }.should raise_error(URI::InvalidComponentError)
|
||||
-> { URI::MailTo.build(x) }.should raise_error(URI::InvalidComponentError)
|
||||
end
|
||||
|
||||
ok.flatten.join("\0").should == ok_all
|
||||
|
|
|
@ -36,7 +36,7 @@ describe "URI#+" do
|
|||
end
|
||||
|
||||
it "raises a URI::BadURIError when adding two relative URIs" do
|
||||
lambda {URI.parse('a/b/c') + "d"}.should raise_error(URI::BadURIError)
|
||||
-> {URI.parse('a/b/c') + "d"}.should raise_error(URI::BadURIError)
|
||||
end
|
||||
|
||||
#Todo: make more BDD?
|
||||
|
|
|
@ -16,15 +16,15 @@ describe "URI#select" do
|
|||
|
||||
it "raises an ArgumentError if a component is requested that isn't valid under the given scheme" do
|
||||
[
|
||||
lambda {URI("mailto:spam@mailinator.com").select(:path)},
|
||||
lambda {URI("http://blog.blag.web").select(:typecode)},
|
||||
-> {URI("mailto:spam@mailinator.com").select(:path)},
|
||||
-> {URI("http://blog.blag.web").select(:typecode)},
|
||||
].each do |select_lambda|
|
||||
select_lambda.should raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
|
||||
it "raises an ArgumentError if given strings rather than symbols" do
|
||||
lambda {
|
||||
-> {
|
||||
URI("http://host:8080/path/").select("scheme","host","port",'path')
|
||||
}.should raise_error(ArgumentError)
|
||||
end
|
||||
|
|
|
@ -27,19 +27,19 @@ describe "URI#select" do
|
|||
uri.to_s.should == 'http://foo:bar@zab:8080/?a=1#b123'
|
||||
|
||||
uri = URI.parse('http://example.com')
|
||||
lambda { uri.password = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
-> { uri.password = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
uri.userinfo = 'foo:bar'
|
||||
uri.to_s.should == 'http://foo:bar@example.com'
|
||||
lambda { uri.registry = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
lambda { uri.opaque = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
-> { uri.registry = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
-> { uri.opaque = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
|
||||
uri = URI.parse('mailto:foo@example.com')
|
||||
lambda { uri.user = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
lambda { uri.password = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
lambda { uri.userinfo = ['bar', 'baz'] }.should raise_error(URI::InvalidURIError)
|
||||
lambda { uri.host = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
lambda { uri.port = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
lambda { uri.path = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
lambda { uri.query = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
-> { uri.user = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
-> { uri.password = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
-> { uri.userinfo = ['bar', 'baz'] }.should raise_error(URI::InvalidURIError)
|
||||
-> { uri.host = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
-> { uri.port = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
-> { uri.path = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
-> { uri.query = 'bar' }.should raise_error(URI::InvalidURIError)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ describe :uri_join, shared: true do
|
|||
end
|
||||
|
||||
it "raises an error if given no argument" do
|
||||
lambda {
|
||||
-> {
|
||||
@object.join
|
||||
}.should raise_error(ArgumentError)
|
||||
end
|
||||
|
|
|
@ -193,7 +193,7 @@ describe :uri_parse, shared: true do
|
|||
end
|
||||
|
||||
it "raises errors on malformed URIs" do
|
||||
lambda { @object.parse('http://a_b:80/') }.should raise_error(URI::InvalidURIError)
|
||||
lambda { @object.parse('http://a_b/') }.should raise_error(URI::InvalidURIError)
|
||||
-> { @object.parse('http://a_b:80/') }.should raise_error(URI::InvalidURIError)
|
||||
-> { @object.parse('http://a_b/') }.should raise_error(URI::InvalidURIError)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,6 +24,6 @@ describe "the URI method" do
|
|||
|
||||
#apparently this was a concern? imported from MRI tests
|
||||
it "does not add a URI method to Object instances" do
|
||||
lambda {Object.new.URI("http://ruby-lang.org/")}.should raise_error(NoMethodError)
|
||||
-> {Object.new.URI("http://ruby-lang.org/")}.should raise_error(NoMethodError)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue