spec/gateway_spec.rb in mediawiki-gateway-0.3.8 vs spec/gateway_spec.rb in mediawiki-gateway-0.4.1
- old
+ new
@@ -42,31 +42,31 @@
describe "with an non-existent username" do
it "should raise an error" do
lambda do
@gateway.login('bogususer', 'sekrit')
- end.should raise_error(StandardError)
+ end.should raise_error(MediaWiki::Unauthorized)
end
end
describe "with an incorrect password" do
it "should raise an error" do
lambda do
@gateway.login('atlasmw', 'sekrit')
- end.should raise_error(StandardError)
+ end.should raise_error(MediaWiki::Unauthorized)
end
end
describe "with an incorrect domain" do
it "should raise an error" do
lambda do
@gateway.login('atlasmw', 'wombat', 'bogusdomain')
- end.should raise_error(StandardError)
+ end.should raise_error(MediaWiki::Unauthorized)
end
end
end
@@ -91,11 +91,11 @@
describe "requesting an import token" do
it "should raise an error" do
lambda do
@gateway.send(:get_token, 'import', 'Main Page')
- end.should raise_error(StandardError)
+ end.should raise_error(MediaWiki::Unauthorized)
end
end
end
@@ -348,11 +348,11 @@
describe "and the 'overwrite' option is not set" do
it "should raise an error" do
lambda do
@gateway.create("Main Page", "Some new content")
- end.should raise_error(StandardError)
+ end.should raise_error(MediaWiki::APIError)
end
end
end
@@ -438,11 +438,11 @@
end
it "should raise an error" do
lambda do
@gateway.delete("Missing Page")
- end.should raise_error(StandardError)
+ end.should raise_error(MediaWiki::APIError)
end
end
end
describe "when not logged in" do
@@ -452,11 +452,11 @@
end
it "should raise an error" do
lambda do
@gateway.delete("Deletable Page")
- end.should raise_error(StandardError)
+ end.should raise_error(MediaWiki::Unauthorized)
end
end
end
@@ -497,11 +497,11 @@
describe "when not logged in" do
it "should raise an error" do
lambda do
@gateway.undelete("Undeletable Page")
- end.should raise_error(StandardError)
+ end.should raise_error(MediaWiki::APIError)
end
end
end
@@ -563,11 +563,11 @@
describe "with an empty key" do
it "should raise an error" do
lambda do
@gateway.search("")
- end.should raise_error(StandardError)
+ end.should raise_error(MediaWiki::APIError)
end
end
describe "with a valid key and no namespaces" do
@@ -642,11 +642,11 @@
describe "when not logged in" do
it "should raise an error" do
lambda do
@gateway.import(import_file)
- end.should raise_error(StandardError)
+ end.should raise_error(MediaWiki::Unauthorized)
end
end
describe "when logged in as admin" do
@@ -756,10 +756,10 @@
describe "requesting a userrights token for an nonexistant user" do
it "should raise an error" do
lambda do
@gateway.send(:get_userrights_token, 'nosuchuser')
- end.should raise_error(StandardError)
+ end.should raise_error(MediaWiki::APIError)
end
end
describe "changing a user's groups with a valid token" do