Sha256: d49539e44c755669929637a7dea7787d65a834a41800826bc4f962aa1e11f999
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
require "#{File.expand_path(File.dirname(__FILE__))}/helper" describe "HTTP basics" do inject :environment => :environment, :conveyors => :conveyors with_environment :development before :all do @dir = File.expand_path(File.dirname(__FILE__)) @app_original_dir = "#{@dir}/http_spec_data" $APP_DIR = "#{@dir}/http_spec" FileUtils.rm_r $APP_DIR if File.exist? $APP_DIR FileUtils.cp_r @app_original_dir, $APP_DIR crystal.after :environment do crystal.conveyors.web do |web| web.use Crystal::Processors::HttpWriter web.use Crystal::Processors::PrepareParams web.use Crystal::Processors::EvaluateFormat end end load "#{$APP_DIR}/config/init.rb" end after :all do remove_constants %w(PrepareParamsStub) $LOAD_PATH.delete "#{$APP_DIR}/plugin_a" $LOAD_PATH.delete "#{$APP_DIR}/plugin_b" FileUtils.rm_r $APP_DIR if File.exist? $APP_DIR end it "public symlink" do crystal[:environment] crystal.config.environment.should == 'development' File.should exist("#{$APP_DIR}/public/plugin_b") end it "http call" do workspace = nil Crystal::HTTPAdapter.mock_call do |&block| block.call workspace = crystal[:workspace] end # .should == [200, {"Content-Type" => "text/html"}, ""] expected_result = {:path => "/", :response => [200, {"Content-Type" => "text/html"}, ""], :params => {"format" => "html"}} workspace.to_h.symbolize_keys.subset(expected_result.keys).should == expected_result end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
crystal_ext-0.0.11 | spec/http/http_spec.rb |