spec/group_spec.rb in jbox-gitolite-1.2.2 vs spec/group_spec.rb in jbox-gitolite-1.2.3

- old
+ new

@@ -2,18 +2,18 @@ describe Gitolite::Config::Group do describe "#new" do it "should create a new group with an empty list of users" do group = Gitolite::Config::Group.new("testgroup") - group.users.empty?.should be true - group.name.should == "testgroup" + expect(group.users.empty?).to be true + expect(group.name).to eq "testgroup" end it "should create a new group with a name containing #{Gitolite::Config::Group::PREPEND_CHAR}" do name = "#{Gitolite::Config::Group::PREPEND_CHAR}testgroup" group = Gitolite::Config::Group.new(name) - group.name.should == "testgroup" + expect(group.name).to eq "testgroup" end end describe "users" do before :each do @@ -21,105 +21,107 @@ end describe "#add_user" do it "should allow adding one user with a string" do @group.add_user("bob") - @group.size.should == 1 - @group.users.first.should == "bob" + expect(@group.size).to eq 1 + expect(@group.users.first).to eq "bob" end it "should allow adding one user with a symbol" do @group.add_user(:bob) - @group.size.should == 1 - @group.users.first.should == "bob" + expect(@group.size).to eq 1 + expect(@group.users.first).to eq "bob" end it "should not add the same user twice" do @group.add_user("bob") - @group.size.should == 1 + expect(@group.size).to eq 1 @group.add_user(:bob) - @group.size.should == 1 - @group.users.first.should == "bob" + expect(@group.size).to eq 1 + expect(@group.users.first).to eq "bob" end it "should maintain users in sorted order" do @group.add_user("susan") @group.add_user("peyton") @group.add_user("bob") - @group.users.first.should == "bob" - @group.users.last.should == "susan" + expect(@group.users.first).to eq "bob" + expect(@group.users.last).to eq "susan" end end describe "#add_users" do it "should allow adding multiple users at once" do @group.add_users("bob", "joe", "sue", "sam", "dan") - @group.size.should == 5 + expect(@group.size).to eq 5 end it "should allow adding multiple users in nested arrays" do @group.add_users(["bob", "joe", ["sam", "sue", "dan"]], "bill") - @group.size.should == 6 + expect(@group.size).to eq 6 end it "should allow adding users of symbols and strings" do @group.add_users("bob", :joe, :sue, "sam") - @group.size.should == 4 + expect(@group.size).to eq 4 end it "should not add the same user twice" do @group.add_users("bob", :bob, "bob", "sam") - @group.size.should == 2 + expect(@group.size).to eq 2 end end describe "#rm_user" do before :each do @group.add_users("bob", "joe", "susan", "sam", "alex") end it "should support removing a user via a String" do @group.rm_user("bob") - @group.size.should == 4 + expect(@group.size).to eq 4 end it "should support removing a user via a Symbol" do @group.rm_user(:bob) - @group.size.should == 4 + expect(@group.size).to eq 4 end end describe "#empty!" do it "should clear all users from the group" do @group.add_users("bob", "joe", "sue", "jim") - @group.size.should == 4 + expect(@group.size).to eq 4 @group.empty! - @group.size.should == 0 + expect(@group.size).to eq 0 end end describe "#size" do it "should reflect how many users are in the group" do @group.add_users("bob", "joe", "sue", "jim") - @group.users.length.should == @group.size + expect(@group.users.length).to eq @group.size end end describe "#has_user?" do it "should search for a user via a String" do @group.add_user("bob") - @group.has_user?("bob").should be true + expect(@group.has_user?("bob")).to be true end it "should search for a user via a Symbol" do @group.add_user(:bob) - @group.has_user?(:bob).should be true + expect(@group.has_user?(:bob)).to be true end end end describe "#to_s" do group = Gitolite::Config::Group.new("testgroup") group.add_users("bob", "joe", "sam", "sue") - group.to_s.should == "@testgroup = bob joe sam sue\n" #10 spaces after @testgroup + it { + expect(group.to_s).to eq "@testgroup = bob joe sam sue\n" #10 spaces after @testgroup + } end end