spec/shelly/client_spec.rb in shelly-0.0.4 vs spec/shelly/client_spec.rb in shelly-0.0.5
- old
+ new
@@ -23,22 +23,32 @@
end
end
describe "#register_user" do
it "should send post request with login and password" do
- @client.should_receive(:post).with("/users", {:user => {:email => "test@example.com", :password => "secret"}})
- @client.register_user("test@example.com", "secret")
+ @client.should_receive(:post).with("/users", {:user => {:email => "test@example.com",
+ :password => "secret", :ssh_key => "ssh-key Abb"}})
+ @client.register_user("test@example.com", "secret", "ssh-key Abb")
end
end
+ describe "#token" do
+ it "should get authentication token" do
+ @client.should_receive(:get).with("/token")
+ @client.token
+ end
+ end
+
describe "#request_parameters" do
it "should return hash of resquest parameters" do
expected = {
:method => :post,
:url => "#{@client.api_url}/account",
:headers => @client.headers,
- :payload => {:name => "bob", :email => "bob@example.com", :password => "secret"}.to_json
+ :payload => {:name => "bob"}.to_json,
+ :username => "bob@example.com",
+ :password => "secret"
}
@client.request_parameters("/account", :post, :name => "bob").should == expected
end
it "should not include user credentials when they are blank" do
@@ -47,10 +57,10 @@
:method => :get,
:url => "#{@client.api_url}/account",
:headers => @client.headers,
:payload => {}.to_json
}
- client.request("/account", :get)
+ client.request_parameters("/account", :get).should == expected
end
end
describe "#request" do
it "should get request parameters" do