Skip to content

Commit

Permalink
Added test for bad JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jun 17, 2024
1 parent b688003 commit 6f53a99
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ def test_event_time
assert_equal Time.current, event.time
end

def test_event_bad_json
visit = random_visit

event_params = {
visit_token: visit.visit_token,
visitor_token: visit.visitor_token,
events_json: "bad"
}
post ahoy_engine.events_url, params: event_params
assert_response :success

assert_equal 0, Ahoy::Event.count
end

def test_before_action
post ahoy_engine.visits_url, params: {visit_token: random_token, visitor_token: random_token}
assert_nil controller.ran_before_action
Expand Down

0 comments on commit 6f53a99

Please sign in to comment.