Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No diff output when matching strings that differ in trailing newlines #570

Open
phiggins opened this issue Jun 10, 2014 · 0 comments
Open

Comments

@phiggins
Copy link
Contributor

If I have a spec like this:

$ cat test_spec.rb 
describe "test case" do
  it "diffs its arguments" do
    expect("foo\n").to eq("foo")
  end
end

When I run it I get output like this:

pete@balloon:~/projects/rspec-support$ rspec test_spec.rb 
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

test case
  diffs its arguments (FAILED - 1)

Failures:

  1) test case diffs its arguments
     Failure/Error: expect("foo\n").to eq("foo")

       expected: "foo"
            got: "foo\n"

       (compared using ==)

       Diff:

     # /home/pete/projects/rspec-expectations/lib/rspec/expectations/fail_with.rb:33:in `fail_with'
     # /home/pete/projects/rspec-expectations/lib/rspec/expectations/handler.rb:36:in `handle_failure'
     # /home/pete/projects/rspec-expectations/lib/rspec/expectations/handler.rb:49:in `handle_matcher'
     # /home/pete/projects/rspec-expectations/lib/rspec/expectations/expectation_target.rb:54:in `to'
     # ./test_spec.rb:3:in `block (2 levels) in <top (required)>'
     # /home/pete/projects/rspec-core/lib/rspec/core/example.rb:148:in `instance_exec'
     # /home/pete/projects/rspec-core/lib/rspec/core/example.rb:148:in `block in run'
     # /home/pete/projects/rspec-core/lib/rspec/core/example.rb:299:in `with_around_example_hooks'
     # /home/pete/projects/rspec-core/lib/rspec/core/example.rb:145:in `run'
     # /home/pete/projects/rspec-core/lib/rspec/core/example_group.rb:494:in `block in run_examples'
     # /home/pete/projects/rspec-core/lib/rspec/core/example_group.rb:490:in `map'
     # /home/pete/projects/rspec-core/lib/rspec/core/example_group.rb:490:in `run_examples'
     # /home/pete/projects/rspec-core/lib/rspec/core/example_group.rb:457:in `run'
     # /home/pete/projects/rspec-core/lib/rspec/core/runner.rb:112:in `block (2 levels) in run_specs'
     # /home/pete/projects/rspec-core/lib/rspec/core/runner.rb:112:in `map'
     # /home/pete/projects/rspec-core/lib/rspec/core/runner.rb:112:in `block in run_specs'
     # /home/pete/projects/rspec-core/lib/rspec/core/reporter.rb:54:in `report'
     # /home/pete/projects/rspec-core/lib/rspec/core/runner.rb:108:in `run_specs'
     # /home/pete/projects/rspec-core/lib/rspec/core/runner.rb:86:in `run'
     # /home/pete/projects/rspec-core/lib/rspec/core/runner.rb:70:in `run'
     # /home/pete/projects/rspec-core/lib/rspec/core/runner.rb:38:in `invoke'
     # /home/pete/projects/rspec-core/exe/rspec:4:in `<top (required)>'
     # /home/pete/.rvm/gems/ruby-2.1.2@rspec-support/bin/rspec:23:in `load'
     # /home/pete/.rvm/gems/ruby-2.1.2@rspec-support/bin/rspec:23:in `<main>'
     # /home/pete/.rvm/gems/ruby-2.1.2@rspec-support/bin/ruby_executable_hooks:15:in `eval'
     # /home/pete/.rvm/gems/ruby-2.1.2@rspec-support/bin/ruby_executable_hooks:15:in `<main>'

Finished in 0.00133 seconds (files took 0.08229 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./test_spec.rb:2 # test case diffs its arguments

Randomized with seed 29283

The output indicates that there should be a diff but no diff is present. See also rspec/rspec-support#70.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant