rspec / rspec-expectations

Provides a readable API to express expected outcomes of a code example
https://rspec.info
MIT License
1.26k stars 395 forks source link

Regex match is not evaluating correctly in Chefspec test #948

Closed mlcooper closed 8 years ago

mlcooper commented 8 years ago

Below is a spec test that's failing, however in rubular.com it is a full match.

Failure/Error: expect(chef_run.remote_file(temp_file).source).to match(/.+ddagent-cli-4.4.0.msi/)

       expected ["https://s3.amazonaws.com/ddagent-windows-stable/ddagent-cli-4.4.0.msi"] to match /.+ddagent-cli-4.4.0.msi/
       Diff:
       @@ -1,2 +1,2 @@
       -/.+ddagent-cli-4.4.0.msi/
       +["https://s3.amazonaws.com/ddagent-windows-stable/ddagent-cli-4.4.0.msi"]

It looks as if in rspec the regex is not being evaluated as a regex, but rather just a string. Why would this work in rubular and in irb but not here in chefspec?

rspec gems on my machine:

rspec (3.5.0)
rspec-core (3.5.4, 3.5.3)
rspec-expectations (3.5.0)
rspec-its (1.2.0)
rspec-mocks (3.5.0)
rspec-support (3.5.0)
rspec_junit_formatter (0.2.3)
serverspec (2.36.1)
mlcooper commented 8 years ago

An array is being returned and comparing a regex to an array does not work.