Change summary
test/test_registration.rb | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
Detailed changes
@@ -357,6 +357,37 @@ class RegistrationTest < Minitest::Test
end
em :test_write_with_parent_code
+ def test_write_with_parent_code_onboarding_jid
+ Command::COMMAND_MANAGER.expect(
+ :write,
+ EMPromise.resolve(Blather::Stanza::Iq::Command.new.tap { |iq|
+ iq.form.fields = [
+ { var: "plan_name", value: "test_usd" },
+ { var: "code", value: "PARENT_CODE" }
+ ]
+ }),
+ [Matching.new do |iq|
+ assert_equal :form, iq.form.type
+ assert_equal(
+ "You've selected +15555550000 as your JMP number.",
+ iq.form.instructions.lines.first.chomp
+ )
+ end]
+ )
+ @customer.expect(:jid, Blather::JID.new("test@onboarding.example.com"))
+ iq = Blather::Stanza::Iq::Command.new
+ iq.from = "test@onboarding.example.com"
+ assert_equal(
+ "Please create a new Jabber ID before creating a subaccount.",
+ execute_command(iq) { @activation.write.catch(&:to_s) }
+ )
+ assert_mock Command::COMMAND_MANAGER
+ assert_mock @customer
+ assert_mock Registration::Activation::Payment
+ assert_mock Registration::Activation::DB
+ end
+ em :test_write_with_parent_code_onboarding_jid
+
def test_write_with_parent_code_tombed_parent
Command::COMMAND_MANAGER.expect(
:write,