-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for validation_rule_assignment
- Loading branch information
jkaliszuk
committed
May 8, 2024
1 parent
670f445
commit 8dd636b
Showing
3 changed files
with
45 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
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
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,35 @@ | ||
require_relative '../lib/config.rb' | ||
require_relative '../lib/voucherify_data.rb' | ||
require 'VoucherifySdk' | ||
|
||
RSpec.describe 'Validation Rules API', :order => :defined do | ||
before(:each) do | ||
@validation_rules_api_instance = Config.validation_rules_api_instance() | ||
@voucherify_data = VoucherifyData.instance() | ||
end | ||
|
||
it 'create validation rule', :order => :first do | ||
voucher = @voucherify_data.get_voucher() | ||
validation_rule = @voucherify_data.get_validation_rule() | ||
|
||
validationRulesAssignmentsCreateRequestBody = VoucherifySdk::ValidationRulesAssignmentsCreateRequestBody.new({ | ||
related_object_type: "voucher", | ||
related_object_id: voucher.code | ||
}) | ||
|
||
created_validation_rule_assignment = @validation_rules_api_instance.create_validation_rule_assignment(validation_rule.id, { | ||
validation_rules_assignments_create_request_body: validationRulesAssignmentsCreateRequestBody | ||
}) | ||
|
||
puts(created_validation_rule_assignment) | ||
|
||
expect(created_validation_rule_assignment).not_to be_nil | ||
expect(created_validation_rule_assignment.id).not_to be_nil | ||
expect(created_validation_rule_assignment.created_at).not_to be_nil | ||
expect(created_validation_rule_assignment.rule_id).to eq(validation_rule.id) | ||
expect(created_validation_rule_assignment.related_object_id).to eq(voucher.id) | ||
expect(created_validation_rule_assignment.related_object_type).to eq("voucher") | ||
expect(created_validation_rule_assignment.object).to eq("validation_rules_assignment") | ||
end | ||
|
||
end |