spec/spidr_spec.rb in spidr-0.5.0 vs spec/spidr_spec.rb in spidr-0.6.0

- old
+ new

@@ -1,39 +1,16 @@ require 'spidr' require 'spec_helper' +require 'settings/proxy_examples' +require 'settings/timeouts_examples' +require 'settings/user_agent_examples' describe Spidr do it "should have a VERSION constant" do expect(subject.const_defined?('VERSION')).to eq(true) end - describe "proxy" do - after(:all) do - Spidr.disable_proxy! - end - - it "should not have proxy settings by default" do - expect(subject.proxy[:host]).to be_nil - end - - it "should allow setting new proxy settings" do - subject.proxy = {host: 'example.com', port: 8010} - - expect(subject.proxy[:host]).to eq('example.com') - expect(subject.proxy[:port]).to eq(8010) - end - - it "should default the :port option of new proxy settings" do - subject.proxy = {host: 'example.com'} - - expect(subject.proxy[:host]).to eq('example.com') - expect(subject.proxy[:port]).to eq(Spidr::COMMON_PROXY_PORT) - end - - it "should allow disabling the proxy" do - subject.disable_proxy! - - expect(subject.proxy[:host]).to be_nil - end - end + it_should_behave_like "includes Spidr::Settings::Proxy" + it_should_behave_like "includes Spidr::Settings::Timeouts" + it_should_behave_like "includes Spidr::Settings::UserAgent" end