Sha256: 55f9169393b445cc74ed05aa86fa4ea1ff512e6cad62f58db8349235442bab84
Contents?: true
Size: 1.82 KB
Versions: 45
Compression:
Stored size: 1.82 KB
Contents
require "rails_helper" RSpec.describe ::Dorsale::CustomerVault::PeopleController, type: :controller do routes { Dorsale::Engine.routes } let(:user) { create(:user) } describe "#index" do it "should redirect to activity" do get :index expect(response).to redirect_to customer_vault_people_activity_path end end describe '#list' do describe 'sorting' do let!(:alice) { create(:customer_vault_individual, first_name: 'Alice', last_name: 'Zarston') } let!(:bob) { create(:customer_vault_individual, first_name: 'Bob', last_name: 'Tilan') } let!(:corporation) { create(:customer_vault_corporation, name: 'Zorg Corp') } it 'should sort people by name by default' do get :list expect(assigns(:people)).to eq([bob, alice, corporation]) end end describe "search" do it "search should ignore filters" do corporation1 = create(:customer_vault_corporation, tag_list: "abc", name: "aaa") corporation2 = create(:customer_vault_corporation, tag_list: "xyz", name: "bbb") @request.cookies["filters"] = {tags: ["abc"]}.to_json get :list, q: "bbb" expect(assigns(:people)).to eq [corporation2] end end end describe "activity" do before do @person = create(:customer_vault_corporation) @comment1 = @person.comments.create!(text: "ABC", created_at: Time.now - 3.days, author: user) @comment2 = @person.comments.create!(text: "DEF", created_at: Time.now - 2.days, author: user) @comment3 = @person.comments.create!(text: "DEF", created_at: Time.now - 9.days, author: user) end it "should assigns all comments ordered by created_at DESC" do get :activity expect(assigns(:comments)).to eq [@comment2, @comment1, @comment3] end end end
Version data entries
45 entries across 45 versions & 1 rubygems