Sha256: a6de23eb935f15d38a796cb9d3612c1a0ac23af344cddbc60626b4763666dd1f

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 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 'should allow Wagn Bot to read' do
      Card::Auth.as_bot do
        @format.render_raw.should == 'u1@user.com'
      end
    end

    it 'should allow self to read' do
      Card::Auth.as Card['u1'] do
        @format.render_raw.should == 'u1@user.com'
      end
    end

    it 'should hide from other users' do
      @card.ok?(:read).should be_false
      @format.render_raw.should =~ /denied/
    end
  end
  
  context "+*account+*email" do
    context 'update' do
      before :each do
        @email_card = email_card = Card['u1'].account.email_card
      end
      
      it 'should downcase email' do
        Card::Auth.as_bot do
          @email_card.update_attributes! :content=>'QuIrE@example.com'
          @email_card.content.should == 'quire@example.com'
        end
      end

      it 'should require valid email' do
        @email_card.update_attributes :content=>'boop'
        @email_card.errors[:content].first.should =~ /must be valid address/
      end
      
      it 'should require unique email' do
        @email_card.update_attributes :content=>'joe@user.com'
        @email_card.errors[:content].first.should =~ /must be unique/
      end
      
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wagn-1.13.0 spec/mod/standard/set/right/email_spec.rb
wagn-1.13.0.pre2 spec/mods/standard/sets/right/email_spec.rb
wagn-1.13.0.pre1 spec/mods/standard/sets/right/email_spec.rb
wagn-1.13.0.pre spec/mods/standard/sets/right/email_spec.rb