我有
allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user)
但出于某种原因,当我打印page.body
时,我正在
"Rack session data \"session_id\" : \"{session_id}\" \"user_id\" : 1 \"uid\" : \"{user uid}\"
而不是页面的HTML。我对此行为感到非常困惑。我在capybara 2.4.4
答案 0 :(得分:0)
您是否访问了正确的页面?
访问给定页面的命令是[2015-12-01T00:00:00+00:00] Metric 1 blah blah
[2015-12-01T00:00:00+00:00] Metric 2 blah blah
[2015-12-01T00:00:00+00:00] Metric 3 blah blah
[2015-12-02T00:00:00+00:00] Metric 1 blah blah
[2015-12-02T00:00:00+00:00] Metric 2 blah blah
[2015-12-02T00:00:00+00:00] Metric 3 blah blah
[2015-12-03T00:00:00+00:00] Metric 1 blah blah
[2015-12-03T00:00:00+00:00] Metric 2 blah blah
[2015-12-03T00:00:00+00:00] Metric 3 blah blah
[2015-12-04T00:00:00+00:00] Metric 1 blah blah
[2015-12-04T00:00:00+00:00] Metric 2 blah blah
[2015-12-04T00:00:00+00:00] Metric 3 blah blah
[2015-12-05T00:00:00+00:00] Metric 1 blah blah
[2015-12-05T00:00:00+00:00] Metric 2 blah blah
[2015-12-05T00:00:00+00:00] Metric 3 blah blah
[2015-12-06T00:00:00+00:00] Metric 1 blah blah
[2015-12-06T00:00:00+00:00] Metric 2 blah blah
[2015-12-06T00:00:00+00:00] Metric 3 blah blah
[2015-12-07T00:00:00+00:00] Metric 1 blah blah
[2015-12-07T00:00:00+00:00] Metric 2 blah blah
[2015-12-07T00:00:00+00:00] Metric 3 blah blah
。确保在尝试检索其正文之前访问所需的页面。