Sha256: 3bc6c30a812b965508866b73bc451c38cb596030b6929ee4e4af31efd681ba79
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 KB
Contents
require 'integration/spec_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-0.0.13 | spec/integration/basic_spec.rb |