Sha256: c014ba76b394615e976404ff079a0d112314bb1c4f6737ee151fb87017885075
Contents?: true
Size: 1.77 KB
Versions: 2
Compression:
Stored size: 1.77 KB
Contents
require 'helper' require 'focused_controller/functional_test_helper' require 'action_controller' module FocusedController module FunctionalTestHelper module FakePostsController class Action < ActionController::Base; end class Index < Action; end class Show < Action; end class TestCase < ActionController::TestCase include FocusedController::FunctionalTestHelper def initialize(method_name = :foo) super end def foo; end end class IndexTest < TestCase end class ShowTest < TestCase end end describe FunctionalTestHelper do subject { FakePostsController::IndexTest.new } it 'automatically determines the controller class' do FakePostsController::IndexTest.controller_class. must_equal FakePostsController::Index FakePostsController::ShowTest.controller_class. must_equal FakePostsController::Show end it "doesn't require using the action name to dispatch the action" do subject.singleton_class.class_eval do attr_reader :last_process def process(*args) @last_process = args end end subject.get :foo, :bar, :baz subject.last_process.must_equal ['call', :foo, :bar, :baz, 'GET'] subject.post :foo, :bar, :baz subject.last_process.must_equal ['call', :foo, :bar, :baz, 'POST'] subject.put :foo, :bar, :baz subject.last_process.must_equal ['call', :foo, :bar, :baz, 'PUT'] subject.delete :foo, :bar, :baz subject.last_process.must_equal ['call', :foo, :bar, :baz, 'DELETE'] subject.head :foo, :bar, :baz subject.last_process.must_equal ['call', :foo, :bar, :baz, 'HEAD'] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
focused_controller-1.0.0 | test/unit/functional_test_helper_test.rb |
focused_controller-0.2.0 | test/unit/functional_test_helper_test.rb |