Sha256: 6f56ce6b4dbc58c5269bf4c88148258a36ec48d43849fefa1e5c321629813e3a

Contents?: true

Size: 730 Bytes

Versions: 6

Compression:

Stored size: 730 Bytes

Contents

require 'spec_helper'

module Happy
  describe Controller do
    subject do
      Controller.build do
        route do
          serve! "it works"
        end
      end
    end

    it "is mountable as a Rack app" do
      subject.should respond_to(:call)
      get '/'
      last_response.body.should == 'it works'
    end

    describe ".build" do
      subject do
        Controller.build do
          route { serve! "yay!" }
        end
      end

      it "creates a new controller class" do
        subject.ancestors.should include(Controller)
      end

      it "should use the passed block to initialize the new controller class" do
        get "/"
        last_response.body.should == 'yay!'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
happy-0.1.0.pre9 spec/controller_spec.rb
happy-0.1.0.pre8 spec/controller_spec.rb
happy-0.1.0.pre7 spec/controller_spec.rb
happy-0.1.0.pre.6 spec/controller_spec.rb
happy-0.1.0.pre.5 spec/controller_spec.rb
happy-0.1.0.pre.4 spec/controller_spec.rb