Commit 4ac62e25 by Francis Zhou

fix robot message builder rspec

parent 688eb432
...@@ -41,13 +41,23 @@ RSpec.describe DingtalkSdk::Robot do ...@@ -41,13 +41,23 @@ RSpec.describe DingtalkSdk::Robot do
expect(mesg_h[:at]).to be_nil expect(mesg_h[:at]).to be_nil
end end
it 'should compose message with at all' do
builder = DingtalkSdk::Robot::MessageBuilder.new
builder.text text: 'hello world'
builder.at_all
mesg_h = builder.to_h
expect(mesg_h[:at][:isAtAll]).to be_truthy
expect(mesg_h[:at][:atMobiles]).to be_nil
end
it 'should compose message with at mobiles' do it 'should compose message with at mobiles' do
builder = DingtalkSdk::Robot::MessageBuilder.new builder = DingtalkSdk::Robot::MessageBuilder.new
builder.text text: 'hello world' builder.text text: 'hello world'
builder.at_mobiles [123, 456] builder.at_mobiles [123, 456]
mesg_h = builder.to_h mesg_h = builder.to_h
expect(mesg_h[:at][:isAtAll]).to be_nil expect(mesg_h[:at][:isAtAll]).to be_falsey
expect(mesg_h[:at][:atMobiles]).to eq(%w[123 456]) expect(mesg_h[:at][:atMobiles]).to eq(%w[123 456])
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment