Sha256: aedf3ca61905cbd18b5c1674457e5b7f1de01381071d3b82c977d3c479263cbc

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

require "test_helper"

class WatchtowerControllerTest < ActionController::TestCase
  context "on GET to :index" do
    setup do
      WatchedExceptionsPresenter.expects(:new).with(has_entries("query" => "term", "page" => "3")).returns([].paginate)
      get :index, :query => "term", :page => "3"
    end
    should_respond_with :success
  end
  
  context "on GET to :show" do
    context "with an existing ID" do
      setup do
        @exception = Factory :watched_exception
        get :show, :id => @exception.id
      end
      
      should_respond_with :success
      should_render_template :show
    end
    
    context "with an existing key" do
      setup do
        @exception = Factory :watched_exception, :key => "my-key"
        get :show, :id => "my-key"
      end
      
      should_respond_with :success
      should_render_template :show
    end
    
    context "with invalid id" do
      should "raise a not found error" do
        assert_raise ActiveRecord::RecordNotFound do
          get :show, :id => "key doesn't exist"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
joshuaclayton-watchtower-0.1.3 test/controllers/watchtower_controller_test.rb
joshuaclayton-watchtower-0.1.4 test/controllers/watchtower_controller_test.rb