spec/user.rb in zabbixapi-2.4.2 vs spec/user.rb in zabbixapi-2.4.3

- old
+ new

@@ -14,10 +14,20 @@ :smtp_server => "127.0.0.1", :smtp_email => "zabbix@test.com" ) end + def media + { + :mediatypeid => @mediatypeid, + :sendto => "test@test", + :active => 0, + :period => "1-7,00:00-24:00", + :severity => "56" + } + end + context 'when not exists' do describe 'create' do it "should return integer id" do user = gen_name 'user' userid = zbx.users.create( @@ -75,19 +85,25 @@ describe 'add_medias' do it "should return integer media id" do zbx.users.add_medias( :userids => [@userid], - :media => [ - { - :mediatypeid => @mediatypeid, - :sendto => "test@test", - :active => 0, - :period => "1-7,00:00-24:00", - :severity => "56" - } - ] + :media => [media] ).should be_kind_of(Integer) + end + end + + describe 'update_medias' do + it "should return the user id" do + # Call twice to ensure update_medias first successfully creates the media, then updates it + 2.times do + returned_userid = zbx.users.update_medias( + :userids => [@userid], + :media => [media] + ) + + returned_userid.should eq @userid + end end end describe 'delete' do it "should return id" do