Sha256: 0e84e00bf7ba964eca9cf174c9fe61b75049b6f8db87250ae1cafc2301e95e08

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe User do
  context "when valid" do
    before(:each) do
      @user = FactoryGirl.build(:user)
    end
    it "should have a uniq email" do
      @user.save
      @user2 = FactoryGirl.build(:user, {email: @user.email})
      @user2.valid?.should be_false
    end
    it "should have an email" do
      @user.valid?.should be_true
      @user.email = nil
      @user.valid?.should be_false
    end
  end
  context "integrated with mail manager" do
    before(:each) do
      @user = FactoryGirl.create(:user)
    end
    it "should respond to subscriptions" do
      @user.respond_to?(:subscriptions).should be_true
    end
    it "should have a contact" do
      @user.contact.present?.should be_true
    end
    it "should have the same email as the contact" do
      @user.email.should == @user.contact.email_address
    end
    it "should be able to subscribe to a mailing list" do 
      @mailing_list = FactoryGirl.create(:mailing_list)
      @user.subscribe(@mailing_list)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mail_manager-0.1.4 spec/test_app/spec/models/user_spec.rb
mail_manager-0.1.2 spec/test_app/spec/models/user_spec.rb
mail_manager-0.1.1 spec/test_app/spec/models/user_spec.rb
mail_manager-0.1.0 spec/test_app/spec/models/user_spec.rb
mail_manager-0.0.1 spec/test_app/spec/models/user_spec.rb