Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
cb9f1a4f
Commit
cb9f1a4f
authored
Jan 23, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6149 from carlosparamio/assembla_hardcoded_project_name
Assembla service: Project name was hardcoded (oops)
parents
6d3a92f2
b3731580
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
app/models/project_services/assembla_service.rb
app/models/project_services/assembla_service.rb
+5
-2
spec/models/assembla_service_spec.rb
spec/models/assembla_service_spec.rb
+4
-3
No files found.
app/models/project_services/assembla_service.rb
View file @
cb9f1a4f
...
@@ -16,6 +16,8 @@
...
@@ -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
...
@@ -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
spec/models/assembla_service_spec.rb
View file @
cb9f1a4f
...
@@ -33,14 +33,15 @@ describe AssemblaService do
...
@@ -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
}
/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment