Sha256: 08c29854c1545446835d8c868198a6f2bf82100978d16597ab55fad61a9be355

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

require 'spec_helper'

module Fendhal

  class TestAction < Action

    def action
      respond_to :html, :csv
    end

  end

  class MockController

    def respond_to &block
      block.call format
    end

    class Format
      def method_missing name, *args, &block
        self
      end
    end

    def format
      @format ||= Format.new
    end

  end

  describe Action do

    let (:action)     { Action.new(controller) }
    let (:controller) { MockController.new     }
    let (:format)     { controller.format      }

    it 'responds to formats by calling the respective methods' do
      format.should_receive(:html)
      format.should_receive(:csv)
      action.respond_to(:html, :csv)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fendhal-0.0.1 spec/lib/fendhal/action_spec.rb