test/lib/nephophobia/user_test.rb in nephophobia-0.0.2 vs test/lib/nephophobia/user_test.rb in nephophobia-0.0.3
- old
+ new
@@ -1,34 +1,35 @@
require "test_helper"
describe Nephophobia::User do
before do
- @user = ADMIN_CLIENT.user
- @user_name = "foobar_user"
- @project_name = "foobar_project"
+ @user = ADMIN_CLIENT.user
+ @user_name = "foobar_user"
end
- describe "#add_role" do
- it "adds the default role to the given 'user_name'" do
- VCR.use_cassette "user_add_role" do
- response = @user.add_role @user_name, @project_name
-
- response.return.must_equal true
- end
- end
- end
-
describe "#create" do
it "creates the given 'user_name'" do
VCR.use_cassette "user_create" do
response = @user.create @user_name
response.username.must_equal @user_name
end
end
end
+ describe "#credentials" do
+ before { @project_name = "production" }
+
+ it "returns the credentials for a given 'user_name' for the specified 'project_name'." do
+ VCR.use_cassette "user_credentials" do
+ response = @user.credentials @user_name, @project_name
+
+ response.must_match %r{BEGIN CERTIFICATE}
+ end
+ end
+ end
+
describe "#destroy" do
it "destroys the given 'user_name'" do
VCR.use_cassette "user_destroy" do
response = @user.destroy @user_name
@@ -57,15 +58,15 @@
user.secretkey.must_equal "3ae9d9f0-2723-480a-99eb-776f05950506"
user.accesskey.must_equal "9c01b833-3047-4f2e-bb2a-5c8dc7c8ae9c"
end
end
- describe "#remove_role" do
- it "removes the default role to the given 'user_name'" do
- VCR.use_cassette "user_remove_role" do
- response = @user.remove_role @user_name, @project_name
-
- response.return.must_equal true
+ describe "#find with invalid user_name" do
+ it "rescues Hugs::Errors::BadRequest" do
+ VCR.use_cassette "user_find_with_invalid_user_name" do
+ @response = @user.find "invalid_user_name"
end
+
+ @response.must_be_nil
end
end
end