Skip to content

Instantly share code, notes, and snippets.

@cgibsonmm
Created January 31, 2018 20:38
Show Gist options
  • Save cgibsonmm/fdd068ab3ac2c8ac8c37069623198efb to your computer and use it in GitHub Desktop.
Save cgibsonmm/fdd068ab3ac2c8ac8c37069623198efb to your computer and use it in GitHub Desktop.
trying to output seed data and random running of tests but does not take config from helper
require_relative '../../../app/api'
module ExpenseTracker
RSpec.describe API do
describe 'POST /expenses' do
context 'when the expense is successfully recorded' do
it 'returns the expense id'
it 'responds with a 200 (OK)'
end
context 'when the expennse fails validation' do
it 'returns an error message'
it 'responds with a 422 (Unprocessable entity)'
end
end
end
end
ENV['RACK_ENV'] = 'test'
RSpec.configure do |config|
config.filter_gems_from_backtrace 'rack', 'rack-test', 'sequel', 'sinatra'
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.shared_context_metadata_behavior = :apply_to_host_groups
config.filter_run_when_matching :focus
config.example_status_persistence_file_path = "spec/examples.txt"
config.disable_monkey_patching!
config.warnings = true
if config.files_to_run.one?
config.default_formatter = "doc"
end
config.profile_examples = 10
config.order = :random
Kernel.srand config.seed
end
$ bundle exec rspec spec/unit/app/api_spec.rb
****
Pending: (Failures listed here are expected and do not affect your suite's status)
1) ExpenseTracker::API POST /expenses when the expense is successfully recorded returns the expense id
# Not yet implemented
# ./spec/unit/app/api_spec.rb:7
2) ExpenseTracker::API POST /expenses when the expense is successfully recorded responds with a 200 (OK)
# Not yet implemented
# ./spec/unit/app/api_spec.rb:8
3) ExpenseTracker::API POST /expenses when the expennse fails validation returns an error message
# Not yet implemented
# ./spec/unit/app/api_spec.rb:12
4) ExpenseTracker::API POST /expenses when the expennse fails validation responds with a 422 (Unprocessable entity)
# Not yet implemented
# ./spec/unit/app/api_spec.rb:13
Finished in 0.00094 seconds (files took 0.17951 seconds to load)
4 examples, 0 failures, 4 pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment