Sha256: 8b1398a88b5e661881c130976d9a9a33f15be5a6e3cb6f84a208acb6c7222f1a

Contents?: true

Size: 949 Bytes

Versions: 2

Compression:

Stored size: 949 Bytes

Contents

require 'spec_helper'

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

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

    before do
      render partial: 'tasuku/taskables/image/requests/request.html.erb', locals: {
        request: image_request,
        current_author: user
      }
    end

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

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

    before do
      render partial: 'tasuku/taskables/image/requests/request.html.erb', locals: {
        request: image_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

2 entries across 2 versions & 1 rubygems

Version Path
tasuku-0.1.1 spec/views/tasuku/taskables/image/requests/_request.html.erb_spec.rb
tasuku-0.1.0 spec/views/tasuku/taskables/image/requests/_request.html.erb_spec.rb