Sha256: f55789435051b6650d17a5bd243f9c1f68a482decab3cf8d53ae72c84a6a1667

Contents?: true

Size: 1.25 KB

Versions: 11

Compression:

Stored size: 1.25 KB

Contents

require "spec_helper"

module SocialNetworking
  describe Profile, type: :model do
    fixtures :all

    let(:participant) { participants(:participant1) }

    describe "#started" do
      it "returns false if the participant hasn't answered any questions" do
        expect(Profile.create(
          participant: participant).started?).to eq false
      end

      it "returns true if the participant has answered at least one question" do
        expect(social_networking_profiles(:profile2).started?).to eq true
      end
    end

    describe "#user_name" do
      it "does not replace the display_name of a normal participant" do
        allow(participant).to receive(:is_admin).and_return(false)
        expect(
          Profile.create(participant: participant).user_name
              ).to eq("display name")
      end

      it "replaces the display_name of a moderator with an app-specific name" do
        allow(participant).to receive(:is_admin).and_return(true)
        expect(
          Profile.create(participant: participant).user_name
              ).to eq("Social Networking")
      end
    end

    it "is shared after creation" do
      expect do
        Profile.create(participant: participant)
      end.to change { SharedItem.count }.by(1)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
social_networking-0.11.8 spec/models/social_networking/profile_spec.rb
social_networking-0.11.7 spec/models/social_networking/profile_spec.rb
social_networking-0.11.6 spec/models/social_networking/profile_spec.rb
social_networking-0.11.5 spec/models/social_networking/profile_spec.rb
social_networking-0.11.4 spec/models/social_networking/profile_spec.rb
social_networking-0.11.3 spec/models/social_networking/profile_spec.rb
social_networking-0.11.2 spec/models/social_networking/profile_spec.rb
social_networking-0.11.1 spec/models/social_networking/profile_spec.rb
social_networking-0.11.0 spec/models/social_networking/profile_spec.rb
social_networking-0.10.0 spec/models/social_networking/profile_spec.rb
social_networking-0.9.3 spec/models/social_networking/profile_spec.rb