小编Rub*_*cut的帖子

流星测试驱动开发

我不知道如何在流星中进行测试驱动开发.

我在文档或常见问题解答中没有提到它.我没有看到任何例子或类似的东西.

我看到有些软件包正在使用Tinytest.

我需要开发人员的回应,这是什么路线图.有点像:

  • 可能,没有文档,自己搞清楚
  • 流星不是以可以制作可测试应用程序的方式构建的
  • 这是计划中的功能
  • 等等

tdd meteor

120
推荐指数
7
解决办法
1万
查看次数

如何将sinatra rack测试异常转储到控制台?

在我开发的过程中,我希望在运行测试时看到sinatra app异常,cosider示例:

require 'sinatra/base'

class ExceptionWeb < Sinatra::Base
  enable :raise_errors
  enable :dump_errors
  configure do 
    enable :dump_errors
  end
  get "/" do
    raise "hell"
    "ok"
  end
  def self.bad_method
    raise "bad method"    
  end
end


require 'rack/test'

describe 'The Web interface' do
  include Rack::Test::Methods

  def app
    ExceptionWeb
  end
  it "should error out" do
    get "/"
    #puts last_response.errors
    #ExceptionWeb.bad_method
    #last_response.should be_ok
  end
end
Run Code Online (Sandbox Code Playgroud)

下面的rspec代码显示没有异常,如果我取消注释last_response,那么我看到有些错误,但我看不出有什么问题.

但是电话mad_method显示我异常.

并且添加puts last_response.errors到每个测试看起来都不合适.

我尝试了sinatra配置选项raise_errors,dump_errors但这对我没什么帮助.

有任何想法吗?

rack rspec sinatra

4
推荐指数
2
解决办法
2689
查看次数

如何合并 webpack 开发服务器代理 url

我需要为我的 webpack 开发服务器路径设置标头,但是正如您所看到的此配置,我必须为我想要指定的每个 url 复制代理配置,有什么方法可以干燥此配置吗?

  devServer: {
port: 3120,
host: "10.0.0.46",
publicPath: "http://10.0.0.46:3102/dist/js/",
hot: true,
compress: true,
contentBase: path.join(__dirname, "public"),
proxy: {
  "/customer/x": {
    target: "http://localhost:3100",
    secure: false,
    onProxyReq: function (proxyReq, req, res) {
      proxyReq.setHeader('X-Forwarded-User', 'user');
    }
  },
  "/cluster/**": {
      target: "http://localhost:3100",
      secure: false,
      onProxyReq: function (proxyReq, req, res) {
        proxyReq.setHeader('X-Forwarded-User', 'user');
      }
  },
  "/server/**": {
      target: "http://localhost:3100",
      secure: false,
      onProxyReq: function (proxyReq, req, res) {
        proxyReq.setHeader('X-Forwarded-User', 'user');
      }
  },
  "/data": {
      target: "http://localhost:3100",
      secure: false,
      onProxyReq: function (proxyReq, req, …
Run Code Online (Sandbox Code Playgroud)

webpack webpack-dev-server webpack-2

1
推荐指数
1
解决办法
2187
查看次数

标签 统计

meteor ×1

rack ×1

rspec ×1

sinatra ×1

tdd ×1

webpack ×1

webpack-2 ×1

webpack-dev-server ×1