0

我想展示一种行为,该行为基本上表明路径“/”适用于 http 域,并且转到路径“/users/sign_in”会强制重定向到 https。你怎么能说明这一点?这是否属于控制器、请求或路由规范?

规范看起来像:

describe "https redirection" do
  context "when http" do
    it "forces a permanent redirect to /users/sign_in on https when path is /users/sign_in" do
    end
    it "returns status of 200 when path is /"
    end
  end
  context "when https" do
    it "returns status of 200 when path is /users/sign_in"
    end
  end
end
4

1 回答 1

0

用于request.env['HTTPS'] = 'on'激活 https。

在集成测试中,您可以检查 http 是否处于活动状态current_url.should match /^https:/

于 2013-02-13T02:33:46.943 回答