简体   繁体   中英

CircleCI connecting to wordpress through Rspec

I have a test that connects to my wordpress account using rubypress through Rspec, it works fine when running rspec locally, but when the tests are run with Circle CI I get the following error:

1) ProjectAccount .wordpress_users
 Failure/Error: users = project_account.wordpress_users
 XMLRPC::FaultException:
   Incorrect username or password.

Do I need any specific settings to connect to wordpress, either on my WP account or my circle.yml file? I feel like this error is impossible since it works locally, it can't be wrong username/password combo error.

Don't connect to external services in your tests! While this might sound like a good idea due to the high degree of acuity it gives very slow tests and violates application boundaries. Good tests should also be deterministic - if you are using an external service "live" the data might actually change or the server might not respond which will break your tests.

When working with external data sources I usually use the Webmock gem to mock out all external API requests. I sometimes use it with VCR which records actual requests and then plays back the canned response.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM