spec/web_spec.rb in ronin-web-1.0.0.beta1 vs spec/web_spec.rb in ronin-web-1.0.0.beta2

- old
+ new

@@ -1,11 +1,10 @@ require 'spec_helper' require 'ronin/web' describe Ronin::Web do - let(:url) { 'https://ronin-rb.dev/' } - let(:title) { 'Ronin' } + let(:url) { 'https://example.com/' } it "should have a VERSION constant" do expect(subject.const_defined?('VERSION')).to eq(true) end @@ -59,14 +58,15 @@ expect(doc.to_xml).to include("<root>\n <stuff name=\"bla\">hello</stuff>\n</root>") end end describe ".open", :network do - it "should open URLs as temporary files" do + it "must open URLs as temporary files" do file = subject.open(url) - expect(file.read).to include(title) + expect(file).to be_kind_of(StringIO) + expect(file.read).to include("Example Domain") end end describe ".agent" do it "must return a #{described_class}::Mechanize object" do @@ -81,17 +81,17 @@ describe ".get", :network do it "should be able to get Mechanize pages" do page = subject.get(url) expect(page.class).to eq(Mechanize::Page) - expect(page.at('title').inner_text).to include(title) + expect(page.uri).to eq(URI(url)) end end describe ".get_body", :network do it "should be able to get the bodies of Mechanize pages" do body = subject.get_body(url) - expect(body).to include(title) + expect(body).to include("Example Domain") end end end