spec/acs/ldap/pusher_spec.rb in acs-ldap-0.2.4 vs spec/acs/ldap/pusher_spec.rb in acs-ldap-0.2.5

- old
+ new

@@ -43,15 +43,32 @@ @user.givenName = "Vador Dark" expect(@pusher.update(@user).success?).to eq true expect(@pusher.find_by('uid', 2).data[0][:givenName]).to eq ["Vador Dark"] end + it "should be possible to count Users" do + user = User.new({id: 3, sn: "doe", cn: "john", givenName: "John Doe", userPassword: "{SSHA}+MBMtUqzkOeH8hI1KVnl+djdqzw0YmU5M2Y5MmQyOTgxMDU1", mail: "jdoe@adharacs.lan"}) + user2 = User.new({id: 4, sn: "skywalker", cn: "luc", givenName: "Luc Skywalker", userPassword: "{SSHA}+MBMtUqzkOeH8hI1KVnl+djdqzw0YmU5M2Y5MmQyOTgxMDU1", mail: "lskywalker@adharacs.lan"}) + expect(@pusher.create(user).success?).to eq true + expect(@pusher.create(user2).success?).to eq true + expect(@pusher.count).to eq 3 + expect(@pusher.destroy(user).success?).to eq true + expect(@pusher.destroy(user2).success?).to eq true + end + it "should be possible to update only an attribute for a User" do @user.givenName = "D V" @user.mail = "dv@adharacs.lan" expect(@pusher.update(@user, {changes: {givenName: ["Vador Dark" => "D V"]}}).success?).to eq true expect(@pusher.find_by('uid', 2).data[0][:givenName]).to eq ["D V"] expect(@pusher.find_by('uid', 2).data[0][:mail]).to eq ["dvador@adharacs.lan"] + end + + it "should be possible to list all Users" do + count = @pusher.count + result = @pusher.index + expect(result.success?).to eq true + expect(result.data.count).to eq count end it "should be possible to remove a User" do expect(@pusher.destroy(@user).success?).to eq true expect(@pusher.count).to eq 0