Sha256: 88e20bc9b11bf9481a56d5a12d5fb692b11dc0a66a1cf7e2a335751b87e800d0

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true
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

5 entries across 5 versions & 1 rubygems

Version Path
social_networking-0.13.3 spec/models/social_networking/profile_spec.rb
social_networking-0.13.2 spec/models/social_networking/profile_spec.rb
social_networking-0.13.1 spec/models/social_networking/profile_spec.rb
social_networking-0.13.0 spec/models/social_networking/profile_spec.rb
social_networking-0.12.0 spec/models/social_networking/profile_spec.rb