Skip to content

Instantly share code, notes, and snippets.

@codeblooded
Created July 23, 2017 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeblooded/faaa20b8200cdb42f68b9f1675e9dc94 to your computer and use it in GitHub Desktop.
Save codeblooded/faaa20b8200cdb42f68b9f1675e9dc94 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe TraditionsController do
it 'returns traditions at index path' do
get '/traditions'
expect(response).to have_http_status(:success)
end
it 'destroys a tradition' do
tradition = create(:tradition)
old_id = tradition.id
delete "/traditions/#{old_id}"
expect { Tradition.find(old_id) }.to raise_error(ActiveRecord::RecordNotFound)
end
end
require 'test_helper'
class TraditionsControllerTest < ActionDispatch::IntegrationTest
def test_index
get '/traditions'
assert_response :success
end
def test_destroy
tradition = create(:tradition)
old_id = tradition.id
delete "/traditions/#{old_id}"
assert_raises(ActiveRecord::RecordNotFound) { Tradition.find(old_id) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment