谁能向我解释为什么会这样?
get :robots
response.should render_template("no_index")
response.body.should match "User-agent: *\nDisallow: /\n"
Failure/Error: response.body.should match "User-agent: *\nDisallow: /\n"
expected "User-agent: *\nDisallow: /\n" to match "User-agent: *\nDisallow: /\n"
# ./spec/controllers/robots_controller_spec.rb:12:in `block (3 levels) in <top (required)>'
但
get :robots
response.should render_template("no_index")
response.body.should eq "User-agent: *\nDisallow: /\n"
通过?
这似乎相关(irb):
1.9.2p318 :001 > "User-agent: *\nDisallow: /\n".match "User-agent: *\nDisallow: /\n"
=> nil