spec/model/prices_url_spec.rb in ns-yapi-0.5.0 vs spec/model/prices_url_spec.rb in ns-yapi-0.6.0

- old
+ new

@@ -1,45 +1,45 @@ +# frozen_string_literal: true + require 'spec_helper' describe PricesUrl do - - it "takes a fixed url as constructor argument" do - PricesUrl.new("www.somehost.com") + it 'takes a fixed url as constructor argument' do + PricesUrl.new('www.somehost.com') end - it "raises an error when no url is given" do - expect { PricesUrl.new(nil) }.to raise_error(PricesUrl::InvalidURL, "You must give an url, ie http://www.ns.nl/api") + it 'raises an error when no url is given' do + expect { PricesUrl.new(nil) }.to raise_error(PricesUrl::InvalidURL, 'You must give an url, ie http://www.ns.nl/api') end - let(:prices_url) { PricesUrl.new("hostname") } + let(:prices_url) { PricesUrl.new('hostname') } - it "uses given date" do - prices_url.url(date: Date.new(2013, 7, 12)).should == "hostname?date=12072013" + it 'uses given date' do + expect(prices_url.url(date: Date.new(2013, 7, 12))).to eq('hostname?date=12072013') end - it "uses from" do - expected_from = "Amsterdam" - prices_url.url(from:"Amsterdam").should == "hostname?from=#{expected_from}" + it 'uses from' do + expected_from = 'Amsterdam' + expect(prices_url.url(from: 'Amsterdam')).to eq("hostname?from=#{expected_from}") end - it "uses to" do - expected_to = "Purmerend" - prices_url.url(to:"Purmerend").should == "hostname?to=#{expected_to}" + it 'uses to' do + expected_to = 'Purmerend' + expect(prices_url.url(to: 'Purmerend')).to eq("hostname?to=#{expected_to}") end - it "uses via" do - expected_via = "Zaandam" - prices_url.url(via:"Zaandam").should == "hostname?via=#{expected_via}" + it 'uses via' do + expected_via = 'Zaandam' + expect(prices_url.url(via: 'Zaandam')).to eq("hostname?via=#{expected_via}") end - it "uses any all variables for from/to/via" do - prices_url.url(from:"Purmerend",to: "Amsterdam", via:"Zaandam").should == "hostname?from=Purmerend&to=Amsterdam&via=Zaandam" + it 'uses any all variables for from/to/via' do + expect(prices_url.url(from: 'Purmerend', to: 'Amsterdam', via: 'Zaandam')).to eq('hostname?from=Purmerend&to=Amsterdam&via=Zaandam') end - it "html encodes" do - prices_url.url(from:"Purmerend",to: "Amsterdam Centraal").should == "hostname?from=Purmerend&to=Amsterdam%20Centraal" + it 'html encodes' do + expect(prices_url.url(from: 'Purmerend', to: 'Amsterdam Centraal')).to eq('hostname?from=Purmerend&to=Amsterdam%20Centraal') end ANY_DATE = Date.new(2013, 8, 13) - ANY_DATE_STR = "13082013" - + ANY_DATE_STR = '13082013' end