Skip to content

Commit

Permalink
Rename 'number' attribute by 'id' for consistency
Browse files Browse the repository at this point in the history
Co-authored-by: David Kang <dkang@suse.com>
  • Loading branch information
eduardoj and David Kang committed Nov 20, 2019
1 parent 695ecf8 commit fec2fc0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/api/api/create_excluded_requests.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<excluded_requests>
<request number='33' description='invalid request'/>
<request id='33' description='invalid request'/>
</excluded_requests>
4 changes: 2 additions & 2 deletions src/api/app/models/staging/request_excluder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def exclusions
end

def exclude_request(request)
bs_request = staging_workflow.target_of_bs_requests.find_by(number: request[:number])
return unless valid_request?(bs_request, request[:number])
bs_request = staging_workflow.target_of_bs_requests.find_by(number: request[:id])
return unless valid_request?(bs_request, request[:id])

request_excluded = Staging::RequestExclusion.new(bs_request: bs_request,
number: bs_request.try(:number),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
context 'succeeds' do
before do
post :create, params: { staging_workflow_project: staging_workflow.project.name, format: :xml },
body: "<excluded_requests><request number='#{bs_request.number}' description='hey'/></excluded_requests>"
body: "<excluded_requests><request id='#{bs_request.number}' description='hey'/></excluded_requests>"
end

subject { staging_workflow.request_exclusions.last }
Expand All @@ -72,7 +72,7 @@
context 'fails: project does not exist' do
before do
post :create, params: { staging_workflow_project: 'i_do_not_exist', format: :xml },
body: "<excluded_requests><request number='#{bs_request.number}' description='hey'/></excluded_requests>"
body: "<excluded_requests><request id='#{bs_request.number}' description='hey'/></excluded_requests>"
end

it { expect(response).to have_http_status(:not_found) }
Expand All @@ -82,7 +82,7 @@
let(:project_without_staging) { create(:project, name: 'no_staging') }
before do
post :create, params: { staging_workflow_project: project_without_staging, format: :xml },
body: "<excluded_requests><request number='#{bs_request.number}' description='hey'/></excluded_requests>"
body: "<excluded_requests><request id='#{bs_request.number}' description='hey'/></excluded_requests>"
end

it { expect(response).to have_http_status(404) }
Expand All @@ -91,7 +91,7 @@
context 'fails: no description, invalid request exclusion' do
before do
post :create, params: { staging_workflow_project: staging_workflow.project.name, format: :xml },
body: "<excluded_requests><request number='#{bs_request.number}'/></excluded_requests>"
body: "<excluded_requests><request id='#{bs_request.number}'/></excluded_requests>"
end

it { expect(response).to have_http_status(400) }
Expand All @@ -100,7 +100,7 @@
context 'fails: non-existant bs_request number, invalid request exclusion' do
before do
post :create, params: { staging_workflow_project: staging_workflow.project.name, format: :xml },
body: "<excluded_requests><request number='43_543'/></excluded_requests>"
body: "<excluded_requests><request id='43_543'/></excluded_requests>"
end

it { expect(response).to have_http_status(400) }
Expand All @@ -111,7 +111,7 @@
bs_request.staging_project = staging_workflow.staging_projects.first
bs_request.save
post :create, params: { staging_workflow_project: staging_workflow.project.name, format: :xml },
body: "<excluded_requests><request number='43_543'/></excluded_requests>"
body: "<excluded_requests><request id='43_543'/></excluded_requests>"
end

it { expect(response).to have_http_status(400) }
Expand Down

0 comments on commit fec2fc0

Please sign in to comment.