Sha256: c26f8c91bbc4d1eedf6a9647a77a3ef55cb12b142b6d8409827407f02bbae580

Contents?: true

Size: 748 Bytes

Versions: 10

Compression:

Stored size: 748 Bytes

Contents

require 'spec_helper'

describe Relationship do

  let(:follower) { FactoryGirl.create(:user) }
  let(:followed) { FactoryGirl.create(:user) }
  let(:relationship) { follower.relationships.build(followed_id: followed.id) }

  subject { relationship }

  it { should be_valid }

  describe "follower methods" do
    it { should respond_to(:follower) }
    it { should respond_to(:followed) }
    its(:follower) { should eq follower }
    its(:followed) { should eq followed }
  end

  describe "when followed id is not present" do
    before { relationship.followed_id = nil }
    it { should_not be_valid }
  end

  describe "when follower id is not present" do
    before { relationship.follower_id = nil }
    it { should_not be_valid }
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active_mocker-1.2.pre.10 sample_app_rails_4/spec/models/relationship_spec.rb
active_mocker-1.2.pre.9 sample_app_rails_4/spec/models/relationship_spec.rb
active_mocker-1.2.pre.8 sample_app_rails_4/spec/models/relationship_spec.rb
active_mocker-1.2.pre.7 sample_app_rails_4/spec/models/relationship_spec.rb
active_mocker-1.2.pre.6 sample_app_rails_4/spec/models/relationship_spec.rb
active_mocker-1.2.pre.5 sample_app_rails_4/spec/models/relationship_spec.rb
active_mocker-1.2.pre.4 sample_app_rails_4/spec/models/relationship_spec.rb
active_mocker-1.2.pre.3 sample_app_rails_4/spec/models/relationship_spec.rb
active_mocker-1.2.pre.2 sample_app_rails_4/spec/models/relationship_spec.rb
active_mocker-1.2.pre.1 sample_app_rails_4/spec/models/relationship_spec.rb