summaryrefslogtreecommitdiff
path: root/test/controllers/images/sources_controller_test.rb
blob: 3a6f0aae81afb14697e0d2869dffc215f98b3070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require 'test_helper'

class Posts::SourcesControllerTest < ActionController::TestCase
  setup do
    @image = create(:post)
    @request.cookies['_ses'] = 'c1836832948'
  end

  test 'should update source' do
    @new_source = 'https://source.me'

    assert @image.source_url != @new_source
    put :update, params: { image_id: @image.id, image: {
      source_url: @new_source
    } }

    assert_response :success
    @image.reload
    assert @image.source_url == @new_source
  end
end