Sha256: 1ce239efda76d022e2aae354868c235791a0385394158589294f1f3c372b8538

Contents?: true

Size: 1.33 KB

Versions: 28

Compression:

Stored size: 1.33 KB

Contents

# -*- encoding : utf-8 -*-

describe Card::Set::Right::Email do
  context "<User>+*email" do
    before do
      @card = Card.fetch "u1+*email"
      @format = @card.format
    end

    it "allows Wagn Bot to read" do
      Card::Auth.as_bot do
        expect(@format.render_raw).to eq("u1@user.com")
      end
    end

    it "allows self to read" do
      Card::Auth.as Card["u1"] do
        expect(@format.render_raw).to eq("u1@user.com")
      end
    end

    it "hides from other users" do
      expect(@card.ok?(:read)).to be_falsey
      expect(@format.render_raw).to match(/denied/)
    end
  end

  context "+*account+*email" do
    context "update" do
      before do
        @email_card = Card["u1"].account.email_card
      end

      it "downcases email" do
        Card::Auth.as_bot do
          @email_card.update_attributes! content: "QuIrE@example.com"
          expect(@email_card.db_content).to eq("quire@example.com")
        end
      end

      it "requires valid email" do
        @email_card.update_attributes content: "boop"
        expect(@email_card.errors[:content].first)
          .to match(/must be valid address/)
      end

      it "requires unique email" do
        @email_card.update_attributes content: "joe@user.com"
        expect(@email_card.errors[:content].first).to match(/must be unique/)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
card-1.96.7 mod/account/spec/set/right/email_spec.rb
card-1.96.6 mod/account/spec/set/right/email_spec.rb
card-1.96.5 mod/account/spec/set/right/email_spec.rb
card-1.96.4 mod/account/spec/set/right/email_spec.rb
card-1.96.3 mod/account/spec/set/right/email_spec.rb
card-1.96.2 mod/account/spec/set/right/email_spec.rb
card-1.96.1 mod/account/spec/set/right/email_spec.rb
card-1.96.0 mod/account/spec/set/right/email_spec.rb
card-1.95.3 mod/account/spec/set/right/email_spec.rb
card-1.95.2 mod/account/spec/set/right/email_spec.rb
card-1.95.1 mod/account/spec/set/right/email_spec.rb
card-1.95.0 mod/account/spec/set/right/email_spec.rb
card-1.94.1 mod/account/spec/set/right/email_spec.rb
card-1.94.0 mod/account/spec/set/right/email_spec.rb
card-1.93.13 mod/account/spec/set/right/email_spec.rb
card-1.93.12 mod/account/spec/set/right/email_spec.rb
card-1.93.11 mod/account/spec/set/right/email_spec.rb
card-1.93.10 mod/account/spec/set/right/email_spec.rb
card-1.93.9 mod/account/spec/set/right/email_spec.rb
card-1.93.8 mod/account/spec/set/right/email_spec.rb