summaryrefslogtreecommitdiff
path: root/spec/unit/user_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/user_spec.rb')
-rw-r--r--spec/unit/user_spec.rb19
1 files changed, 9 insertions, 10 deletions
diff --git a/spec/unit/user_spec.rb b/spec/unit/user_spec.rb
index a4f1dff721..a1806db987 100644
--- a/spec/unit/user_spec.rb
+++ b/spec/unit/user_spec.rb
@@ -60,7 +60,6 @@ describe Chef::User do
expect { @user.name "foo&" }.to raise_error(ArgumentError)
end
-
it "should not accept spaces" do
expect { @user.name "ops master" }.to raise_error(ArgumentError)
end
@@ -168,10 +167,10 @@ describe Chef::User do
describe "when deserializing from JSON" do
before(:each) do
user = { "name" => "mr_spinks",
- "public_key" => "turtles",
- "private_key" => "pandas",
- "password" => "password",
- "admin" => true }
+ "public_key" => "turtles",
+ "private_key" => "pandas",
+ "password" => "password",
+ "admin" => true }
@user = Chef::User.from_json(Chef::JSONCompat.to_json(user))
end
@@ -212,8 +211,8 @@ describe Chef::User do
describe "list" do
before(:each) do
Chef::Config[:chef_server_url] = "http://www.example.com"
- @osc_response = { "admin" => "http://www.example.com/users/admin"}
- @ohc_response = [ { "user" => { "username" => "admin" }} ]
+ @osc_response = { "admin" => "http://www.example.com/users/admin" }
+ @ohc_response = [ { "user" => { "username" => "admin" } } ]
allow(Chef::User).to receive(:load).with("admin").and_return(@user)
@osc_inflated_response = { "admin" => @user }
end
@@ -244,14 +243,14 @@ describe Chef::User do
describe "create" do
it "creates a new user via the API" do
@user.password "password"
- expect(@http_client).to receive(:post).with("users", {:name => "foobar", :admin => false, :password => "password"}).and_return({})
+ expect(@http_client).to receive(:post).with("users", { :name => "foobar", :admin => false, :password => "password" }).and_return({})
@user.create
end
end
describe "read" do
it "loads a named user from the API" do
- expect(@http_client).to receive(:get).with("users/foobar").and_return({"name" => "foobar", "admin" => true, "public_key" => "pubkey"})
+ expect(@http_client).to receive(:get).with("users/foobar").and_return({ "name" => "foobar", "admin" => true, "public_key" => "pubkey" })
user = Chef::User.load("foobar")
expect(user.name).to eq("foobar")
expect(user.admin).to eq(true)
@@ -261,7 +260,7 @@ describe Chef::User do
describe "update" do
it "updates an existing user on via the API" do
- expect(@http_client).to receive(:put).with("users/foobar", {:name => "foobar", :admin => false}).and_return({})
+ expect(@http_client).to receive(:put).with("users/foobar", { :name => "foobar", :admin => false }).and_return({})
@user.update
end
end