Sha256: bb687da7ff5af9f5171403f1198d238d1bec6abe98c0d8fd90ecf5cd6f5e5476
Contents?: true
Size: 1.09 KB
Versions: 10
Compression:
Stored size: 1.09 KB
Contents
require 'spec_helper' describe RelationshipsController do let(:user) { FactoryGirl.create(:user) } let(:other_user) { FactoryGirl.create(:user) } before { sign_in user, no_capybara: true } describe "creating a relationship with Ajax" do it "should increment the Relationship count" do expect do xhr :post, :create, relationship: { followed_id: other_user.id } end.to change(Relationship, :count).by(1) end it "should respond with success" do xhr :post, :create, relationship: { followed_id: other_user.id } expect(response).to be_success end end describe "destroying a relationship with Ajax" do before { user.follow!(other_user) } let(:relationship) do user.relationships.find_by(followed_id: other_user.id) end it "should decrement the Relationship count" do expect do xhr :delete, :destroy, id: relationship.id end.to change(Relationship, :count).by(-1) end it "should respond with success" do xhr :delete, :destroy, id: relationship.id expect(response).to be_success end end end
Version data entries
10 entries across 10 versions & 1 rubygems