Skip to content

Commit

Permalink
Simplify updating request attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeuken committed Feb 18, 2019
1 parent 5e4f84e commit 64a871a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions src/api/spec/bootstrap/features/webui/requests_spec.rb
Expand Up @@ -204,13 +204,11 @@

describe 'shows the correct auto accepted message' do
before do
bs_request.accept_at = Time.now
bs_request.save
bs_request.update_attributes(accept_at: Time.now)
end

scenario 'when request is in a final state' do
bs_request.state = :accepted
bs_request.save
bs_request.update_attributes(state: :accepted)
visit request_show_path(bs_request)
expect(page).to have_text("Auto-accept was set to #{I18n.localize bs_request.accept_at, format: :only_date}.")
end
Expand All @@ -221,8 +219,7 @@
end

scenario 'when request auto_accept is in the future and not in a final state' do
bs_request.accept_at = Time.now + 1.day
bs_request.save
bs_request.update_attributes(accept_at: Time.now + 1.day)
visit request_show_path(bs_request)
expect(page).
to have_text("This request will be automatically accepted in #{ApplicationController.helpers.time_ago_in_words(bs_request.accept_at)}.")
Expand Down
9 changes: 3 additions & 6 deletions src/api/spec/features/webui/requests_spec.rb
Expand Up @@ -192,13 +192,11 @@

describe 'shows the correct auto accepted message' do
before do
bs_request.accept_at = Time.now
bs_request.save
bs_request.update_attributes(accept_at: Time.now)
end

scenario 'when request is in a final state' do
bs_request.state = :accepted
bs_request.save
bs_request.update_attributes(state: :accepted)
visit request_show_path(bs_request)
expect(page).to have_text("Auto-accept was set to #{I18n.localize bs_request.accept_at, format: :only_date}.")
end
Expand All @@ -209,8 +207,7 @@
end

scenario 'when request auto_accept is in the future and not in a final state' do
bs_request.accept_at = Time.now + 1.day
bs_request.save
bs_request.update_attributes(accept_at: Time.now + 1.day)
visit request_show_path(bs_request)
expect(page).
to have_text("This request will be automatically accepted in #{ApplicationController.helpers.time_ago_in_words(bs_request.accept_at)}.")
Expand Down

0 comments on commit 64a871a

Please sign in to comment.