From d46f226e3260922145b35c251f7ca35882b9fff0 Mon Sep 17 00:00:00 2001 From: cn Date: Sat, 27 Apr 2013 14:37:52 +0200 Subject: [PATCH] Update spec --- spec/daemon_spec.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/spec/daemon_spec.rb b/spec/daemon_spec.rb index 5a6920a..8f9b2d6 100644 --- a/spec/daemon_spec.rb +++ b/spec/daemon_spec.rb @@ -14,7 +14,7 @@ describe Dyndnsd::Daemon do } db = Dyndnsd::DummyDatabase.new({}) updater = Dyndnsd::Updater::Dummy.new - responder = Dyndnsd::Responder::RestStyle.new + responder = Dyndnsd::Responder::DynDNSStyle.new app = Dyndnsd::Daemon.new(config, db, updater, responder) Rack::Auth::Basic.new(app, "DynDNS") do |user,pass| @@ -25,6 +25,9 @@ describe Dyndnsd::Daemon do it 'requires authentication' do get '/' last_response.status.should == 401 + + pending 'Need to find a way to add custom body on 401 responses' + last_response.should be_ok 'badauth' end it 'only supports GET requests' do @@ -42,13 +45,15 @@ describe Dyndnsd::Daemon do it 'requires the hostname query parameter' do authorize 'test', 'secret' get '/nic/update' - last_response.status.should == 422 + last_response.should be_ok + last_response.body.should == 'notfqdn' end it 'forbids changing hosts a user does not own' do authorize 'test', 'secret' get '/nic/update?hostname=notmyhost.example.org' - last_response.status.should == 403 + last_response.should be_ok + last_response.body.should == 'nohost' end it 'updates a host on change' do @@ -57,9 +62,9 @@ describe Dyndnsd::Daemon do get '/nic/update?hostname=foo.example.org&myip=1.2.3.4' last_response.should be_ok - get '/nic/update?hostname=foo.example.org&myip=1.2.3.400' + get '/nic/update?hostname=foo.example.org&myip=1.2.3.40' last_response.should be_ok - last_response.body.should == 'Good' + last_response.body.should == 'good 1.2.3.40' end it 'returns no change' do @@ -70,7 +75,7 @@ describe Dyndnsd::Daemon do get '/nic/update?hostname=foo.example.org&myip=1.2.3.4' last_response.should be_ok - last_response.body.should == 'No change' + last_response.body.should == 'nochg 1.2.3.4' end it 'forbids invalid hostnames' do