Skip to content

Commit

Permalink
add @mfonism's tests (thanks)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelglass committed Nov 12, 2024
1 parent 648da52 commit 4bfdc92
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec/rails_edge_test/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,29 @@ def another
expect(test_value[2].body).to eq({this: 'deletes'}.to_json)
end

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

it "can incorporate request, session, and params when making a request" do
test_value = nil
expected_value = {
Expand Down

0 comments on commit 4bfdc92

Please sign in to comment.