Sha256: f5a2f322318255126e470eecd9c887dfdf651e5187fc0a694be1f105801bd24f

Contents?: true

Size: 1.07 KB

Versions: 25

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe HomeController do
  include SocialStream::TestHelpers

  render_views

  describe "when Anonymous" do
    it "should redirect to login" do
      get :index
      response.should redirect_to(new_user_session_path)
    end
  end

  describe "when authenticated" do
    before do
      @user = Factory(:user)
      sign_in @user
    end

    it "should render" do
      get :index

      response.should be_success
      response.body.should =~ /new_post/
    end

    context "with a group" do
      before do
        Factory(:friend,
                :contact => Factory(:g2g_contact, :sender => @user.actor))
      end

      it "should render" do
        get :index

        response.should be_success
        response.body.should =~ /new_post/
      end
    end

    describe "when representing" do
      before do
        @represented = represent(Factory(:group))
      end

      it "should render represented home" do
        get :index

        assert_response :success
        assigns(:current_subject).should == @represented
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
social_stream-base-2.0.0.beta3 spec/controllers/home_controller_spec.rb
social_stream-2.0.0.beta2 base/spec/controllers/home_controller_spec.rb
social_stream-base-2.0.0.beta2 spec/controllers/home_controller_spec.rb
social_stream-2.0.0.beta1 base/spec/controllers/home_controller_spec.rb
social_stream-base-2.0.0.beta1 spec/controllers/home_controller_spec.rb