Sha256: 5225e0bd6f769a5aa96538c2f9f577d82e232e56b45e093bd06e1739bc108029

Contents?: true

Size: 1.38 KB

Versions: 21

Compression:

Stored size: 1.38 KB

Contents

require File.dirname(__FILE__) + "/../../spec_helper"

describe Admin::MessagesController do
  dataset :messages
  
  it "should be a ResourceController" do
    controller.should be_kind_of(Admin::ResourceController)
  end

  it "should handle Messages" do
    controller.class.model_class.should == Message
  end

  describe "on preview" do
    before do
      login_as :existing
    end
    
    it "should render a bare message" do
      get :preview, :id => message_id(:taggy)
      response.should be_success
      response.should render_template('preview')
      response.layout.should == nil
    end

  end
  
  describe "on deliver" do
    before do
      login_as :existing
    end
    
    it "should trigger a sending" do
      message = messages(:taggy)
      Message.should_receive(:find).at_least(:once).and_return(message)
      message.should_receive(:deliver).once
      get :deliver, :id => message_id(:taggy), :delivery => 'all'
      response.should be_redirect
      response.should redirect_to(admin_message_url(messages(:taggy)))
    end
  end
  
  describe "on update (and create)" do
    before do
      login_as :existing
    end
    
    it "should redirect to show the updated object" do
      put :update, :id => message_id(:normal), :subject => 'testing'
      response.should be_redirect
      response.should redirect_to(admin_message_path(message_id(:normal)))
    end
  end
  
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
radiant-reader-extension-1.3.13 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.3.12 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.3.11 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.3.10 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.3.9 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.3.8 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.3.7 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.3.6 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.3.4 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.3.3 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.3.1 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.3.0 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.2.4 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.2.3 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.2.2 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.2.1 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.2.0 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.1.1 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.1.0 spec/controllers/admin/messages_controller_spec.rb
radiant-reader-extension-1.0.1 spec/controllers/admin/messages_controller_spec.rb