Project name was hardcoded (oops)
This commit is contained in:
parent
6d3a92f225
commit
b373158077
2 changed files with 9 additions and 5 deletions
|
@ -16,6 +16,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
class AssemblaService < Service
|
class AssemblaService < Service
|
||||||
|
attr_accessible :subdomain
|
||||||
|
|
||||||
include HTTParty
|
include HTTParty
|
||||||
|
|
||||||
validates :token, presence: true, if: :activated?
|
validates :token, presence: true, if: :activated?
|
||||||
|
@ -34,12 +36,13 @@ class AssemblaService < Service
|
||||||
|
|
||||||
def fields
|
def fields
|
||||||
[
|
[
|
||||||
{ type: 'text', name: 'token', placeholder: '' }
|
{ type: 'text', name: 'token', placeholder: '' },
|
||||||
|
{ type: 'text', name: 'subdomain', placeholder: '' }
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute(push)
|
def execute(push)
|
||||||
url = "https://atlas.assembla.com/spaces/ouposp/github_tool?secret_key=#{token}"
|
url = "https://atlas.assembla.com/spaces/#{subdomain}/github_tool?secret_key=#{token}"
|
||||||
AssemblaService.post(url, body: { payload: push }.to_json, headers: { 'Content-Type' => 'application/json' })
|
AssemblaService.post(url, body: { payload: push }.to_json, headers: { 'Content-Type' => 'application/json' })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,14 +33,15 @@ describe AssemblaService do
|
||||||
project_id: project.id,
|
project_id: project.id,
|
||||||
project: project,
|
project: project,
|
||||||
service_hook: true,
|
service_hook: true,
|
||||||
token: 'verySecret'
|
token: 'verySecret',
|
||||||
|
subdomain: 'project_name'
|
||||||
)
|
)
|
||||||
@sample_data = GitPushService.new.sample_data(project, user)
|
@sample_data = GitPushService.new.sample_data(project, user)
|
||||||
@api_url = 'https://atlas.assembla.com/spaces/ouposp/github_tool?secret_key=verySecret'
|
@api_url = 'https://atlas.assembla.com/spaces/project_name/github_tool?secret_key=verySecret'
|
||||||
WebMock.stub_request(:post, @api_url)
|
WebMock.stub_request(:post, @api_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should call FlowDock API" do
|
it "should call Assembla API" do
|
||||||
@assembla_service.execute(@sample_data)
|
@assembla_service.execute(@sample_data)
|
||||||
WebMock.should have_requested(:post, @api_url).with(
|
WebMock.should have_requested(:post, @api_url).with(
|
||||||
body: /#{@sample_data[:before]}.*#{@sample_data[:after]}.*#{project.path}/
|
body: /#{@sample_data[:before]}.*#{@sample_data[:after]}.*#{project.path}/
|
||||||
|
|
Loading…
Reference in a new issue