Sha256: e761bcc505b38e4b40afd32b055e19a2fe4d84a887e7d387ae445d30eba81308
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
require "#{File.expand_path(File.dirname(__FILE__))}/helper" describe "Integration" do with_environment with_http before :all do HttpController = Crystal::HttpController @dir = "#{File.expand_path(File.dirname(__FILE__))}/basic_spec" $LOAD_PATH << @dir load 'crystal/profiles/web.rb' end after :all do $LOAD_PATH.delete @dir remove_constants %w( HttpController SmokeTestSpec JsonFormatSpec RequestAndSessionSpec ) end it "smoke test" do class ::SmokeTestSpec inherit HttpController def action respond_to do |format| format.json{render :json => {:a => 'b'}} format.html{render :inline => "some content"} end end end wcall("/smoke_test_spec/action") response.body.should == %(some content) wcall("/smoke_test_spec/action", :format => 'json') response.body.should == %({"a":"b"}) end it "json" do class ::JsonFormatSpec inherit HttpController def action render :json => {:a => 'b'} end end wcall("/json_format_spec/action.json") response.body.should == %({"a":"b"}) # response.rson.should == {'result' => 'value'} end it "should have workspace, request and session" do class ::RequestAndSessionSpec inherit HttpController inject :workspace => :workspace def action workspace.should_not == nil workspace.request.should_not == nil workspace.request.session.should_not == nil self.class.request_and_session_passed = true render :json => {:a => 'b'} end class << self attr_accessor :request_and_session_passed end end wcall('/request_and_session_spec/action.json') RequestAndSessionSpec.request_and_session_passed.should be_true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
crystal_ext-0.0.11 | spec/integration/basic_spec.rb |