ribose 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +539 -970
  4. data/.sample.pryrc +4 -0
  5. data/CHANGELOG.md +5 -0
  6. data/README.md +539 -3
  7. data/bin/console +2 -5
  8. data/lib/ribose.rb +31 -1
  9. data/lib/ribose/actions.rb +10 -0
  10. data/lib/ribose/actions/all.rb +43 -0
  11. data/lib/ribose/actions/base.rb +11 -0
  12. data/lib/ribose/actions/create.rb +44 -0
  13. data/lib/ribose/actions/delete.rb +32 -0
  14. data/lib/ribose/actions/fetch.rb +44 -0
  15. data/lib/ribose/actions/update.rb +35 -0
  16. data/lib/ribose/app_data.rb +15 -0
  17. data/lib/ribose/app_relation.rb +12 -0
  18. data/lib/ribose/base.rb +48 -0
  19. data/lib/ribose/calendar.rb +22 -0
  20. data/lib/ribose/client.rb +31 -0
  21. data/lib/ribose/config.rb +21 -0
  22. data/lib/ribose/configuration.rb +25 -0
  23. data/lib/ribose/connection.rb +39 -0
  24. data/lib/ribose/connection_invitation.rb +51 -0
  25. data/lib/ribose/conversation.rb +87 -0
  26. data/lib/ribose/error.rb +30 -0
  27. data/lib/ribose/feed.rb +11 -0
  28. data/lib/ribose/file_uploader.rb +93 -0
  29. data/lib/ribose/join_space_request.rb +41 -0
  30. data/lib/ribose/leaderboard.rb +19 -0
  31. data/lib/ribose/member.rb +34 -0
  32. data/lib/ribose/message.rb +94 -0
  33. data/lib/ribose/profile.rb +56 -0
  34. data/lib/ribose/request.rb +122 -0
  35. data/lib/ribose/resource_helper.rb +81 -0
  36. data/lib/ribose/response/raise_error.rb +15 -0
  37. data/lib/ribose/rspec.rb +19 -0
  38. data/lib/ribose/session.rb +48 -0
  39. data/lib/ribose/setting.rb +16 -0
  40. data/lib/ribose/space.rb +30 -0
  41. data/lib/ribose/space_file.rb +49 -0
  42. data/lib/ribose/space_invitation.rb +70 -0
  43. data/lib/ribose/stream.rb +15 -0
  44. data/lib/ribose/user.rb +42 -0
  45. data/lib/ribose/version.rb +1 -1
  46. data/lib/ribose/widget.rb +11 -0
  47. data/lib/ribose/wiki.rb +80 -0
  48. data/ribose.gemspec +6 -0
  49. data/spec/fixtures/app_data.json +188 -0
  50. data/spec/fixtures/app_relation.json +19 -0
  51. data/spec/fixtures/app_relations.json +89 -0
  52. data/spec/fixtures/calendar.json +12 -0
  53. data/spec/fixtures/calendars.json +34 -0
  54. data/spec/fixtures/connection_invitation.json +26 -0
  55. data/spec/fixtures/connection_invitation_accepted.json +26 -0
  56. data/spec/fixtures/connection_invitations.json +28 -0
  57. data/spec/fixtures/connection_invitations_created.json +37 -0
  58. data/spec/fixtures/connection_suggestion.json +22 -0
  59. data/spec/fixtures/connections.json +28 -0
  60. data/spec/fixtures/conversation.json +26 -0
  61. data/spec/fixtures/conversation_created.json +31 -0
  62. data/spec/fixtures/conversations.json +34 -0
  63. data/spec/fixtures/empty.json +1 -0
  64. data/spec/fixtures/feeds.json +84 -0
  65. data/spec/fixtures/file_upload_prepared.json +17 -0
  66. data/spec/fixtures/file_uploaded.json +38 -0
  67. data/spec/fixtures/general_information.json +16 -0
  68. data/spec/fixtures/join_space_request_created.json +26 -0
  69. data/spec/fixtures/join_space_request_updated.json +25 -0
  70. data/spec/fixtures/join_space_requests.json +34 -0
  71. data/spec/fixtures/leaderboard.json +21 -0
  72. data/spec/fixtures/login.html +323 -0
  73. data/spec/fixtures/members.json +20 -0
  74. data/spec/fixtures/message.json +22 -0
  75. data/spec/fixtures/messages.json +24 -0
  76. data/spec/fixtures/ping.json +3 -0
  77. data/spec/fixtures/profile.json +10 -0
  78. data/spec/fixtures/sample.png +0 -0
  79. data/spec/fixtures/setting.json +16 -0
  80. data/spec/fixtures/settings.json +18 -0
  81. data/spec/fixtures/space.json +59 -0
  82. data/spec/fixtures/space_created.json +59 -0
  83. data/spec/fixtures/space_file.json +58 -0
  84. data/spec/fixtures/space_invitation.json +32 -0
  85. data/spec/fixtures/space_invitation_updated.json +35 -0
  86. data/spec/fixtures/space_invitations.json +34 -0
  87. data/spec/fixtures/space_mass_invitations.json +46 -0
  88. data/spec/fixtures/spaces.json +61 -0
  89. data/spec/fixtures/stream.json +176 -0
  90. data/spec/fixtures/user_activated.json +6 -0
  91. data/spec/fixtures/widgets.json +50 -0
  92. data/spec/fixtures/wiki.json +79 -0
  93. data/spec/fixtures/wikis.json +197 -0
  94. data/spec/ribose/actions/create_spec.rb +40 -0
  95. data/spec/ribose/actions/delete_spec.rb +24 -0
  96. data/spec/ribose/actions/fetch_spec.rb +32 -0
  97. data/spec/ribose/actions/update_spec.rb +36 -0
  98. data/spec/ribose/app_data_spec.rb +15 -0
  99. data/spec/ribose/app_relation_spec.rb +27 -0
  100. data/spec/ribose/calendar_spec.rb +50 -0
  101. data/spec/ribose/client_spec.rb +48 -0
  102. data/spec/ribose/config_spec.rb +41 -0
  103. data/spec/ribose/connection_invitation_spec.rb +79 -0
  104. data/spec/ribose/connection_spec.rb +26 -0
  105. data/spec/ribose/conversation_spec.rb +84 -0
  106. data/spec/ribose/error_spec.rb +67 -0
  107. data/spec/ribose/feed_spec.rb +14 -0
  108. data/spec/ribose/file_uploader_spec.rb +30 -0
  109. data/spec/ribose/join_space_request_spec.rb +70 -0
  110. data/spec/ribose/leaderboard_spec.rb +13 -0
  111. data/spec/ribose/member_spec.rb +16 -0
  112. data/spec/ribose/message_spec.rb +69 -0
  113. data/spec/ribose/profile_spec.rb +40 -0
  114. data/spec/ribose/request_spec.rb +66 -0
  115. data/spec/ribose/resource_helper_spec.rb +58 -0
  116. data/spec/ribose/session_spec.rb +46 -0
  117. data/spec/ribose/setting_spec.rb +40 -0
  118. data/spec/ribose/space_file_spec.rb +41 -0
  119. data/spec/ribose/space_invitation_spec.rb +117 -0
  120. data/spec/ribose/space_spec.rb +70 -0
  121. data/spec/ribose/stream_spec.rb +14 -0
  122. data/spec/ribose/user_spec.rb +48 -0
  123. data/spec/ribose/widget_spec.rb +14 -0
  124. data/spec/ribose/wiki_spec.rb +67 -0
  125. data/spec/spec_helper.rb +11 -0
  126. data/spec/support/fake_ribose_api.rb +431 -0
  127. data/spec/support/file_upload_stub.rb +76 -0
  128. metadata +190 -3
  129. data/spec/ribose_spec.rb +0 -4
@@ -0,0 +1,40 @@
1
+ require "spec_helper"
2
+ require "ribose/actions/create"
3
+
4
+ RSpec.describe "TestCreateAction" do
5
+ describe ".create" do
6
+ it "creates a new resource with provided details" do
7
+ stub_ribose_space_create_api(space_attributes)
8
+ space = Ribose::TestCreateAction.create(space_attributes)
9
+
10
+ expect(space.id).not_to be_nil
11
+ expect(space.name).to eq("Trip to the Mars")
12
+ expect(space.visibility).to eq("invisible")
13
+ end
14
+ end
15
+
16
+ def space_attributes
17
+ {
18
+ access: "private",
19
+ space_category_id: 12,
20
+ description: "The long awaited dream!",
21
+ name: "Trip to the Mars",
22
+ }
23
+ end
24
+
25
+ module Ribose
26
+ class TestCreateAction < Ribose::Base
27
+ include Ribose::Actions::Create
28
+
29
+ private
30
+
31
+ def resource
32
+ "space"
33
+ end
34
+
35
+ def resources
36
+ [resource, "s"].join
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,24 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "TestDeleteAction" do
4
+ describe ".delete" do
5
+ it "removes a specific resource" do
6
+ resource_id = 123_456_789
7
+ stub_ribose_calendar_delete_api(resource_id)
8
+
9
+ expect { Ribose::TestDeleteAction.delete(resource_id) }.not_to raise_error
10
+ end
11
+ end
12
+
13
+ module Ribose
14
+ class TestDeleteAction < Ribose::Base
15
+ include Ribose::Actions::Delete
16
+
17
+ private
18
+
19
+ def resources_path
20
+ "calendar/calendar"
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,32 @@
1
+ require "spec_helper"
2
+ require "ribose/actions/fetch"
3
+
4
+ RSpec.describe "TestFetchAction" do
5
+ describe ".fetch" do
6
+ it "fetches a specific resource" do
7
+ resource_id = 123_456_789
8
+
9
+ stub_ribose_space_fetch_api(resource_id)
10
+ resource = Ribose::TestFetchAction.fetch(resource_id)
11
+
12
+ expect(resource.id).not_to be_nil
13
+ expect(resource.name).to eq("Work")
14
+ end
15
+ end
16
+
17
+ def stub_ribose_space_fetch_api(resource_id)
18
+ stub_api_response(:get, "spaces/#{resource_id}", filename: "space")
19
+ end
20
+
21
+ module Ribose
22
+ class TestFetchAction < Ribose::Base
23
+ include Ribose::Actions::Fetch
24
+
25
+ private
26
+
27
+ def resource
28
+ "space"
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,36 @@
1
+ require "spec_helper"
2
+ require "ribose/actions/update"
3
+
4
+ RSpec.describe "TestUpdateAction" do
5
+ describe ".update" do
6
+ it "updates a resource with provided details" do
7
+ resource_id = 123_456_789
8
+ attributes = { attribute_name: "attribute_value" }
9
+
10
+ stub_ribose_resource_update_api_call(resource_id, attributes)
11
+ resource = Ribose::TestUpdateAction.update(resource_id, attributes)
12
+
13
+ expect(resource.id).not_to be_nil
14
+ end
15
+ end
16
+
17
+ module Ribose
18
+ class TestUpdateAction < Ribose::Base
19
+ include Ribose::Actions::Update
20
+
21
+ private
22
+
23
+ def resource
24
+ "space"
25
+ end
26
+ end
27
+ end
28
+
29
+ def stub_ribose_resource_update_api_call(resource_id, attributes)
30
+ resource_path = ["spaces", resource_id].join("/")
31
+
32
+ stub_api_response(
33
+ :put, resource_path, data: { space: attributes }, filename: "space"
34
+ )
35
+ end
36
+ end
@@ -0,0 +1,15 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Ribose::AppData do
4
+ describe ".all" do
5
+ it "retrieves the user's app data" do
6
+ stub_ribose_app_data_api
7
+ app_data = Ribose::AppData.all
8
+
9
+ expect(app_data.user.login).to eq("john.doe")
10
+ expect(app_data.user.from_ribose?).to be_falsey
11
+ expect(app_data.misc.jabber.status).to eq("available")
12
+ expect(app_data.misc.capps.first.app_name).to eq("app/dashboard")
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,27 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Ribose::AppRelation do
4
+ describe ".all" do
5
+ it "retrieves the list og user's app relations" do
6
+ stub_ribose_app_relation_list_api
7
+ app_relations = Ribose::AppRelation.all
8
+
9
+ expect(app_relations.count).to eq(5)
10
+ expect(app_relations.first.app_name).to eq("app/home")
11
+ expect(app_relations.first.owner_id).to eq("63116bd1-c08d")
12
+ end
13
+ end
14
+
15
+ describe ".fetch" do
16
+ it "fetches a specific app realtation details" do
17
+ relation_id = 123_456_789
18
+
19
+ stub_ribose_app_relation_find_api(relation_id)
20
+ app_relation = Ribose::AppRelation.fetch(relation_id)
21
+
22
+ expect(app_relation.id).to eq(relation_id)
23
+ expect(app_relation.owner_type).to eq("User")
24
+ expect(app_relation.app_name).to eq("app/home")
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,50 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Ribose::Calendar do
4
+ describe ".all" do
5
+ it "retrieves the list of user calenders" do
6
+ stub_ribose_calendar_list_api
7
+ calendar = Ribose::Calendar.all
8
+
9
+ expect(calendar.cal_info.first.id).not_to be_nil
10
+ expect(calendar.cal_info.first.owner_type).to eq("User")
11
+ expect(calendar.cal_info.first.can_manage).to be_truthy
12
+ end
13
+ end
14
+
15
+ describe ".fetch" do
16
+ it "retrieves the details for a calendar" do
17
+ calendar_id = 123_456_789
18
+
19
+ stub_ribose_calendar_fetch_api(calendar_id)
20
+ calendar = Ribose::Calendar.fetch(calendar_id)
21
+
22
+ expect(calendar.id).not_to be_nil
23
+ expect(calendar.owner_type).to eq("User")
24
+ expect(calendar.name).to eq("Sample 101")
25
+ end
26
+ end
27
+
28
+ describe ".create" do
29
+ it "creates a new calendar with provided details" do
30
+ calendar_attributes = { owner_type: "User", name: "Sample" }
31
+
32
+ stub_ribose_calendar_create_api(calendar_attributes)
33
+ calendar = Ribose::Calendar.create(calendar_attributes)
34
+
35
+ expect(calendar.id).not_to be_nil
36
+ expect(calendar.owner_type).to eq("User")
37
+ end
38
+ end
39
+
40
+ describe ".delete" do
41
+ it "removes a valid user calendar" do
42
+ calendar_id = 123_456_789
43
+ stub_ribose_calendar_delete_api(calendar_id)
44
+
45
+ expect do
46
+ Ribose::Calendar.delete(calendar_id)
47
+ end.not_to raise_error
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,48 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Ribose::Client do
4
+ describe "#new" do
5
+ context "no attribtues provided" do
6
+ it "initialize with default configuration" do
7
+ client = Ribose::Client.new
8
+
9
+ expect(client.api_token).to eq(Ribose.configuration.api_token)
10
+ expect(client.user_email).to eq(Ribose.configuration.user_email)
11
+ end
12
+ end
13
+
14
+ context "custom attribtues provided" do
15
+ it "initialize with the supplied attribtues" do
16
+ client = Ribose::Client.new(token: 123, email: "john@ex.com")
17
+
18
+ expect(client.api_token).to eq("123")
19
+ expect(client.user_email).to eq("john@ex.com")
20
+ end
21
+ end
22
+ end
23
+
24
+ describe ".from_login" do
25
+ it "authenticate the user and build a client" do
26
+ email = "useremail@example..com"
27
+ password = "supersecretpassword"
28
+
29
+ allow(Ribose::Session).to receive(:create).and_return(session_hash)
30
+ client = Ribose::Client.from_login(email: email, password: password)
31
+
32
+ expect(client.user_email).to eq(email)
33
+ expect(client.api_token).to eq(session_hash["authentication_token"])
34
+ end
35
+ end
36
+
37
+ def session_hash
38
+ {
39
+ "authentication_token" => "SecretToken",
40
+ "last_activity" => {
41
+ "id" => 122072207,
42
+ "session_id" => "SessionId",
43
+ "browser" => "Ribose Ruby Client",
44
+ "user_id" => "user-uuid-123-4567"
45
+ },
46
+ }
47
+ end
48
+ end
@@ -0,0 +1,41 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Ribose::Config do
4
+ before { restore_to_default_config }
5
+ after { restore_to_default_config }
6
+
7
+ describe ".configure" do
8
+ it "allows us to set our configuration" do
9
+ api_host = "www.example.com"
10
+ api_token = "SUPER_SECRET_API_TOKEN"
11
+ user_email = "john.doe@example.com"
12
+
13
+ Ribose.configure do |config|
14
+ config.api_host = api_host
15
+ config.api_token = api_token
16
+ config.user_email = user_email
17
+ end
18
+
19
+ expect(Ribose.configuration.api_host).to eq(api_host)
20
+ expect(Ribose.configuration.debug_mode?).to be_falsey
21
+ expect(Ribose.configuration.api_token).to eq(api_token)
22
+ expect(Ribose.configuration.user_email).to eq(user_email)
23
+ expect(Ribose.configuration.web_url).to eq ["https", api_host].join("://")
24
+ end
25
+ end
26
+
27
+ describe ".configuration" do
28
+ it "returns the default configuration" do
29
+ configuration = Ribose.configuration
30
+
31
+ expect(configuration.api_token).to be_nil
32
+ expect(configuration.api_host).to eq("www.ribose.com")
33
+ end
34
+ end
35
+
36
+ def restore_to_default_config
37
+ Ribose.configuration.api_token = nil
38
+ Ribose.configuration.user_email = nil
39
+ Ribose.configuration.api_host = "www.ribose.com"
40
+ end
41
+ end
@@ -0,0 +1,79 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Ribose::ConnectionInvitation do
4
+ describe ".all" do
5
+ it "retrieves all of the connection invitations" do
6
+ stub_ribose_connection_invitation_lis_api
7
+ invitations = Ribose::ConnectionInvitation.all
8
+
9
+ expect(invitations.count).to eq(1)
10
+ expect(invitations.first.inviter.name).to eq("Jennie Doe")
11
+ expect(invitations.first.email).to eq("john.doe@example.com")
12
+ end
13
+ end
14
+
15
+ describe ".fetch" do
16
+ it "retrieves the details of an invitation" do
17
+ invitation_id = 123_456_789
18
+ stub_ribose_connection_invitation_fetch_api(invitation_id)
19
+ invitation = Ribose::ConnectionInvitation.fetch(invitation_id)
20
+
21
+ expect(invitation.id).not_to be_nil
22
+ expect(invitation.inviter.name).to eq("Jennie Doe")
23
+ expect(invitation.email).to eq("jennie.doe@example.com")
24
+ expect(invitation.type).to eq("Invitation::ToConnection")
25
+ end
26
+ end
27
+
28
+ describe ".create" do
29
+ it "creates new connection invitations" do
30
+ emails = ["jennie.doe@example.com"]
31
+ message_body = "Hi, Let's get connected in Ribose"
32
+
33
+ stub_ribose_connection_invitation_create_api(emails, message_body)
34
+ invitations = Ribose::ConnectionInvitation.create(
35
+ emails: emails, body: message_body,
36
+ )
37
+
38
+ expect(invitations.success.emails.first[0].to_s).to eq(emails.first)
39
+ expect(invitations.success.emails[emails.first].body).to eq(message_body)
40
+ end
41
+ end
42
+
43
+ describe ".accept" do
44
+ it "accepts a connection invitation" do
45
+ invitation_id = 123_456_789
46
+
47
+ stub_ribose_connection_invitation_update_api(invitation_id, 1)
48
+ invitation = Ribose::ConnectionInvitation.accept(invitation_id)
49
+
50
+ expect(invitation.state).to eq(1)
51
+ expect(invitation.id).not_to be_nil
52
+ expect(invitation.inviter.name).to eq("Jennie Doe")
53
+ end
54
+ end
55
+
56
+ describe ".reject" do
57
+ it "rejects a connection invitation" do
58
+ invitation_id = 123_456_789
59
+
60
+ stub_ribose_connection_invitation_update_api(invitation_id, 2)
61
+ invitation = Ribose::ConnectionInvitation.reject(invitation_id)
62
+
63
+ expect(invitation.id).not_to be_nil
64
+ expect(invitation.state).not_to be_nil
65
+ expect(invitation.inviter.name).to eq("Jennie Doe")
66
+ end
67
+ end
68
+
69
+ describe ".cancel" do
70
+ it "cancels a pending connection inviation" do
71
+ invitation_id = 123_456_789
72
+ stub_ribose_connection_invitation_cancel_api(invitation_id)
73
+
74
+ expect do
75
+ Ribose::ConnectionInvitation.cancel(invitation_id)
76
+ end.not_to raise_error
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,26 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Ribose::Connection do
4
+ describe ".all" do
5
+ it "retrieves the list of connections" do
6
+ stub_ribose_connection_list_api
7
+
8
+ connections = Ribose::Connection.all
9
+ first_connection = connections.objects.first
10
+
11
+ expect(first_connection.id).not_to be_nil
12
+ expect(first_connection.connection_id).not_to be_nil
13
+ expect(first_connection.data_for_jabber.login).to eq("riboseteam")
14
+ end
15
+ end
16
+
17
+ describe ".suggestions" do
18
+ it "retrieves the list of connection suggestions" do
19
+ stub_ribose_suggestion_list_api
20
+ suggestions = Ribose::Connection.suggestions
21
+
22
+ expect(suggestions.first.id).not_to be_nil
23
+ expect(suggestions.first.name).to eq("Jennie Doe")
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,84 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Ribose::Conversation do
4
+ describe ".all" do
5
+ it "retrieves the conversations for a space" do
6
+ space_id = 123_456_789
7
+
8
+ stub_ribose_space_conversation_list(space_id)
9
+ conversations = Ribose::Conversation.all(space_id)
10
+
11
+ expect(conversations.first.id).not_to be_nil
12
+ expect(conversations.first.number_of_messages).to eq(0)
13
+ expect(conversations.first.name).to eq("Sample conversation")
14
+ end
15
+ end
16
+
17
+ describe ".fetch" do
18
+ it "retrieves a specific converstion details" do
19
+ space_id = 123_456_789
20
+ conversation_id = 456_789
21
+
22
+ stub_ribose_space_conversation_fetch_api(space_id, conversation_id)
23
+ conversation = Ribose::Conversation.fetch(space_id, conversation_id)
24
+
25
+ expect(conversation.id).not_to be_nil
26
+ expect(conversation.name).to eq("Trips to the Mars!")
27
+ expect(conversation.contents).to eq("Did you already book the tickets?")
28
+ end
29
+ end
30
+
31
+ describe ".create" do
32
+ it "creates a new conversation into a space" do
33
+ space_id = 123_456_789
34
+
35
+ stub_ribose_space_conversation_create(space_id, conversation_attrs)
36
+ conversation = Ribose::Conversation.create(space_id, conversation_attrs)
37
+
38
+ expect(conversation.id).not_to be_nil
39
+ expect(conversation.name).to eq("Sample Conversation")
40
+ expect(conversation.tag_list).to eq(["sample", "conversation"])
41
+ end
42
+ end
43
+
44
+ describe ".update" do
45
+ it "updates a conversation with provided details" do
46
+ space_id = 123_456_789
47
+ conversation_id = 456_789
48
+
49
+ stub_ribose_space_conversation_update_api(
50
+ space_id, conversation_id, conversation_attrs
51
+ )
52
+
53
+ conversation = Ribose::Conversation.update(
54
+ space_id, conversation_id, conversation_attrs
55
+ )
56
+
57
+ expect(conversation.id).not_to be_nil
58
+ expect(conversation.contents).to eq("Did you already book the tickets?")
59
+ end
60
+ end
61
+
62
+ describe ".destroy" do
63
+ it "remvoes a conversation from a space" do
64
+ space_id = 123456789
65
+ conversation_id = 987_654_321
66
+
67
+ stub_ribose_space_conversation_remove(space_id, conversation_id)
68
+
69
+ expect do
70
+ Ribose::Conversation.destroy(
71
+ space_id: space_id, conversation_id: conversation_id,
72
+ )
73
+ end.not_to raise_error
74
+ end
75
+ end
76
+
77
+ def conversation_attrs
78
+ {
79
+ name: "Sample Conversation",
80
+ tag_list: "sample, conversation",
81
+ space_id: 123456789,
82
+ }
83
+ end
84
+ end