spec/shelly/client_spec.rb in shelly-0.1.34 vs spec/shelly/client_spec.rb in shelly-0.1.35
- old
+ new
@@ -163,21 +163,47 @@
end
end
describe "#create_app" do
it "should send post with app's attributes" do
- @client.should_receive(:post).with("/apps", :app => {:code_name => "foo", :ruby_version => "1.9.2"})
+ @client.should_receive(:post).with("/apps", :app => {:code_name => "foo", :ruby_version => "1.9.2"}, :organization_name => nil)
@client.create_app(:code_name => "foo", :ruby_version => "1.9.2")
end
+
+ it "should send post with app's attributes and organization name" do
+ @client.should_receive(:post).with("/apps", :app => {:code_name => "foo", :ruby_version => "1.9.2"}, :organization_name => "foo")
+ @client.create_app(:code_name => "foo", :ruby_version => "1.9.2", :organization_name => "foo")
+ end
+
end
- describe "#collaborations" do
+ describe "#organizations" do
+ it "should fetch organizations from API" do
+ FakeWeb.register_uri(:get, api_url("organizations"),
+ :body => [{:name => "org1", :app_code_names => ["app1"]},
+ {:name => "org2", :app_code_names => ["app2"]}].to_json)
+ response = @client.organizations
+ response.should == [{"name" => "org1", "app_code_names" => ["app1"]},
+ {"name" => "org2", "app_code_names" => ["app2"]}]
+ end
+ end
+
+ describe "#organization" do
+ it "should fetch organization from API" do
+ FakeWeb.register_uri(:get, api_url("organizations/foo-org"),
+ :body => {:name => "org1", :app_code_names => ["app1"]}.to_json)
+ response = @client.organization("foo-org")
+ response.should == {"name" => "org1", "app_code_names" => ["app1"]}
+ end
+ end
+
+ describe "#members" do
it "should send get request with app code_names" do
- FakeWeb.register_uri(:get, api_url("apps/staging-foo/collaborations"),
+ FakeWeb.register_uri(:get, api_url("organizations/staging-foo/memberships"),
:body => [{:email => "test@example.com", :active => true},
{:email => "test2@example.com", :active => false}].to_json)
- response = @client.collaborations("staging-foo")
+ response = @client.members("staging-foo")
response.should == [{"email" => "test@example.com", 'active' => true},
{"email" => "test2@example.com", 'active' => false}]
end
end
@@ -227,19 +253,19 @@
end
end
describe "#send_invitation" do
it "should send post with developer's email" do
- FakeWeb.register_uri(:post, api_url("apps/staging-foo/collaborations"), :body => {}.to_json)
+ FakeWeb.register_uri(:post, api_url("organizations/staging-foo/memberships"), :body => {}.to_json)
response = @client.send_invitation("staging-foo", "megan@example.com")
response.should == {}
end
end
describe "#delete_collaboration" do
it "should send delete with developer's email in url" do
- FakeWeb.register_uri(:delete, api_url("apps/staging-foo/collaborations/megan@example.com"), :body => {}.to_json)
- @client.delete_collaboration("staging-foo", "megan@example.com")
+ FakeWeb.register_uri(:delete, api_url("organizations/staging-foo/memberships/megan@example.com"), :body => {}.to_json)
+ @client.delete_member("staging-foo", "megan@example.com")
end
end
describe "#add_ssh_key" do
it "should send put with give SSH key" do