Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

RSpec tests fail on fresh fork #36

Closed
GregBaugues opened this issue Aug 22, 2012 · 9 comments
Closed

RSpec tests fail on fresh fork #36

GregBaugues opened this issue Aug 22, 2012 · 9 comments
Labels

Comments

@GregBaugues
Copy link

I forked the repo, created a new harvest account, updated my harvest_credentials.yml, and ran RSpec.

On my first attempt, I received this error:

harvested/lib/harvest/api/base.rb:45:in `request': Harvest::BadRequest : 400 {"message":"Has recorded hours"} (Harvest::BadRequest)

This was resolved by deleting the sample hour entry in Harvest.

My tests now run with seven failures. Before digging into each one, I wanted to see if there is some step I am missing a "out of the box" setup.

Has anyone been able to successfully run their tests off a fresh clone? I'm on ruby 1.9.3.

Finished in 23.11 seconds
57 examples, 7 failures, 3 pending

Failed examples:

rspec ./spec/functional/expenses_spec.rb:25 # harvest expenses allows adding, updating, and removing expenses
rspec ./spec/functional/reporting_spec.rb:4 # harvest reporting allows project and people entry reporting
rspec ./spec/functional/reporting_spec.rb:50 # harvest reporting allows expense reporting
rspec ./spec/functional/time_tracking_spec.rb:4 # harvest time tracking allows adding, updating and removing entries
rspec ./spec/functional/time_tracking_spec.rb:23 # harvest time tracking allows you to save entries for a different user
rspec ./spec/functional/users_spec.rb:4 # harvest users allows adding, updating, and removing users
rspec ./spec/functional/users_spec.rb:47 # harvest users allows password resets
@zmoazeni
Copy link
Owner

I haven't run the suite in a while. Going to mess with it tonight and report back. Perhaps I can do something clever with the VCR cassettes so we can commit them without sensitive data.

@GregBaugues
Copy link
Author

You're looking for filter_sensitive_data. In your VCR configuration block, starting on line 7 of spec_helper.rb, you can do something like:

VCR.configure do |c|
  c.cassette_library_dir = '.cassettes'
  c.hook_into :webmock
  c.filter_sensitive_data('RANDOMGIBBERISH') { 'my-secret-harvest-password' }
end

VCR.config and c.stub_with :webmock are deprecated. I've changed to VCR.configure and c.hook_into :webmock

@zmoazeni
Copy link
Owner

Nice. Thanks for the tip!

@zmoazeni
Copy link
Owner

I also got the same failing tests.

@zmoazeni
Copy link
Owner

I'm not sure yet if these failures are due to API bugs or the library. I'll investigate when I have some time.

Also on filter_sensitive_data: that's not quite what I want. I want VCR to record the requests and responses but not put in the harvest username, password or subdomain. And I don't want to have to manually mess with the cassettes. That doesn't seem easily doable. Open to suggestions though.

@GregBaugues
Copy link
Author

This is what filter_sensitive data does. I'll mock up an example and submit a pull request.

@zmoazeni
Copy link
Owner

Cool, please do. I'm under the impression it's looking for tokens in an existing cassette and replaces it with what you specify in the configuration. If I can have the server calls to create the cassettes and use filter_sensitive_data ... uber win.

@zmoazeni
Copy link
Owner

zmoazeni commented Oct 7, 2012

I believe @prsimp has a fully green suite locally.

@zmoazeni
Copy link
Owner

Closing this bad boy now that @prsimp green'd up our suite.

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

No branches or pull requests

2 participants