Sha256: f4b8ac1f7ecc5903c26ca3795e042e3ccb04b108b603a98358ad9dec18f82821

Contents?: true

Size: 1.31 KB

Versions: 23

Compression:

Stored size: 1.31 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')


describe NotificationsController do
  include SocialStream::TestHelpers
  render_views

  before do
    @user = Factory(:user)
    @actor =  @user.actor
    sign_in @user
    @receipt = @user.notify("subject", "body", Factory(:activity))
  end

  it "should render index" do
    get :index
    assert_response :success
  end

  it "should update read" do
    put :update, :id => @receipt.notification.to_param, :read => "Read"
    @receipt.notification.is_unread?(@actor).should==false
    response.should redirect_to notifications_path
  end

  it "should update unread" do
    put :update, :id => @receipt.notification.to_param, :read => "Unread"
    @receipt.notification.is_unread?(@actor).should==true
    response.should redirect_to notifications_path
  end

  it "should update all" do
    @receipt2 = @user.notify("subject", "body", Factory(:activity))
    put :update_all
    @receipt.notification.is_unread?(@actor).should==false
    @receipt2.notification.is_unread?(@actor).should==false
    response.should redirect_to notifications_path
  end
  
  it "should send to trash" do
    delete :destroy, :id => @receipt.notification.to_param
    @receipt.notification.is_trashed?(@actor).should==true
    response.should redirect_to notifications_path
    
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
social_stream-base-0.6.2 spec/controllers/notifications_controller_spec.rb
social_stream-base-0.6.1 spec/controllers/notifications_controller_spec.rb
social_stream-base-0.6.0 spec/controllers/notifications_controller_spec.rb