Created
July 23, 2017 21:22
-
-
Save codeblooded/faaa20b8200cdb42f68b9f1675e9dc94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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