Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-02-10 21:13:39 +0300
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-02-10 21:13:39 +0300
commit299340ad0efb5add3226ffb65bf908e8f85fb057 (patch)
tree2ff9a44ae3782e2540972e8da5d028c35305079e /spec
parent367dee33e260fec07c6ebaf4e10b76e6dcda816d (diff)
parent42422dcc6aab156cc3e89c75c7ed2a71c715b169 (diff)
Merge branch 'broadcast-message-api' into 'master'
Add internal broadcast message API. See gitlab/gitlab-ee#241. Used by gitlab/gitlab-shell!53. See merge request !1486
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/internal_spec.rb45
1 files changed, 33 insertions, 12 deletions
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index 4faa1f9b964..1e8e9eb38d6 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -16,6 +16,27 @@ describe API::API, api: true do
end
end
+ describe "GET /internal/broadcast_message" do
+ context "broadcast message exists" do
+ let!(:broadcast_message) { create(:broadcast_message, starts_at: Time.now.yesterday, ends_at: Time.now.tomorrow ) }
+
+ it do
+ get api("/internal/broadcast_message"), secret_token: secret_token
+
+ response.status.should == 200
+ json_response["message"].should == broadcast_message.message
+ end
+ end
+
+ context "broadcast message doesn't exist" do
+ it do
+ get api("/internal/broadcast_message"), secret_token: secret_token
+
+ response.status.should == 404
+ end
+ end
+ end
+
describe "GET /internal/discover" do
it do
get(api("/internal/discover"), key_id: key.id, secret_token: secret_token)
@@ -37,7 +58,7 @@ describe API::API, api: true do
pull(key, project)
response.status.should == 200
- JSON.parse(response.body)["status"].should be_true
+ json_response["status"].should be_true
end
end
@@ -46,7 +67,7 @@ describe API::API, api: true do
push(key, project)
response.status.should == 200
- JSON.parse(response.body)["status"].should be_true
+ json_response["status"].should be_true
end
end
end
@@ -61,7 +82,7 @@ describe API::API, api: true do
pull(key, project)
response.status.should == 200
- JSON.parse(response.body)["status"].should be_false
+ json_response["status"].should be_false
end
end
@@ -70,7 +91,7 @@ describe API::API, api: true do
push(key, project)
response.status.should == 200
- JSON.parse(response.body)["status"].should be_false
+ json_response["status"].should be_false
end
end
end
@@ -87,7 +108,7 @@ describe API::API, api: true do
pull(key, personal_project)
response.status.should == 200
- JSON.parse(response.body)["status"].should be_false
+ json_response["status"].should be_false
end
end
@@ -96,7 +117,7 @@ describe API::API, api: true do
push(key, personal_project)
response.status.should == 200
- JSON.parse(response.body)["status"].should be_false
+ json_response["status"].should be_false
end
end
end
@@ -114,7 +135,7 @@ describe API::API, api: true do
pull(key, project)
response.status.should == 200
- JSON.parse(response.body)["status"].should be_true
+ json_response["status"].should be_true
end
end
@@ -123,7 +144,7 @@ describe API::API, api: true do
push(key, project)
response.status.should == 200
- JSON.parse(response.body)["status"].should be_false
+ json_response["status"].should be_false
end
end
end
@@ -140,7 +161,7 @@ describe API::API, api: true do
archive(key, project)
response.status.should == 200
- JSON.parse(response.body)["status"].should be_true
+ json_response["status"].should be_true
end
end
@@ -149,7 +170,7 @@ describe API::API, api: true do
archive(key, project)
response.status.should == 200
- JSON.parse(response.body)["status"].should be_false
+ json_response["status"].should be_false
end
end
end
@@ -159,7 +180,7 @@ describe API::API, api: true do
pull(key, OpenStruct.new(path_with_namespace: 'gitlab/notexists'))
response.status.should == 200
- JSON.parse(response.body)["status"].should be_false
+ json_response["status"].should be_false
end
end
@@ -168,7 +189,7 @@ describe API::API, api: true do
pull(OpenStruct.new(id: 0), project)
response.status.should == 200
- JSON.parse(response.body)["status"].should be_false
+ json_response["status"].should be_false
end
end
end