Sha256: 368e92d6ebdafc131ee711adc74a2e7efa1f06359ebf84a5bcb5d11fafe35ffa

Contents?: true

Size: 922 Bytes

Versions: 1

Compression:

Stored size: 922 Bytes

Contents

require 'spec_helper'

describe 'tasks/taskables/url/requests/_request.html.erb' do
  let(:user) { create :user }

  context 'for url requests that have an image' do
    let(:url_request) { create :url_request, image: fixture("doge.jpg") }

    before do
      render partial: 'tasks/taskables/url/requests/request.html.erb', locals: {
        request: url_request,
        current_author: user
      }
    end

    it 'renders the image' do
      expect(rendered).to have_xpath "//img[contains(@src, \"#{url_request.image.url}\")]"
    end
  end

  context 'for url requests that have no image' do
    let(:url_request) { create :url_request }

    before do
      render partial: 'tasks/taskables/url/requests/request.html.erb', locals: {
        request: url_request,
        current_author: user
      }
    end

    it 'does not renders an image' do
      expect(rendered).not_to have_xpath "//img"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tasuku-0.0.1 spec/views/tasks/taskables/url/requests/_request.html.erb_spec.rb