spec/net/http/server/responses_spec.rb in net-http-server-0.2.2 vs spec/net/http/server/responses_spec.rb in net-http-server-0.2.3

- old
+ new

@@ -15,91 +15,91 @@ before(:each) { write_status(@stream,status) } it "should write the HTTP Version" do parts = @stream.string.split(' ') - parts[0].should =~ /HTTP\/1.1/ + expect(parts[0]).to match(/HTTP\/1.1/) end it "should write the Status Code" do parts = @stream.string.split(' ') - parts[1].should == status.to_s + expect(parts[1]).to eq(status.to_s) end it "should write the Reason String" do parts = @stream.string.split(' ') - parts[2].should == reason + expect(parts[2]).to eq(reason) end it "should end the line with a '\\r\\n'" do - @stream.string[-2..-1].should == "\r\n" + expect(@stream.string[-2..-1]).to eq("\r\n") end end describe "write_headers" do it "should separate header names and values with a ': '" do write_headers(@stream, 'Foo' => 'Bar') - @stream.string.should include(': ') + expect(@stream.string).to include(': ') end it "should terminate each header with a '\\r\\n'" do write_headers(@stream, 'Foo' => 'Bar', 'Baz' => 'Qix') - @stream.string.split("\r\n").should =~ [ + expect(@stream.string.split("\r\n")).to match_array([ 'Foo: Bar', 'Baz: Qix' - ] + ]) end it "should end the headers with a '\\r\\n'" do write_headers(@stream, {}) - @stream.string.should == "\r\n" + expect(@stream.string).to eq("\r\n") end it "should write String headers" do write_headers(@stream, 'Content-Type' => 'text/html') - @stream.string.split("\r\n").should == [ + expect(@stream.string.split("\r\n")).to eq([ 'Content-Type: text/html' - ] + ]) end it "should write multiple headers for multi-line String values" do write_headers(@stream, 'Content-Type' => "text/html\ncharset=UTF8") - @stream.string.split("\r\n").should == [ + expect(@stream.string.split("\r\n")).to eq([ 'Content-Type: text/html', 'Content-Type: charset=UTF8' - ] + ]) end it "should properly format Time values" do time = Time.parse('2011-01-25 14:15:29 -0800') write_headers(@stream, 'Date' => time) - @stream.string.split("\r\n").should == [ + expect(@stream.string.split("\r\n")).to eq([ 'Date: Tue, 25 Jan 2011 22:15:29 GMT' - ] + ]) end it "should write Array values as multiple headers" do write_headers(@stream, 'Content-Type' => ['text/html', 'charset=UTF8']) - @stream.string.split("\r\n").should == [ + expect(@stream.string.split("\r\n")).to eq([ 'Content-Type: text/html', 'Content-Type: charset=UTF8' - ] + ]) end end describe "write_body" do it "should write each check of the body" do write_body(@stream,['one', 'two', 'three']) - @stream.string.should == 'onetwothree' + expect(@stream.string).to eq('onetwothree') end end end