-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Super Scaffold incoming webhooks test (#502)
* Add bullet_train_webhooks controller test * Edit webhooks controller test in transformer * Add bullet train webhooks routing * Fixing Standard Ruby * Wrap webhook test in scaffolding thing check * Add original replacement code in webhooks transformer * Add bullet_train_webhooks controller test * Edit webhooks controller test in transformer * Fixing Standard Ruby * Wrap webhook test in scaffolding thing check * Add original replacement code in webhooks transformer * Use Membership instead of CreativeConcept in incoming webhook test
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
Rails.application.routes.draw do | ||
namespace :webhooks do | ||
namespace :incoming do | ||
resources :bullet_train_webhooks | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...ming_webhooks/test/controllers/webhooks/incoming/bullet_train_webhooks_controller_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require "test_helper" | ||
|
||
class Webhooks::Incoming::BulletTrainWebhooksControllerTest < ActionDispatch::IntegrationTest | ||
include Devise::Test::IntegrationHelpers | ||
|
||
def setup | ||
super | ||
@user = FactoryBot.create(:onboarded_user) | ||
@membership = @user.memberships.first | ||
@team = @user.current_team | ||
end | ||
|
||
test "should get incoming webhook" do | ||
webhook_params = { | ||
data: { | ||
data: { | ||
name: "Test", | ||
team_id: { | ||
id: @team.id, | ||
slug: nil, | ||
locale: nil, | ||
time_zone: @team.time_zone, | ||
created_at: @membership.created_at, | ||
updated_at: @membership.updated_at, | ||
being_destroyed: nil, | ||
}, | ||
description: "" | ||
}, | ||
event_type: "membership.created", | ||
subject_type: "Membership" | ||
}, | ||
verified_at: nil, | ||
processed_at: nil, | ||
} | ||
|
||
post "/webhooks/incoming/bullet_train_webhooks", params: webhook_params.to_json | ||
assert_equal response.parsed_body, {"status" => "OK"} | ||
|
||
webhook = Webhooks::Incoming::BulletTrainWebhook.first | ||
assert_equal webhook.data.to_json, webhook_params.to_json | ||
end | ||
end |