Skip to content

add delete #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 12, 2024
Merged

add delete #84

merged 6 commits into from
Nov 12, 2024

Conversation

michaelglass
Copy link
Contributor

@michaelglass michaelglass commented Nov 12, 2024

migrates these helpers out of our rails monolith

@michaelglass michaelglass marked this pull request as ready for review November 12, 2024 11:21
@michaelglass michaelglass requested a review from mfonism November 12, 2024 11:21
@@ -44,6 +44,12 @@ def perform_delete(parameters={})
process(parameters)
end

def set_authenticity_token
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ... don't really know how to test this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does something like this look good?

it "can set authenticity token for the request" do
  test_request = nil

  Module.new do
    extend RailsEdgeTest::Dsl

    controller MyController do
      action :simple do
        edge "set the authenticity token" do
          test_request = request

          set_authenticity_token
        end
      end
    end
  end

  allow_any_instance_of(MyController).to receive(:form_authenticity_token).and_return('a_test_token')
  RailsEdgeTest::Dsl.execute!

  expect(test_request.headers['X-CSRF-Token']).to eq 'a_test_token'
end

Co-authored-by: Mfon Eti-mfon <[email protected]>
Copy link
Member

@mfonism mfonism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to go.

I've added a suggestion which I hope works for testing.

Feel free to merge whenever.

benjammins-love-it

@mfonism mfonism merged commit 8c93216 into master Nov 12, 2024
1 check passed
@mfonism mfonism deleted the add-delete branch November 12, 2024 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants