Sha256: 7928c8bed66da872252f0f7b34d453bc1782855da6137801f4fec938cc4953c2

Contents?: true

Size: 924 Bytes

Versions: 2

Compression:

Stored size: 924 Bytes

Contents

require 'spec_helper'

describe 'tasuku/taskables/questions/_question.html.erb' do
  let(:user)     { create :user }

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

    before do
      render partial: 'tasuku/taskables/questions/question.html.erb', locals: {
        question: question,
        current_author: user
      }
    end

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

  context 'for questions that have no image' do
    let(:question) { create :question_with_options }

    before do
      render partial: 'tasuku/taskables/questions/question.html.erb', locals: {
        question: question,
        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/questions/_question.html.erb_spec.rb
tasuku-0.1.0 spec/views/tasuku/taskables/questions/_question.html.erb_spec.rb