Commit cb9f1a4fe73e11fe2250800e06e4c288818629d7
Exists in
spb-stable
and in
3 other branches
Merge pull request #6149 from carlosparamio/assembla_hardcoded_project_name
Assembla service: Project name was hardcoded (oops)
Showing
2 changed files
with
9 additions
and
5 deletions
Show diff stats
app/models/project_services/assembla_service.rb
... | ... | @@ -16,6 +16,8 @@ |
16 | 16 | # |
17 | 17 | |
18 | 18 | class AssemblaService < Service |
19 | + attr_accessible :subdomain | |
20 | + | |
19 | 21 | include HTTParty |
20 | 22 | |
21 | 23 | validates :token, presence: true, if: :activated? |
... | ... | @@ -34,12 +36,13 @@ class AssemblaService < Service |
34 | 36 | |
35 | 37 | def fields |
36 | 38 | [ |
37 | - { type: 'text', name: 'token', placeholder: '' } | |
39 | + { type: 'text', name: 'token', placeholder: '' }, | |
40 | + { type: 'text', name: 'subdomain', placeholder: '' } | |
38 | 41 | ] |
39 | 42 | end |
40 | 43 | |
41 | 44 | def execute(push) |
42 | - url = "https://atlas.assembla.com/spaces/ouposp/github_tool?secret_key=#{token}" | |
45 | + url = "https://atlas.assembla.com/spaces/#{subdomain}/github_tool?secret_key=#{token}" | |
43 | 46 | AssemblaService.post(url, body: { payload: push }.to_json, headers: { 'Content-Type' => 'application/json' }) |
44 | 47 | end |
45 | 48 | end | ... | ... |
spec/models/assembla_service_spec.rb
... | ... | @@ -33,14 +33,15 @@ describe AssemblaService do |
33 | 33 | project_id: project.id, |
34 | 34 | project: project, |
35 | 35 | service_hook: true, |
36 | - token: 'verySecret' | |
36 | + token: 'verySecret', | |
37 | + subdomain: 'project_name' | |
37 | 38 | ) |
38 | 39 | @sample_data = GitPushService.new.sample_data(project, user) |
39 | - @api_url = 'https://atlas.assembla.com/spaces/ouposp/github_tool?secret_key=verySecret' | |
40 | + @api_url = 'https://atlas.assembla.com/spaces/project_name/github_tool?secret_key=verySecret' | |
40 | 41 | WebMock.stub_request(:post, @api_url) |
41 | 42 | end |
42 | 43 | |
43 | - it "should call FlowDock API" do | |
44 | + it "should call Assembla API" do | |
44 | 45 | @assembla_service.execute(@sample_data) |
45 | 46 | WebMock.should have_requested(:post, @api_url).with( |
46 | 47 | body: /#{@sample_data[:before]}.*#{@sample_data[:after]}.*#{project.path}/ | ... | ... |