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

Symbolic Values Seem to be Skipped #36

Open
kyprifog opened this issue May 16, 2016 · 2 comments
Open

Symbolic Values Seem to be Skipped #36

kyprifog opened this issue May 16, 2016 · 2 comments

Comments

@kyprifog
Copy link

kyprifog commented May 16, 2016

Sorry if this is obvious. Can anyone explain to me why this is expected behavior?

require 'bundler/inline'

gemfile(true) do
  source 'https://rubygems.org'
  gem 'rspec'
  gem 'json_expressions'
end

require 'rspec'
require 'json_expressions/rspec'

class Test
  describe do
    it 'does not work' do
      expect({test: :test}).to match_json_expression({test: :test2})
    end
  end
end

results in

Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Using diff-lcs 1.2.5
Using json_expressions 0.8.3
Using rspec-support 3.4.1
Using bundler 1.11.2
Using rspec-core 3.4.4
Using rspec-expectations 3.4.0
Using rspec-mocks 3.4.1
Using rspec 3.4.0
.

Finished in 0.0005 seconds (files took 2 seconds to load)
1 example, 0 failures
@kyprifog
Copy link
Author

kyprifog commented May 16, 2016

I believe this is simply because this is a ruby hash and not valid JSON. I would expect this to throw an error instead.

@MiroslavCsonka
Copy link
Collaborator

Symbols are used for capturing certain values. In this case, you captured :test into your :test2. Search for matcher.captures[:user_id] in README to get more info.

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

2 participants