Skip to content

Commit

Permalink
Merge pull request #49 from apiaryio/pksunkara/fixes-2
Browse files Browse the repository at this point in the history
fix: Correct parameters in Refract adapter
  • Loading branch information
kuba-kubula authored Oct 3, 2016
2 parents 66805e7 + f6ddc02 commit 901eee7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/adapters/refract/transformResource.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ module.exports = (resourceElement, location, options) ->

resource.resourceParameters = resourceParameters
resource.actionParameters = actionParameters
resource.parameters = resourceParameters.concat(actionParameters)
resource.parameters = actionParameters or resourceParameters

resources.push(resource)
)
Expand Down
16 changes: 8 additions & 8 deletions test/refract-test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ describe('Transformations • Refract', ->
resource = ast.sections[0].resources[0]
)

it('resource has two parameters', ->
assert.equal(resource.parameters.length, 2)
)

it('resource has one resource parameter', ->
assert.equal(resource.resourceParameters.length, 1)
)

it('resource has one action parameter', ->
assert.equal(resource.actionParameters.length, 1)
)

it('resource has 1 parameters from action parameters', ->
assert.equal(resource.parameters.length, 1)
)
)

describe('With no response', ->
Expand Down Expand Up @@ -340,17 +340,17 @@ describe('Transformations • Refract', ->
assert.equal(resource.uriTemplate, '/test/{id}{?search,arg}')
)

it('resource have three paramters', ->
assert.equal(resource.parameters.length, 3)
)

it('2 paramters are resource paramters', ->
assert.equal(resource.resourceParameters.length, 2)
)

it('1 paramter is action paramter', ->
assert.equal(resource.actionParameters.length, 1)
)

it('resource have one paramters from action parameter', ->
assert.equal(resource.parameters.length, 1)
)
)

describe('Tags', ->
Expand Down

0 comments on commit 901eee7

Please sign in to comment.