Sha256: 0bda6b9ec73521da3462d131c825e9a3a01c91afc99bab7697ad921d524dd83b

Contents?: true

Size: 838 Bytes

Versions: 5

Compression:

Stored size: 838 Bytes

Contents

require 'spec_helper'

describe ImageAssetsController do
  render_views

  before :each do
    RSpec::Matchers.define :have_image_tag do |image_path|
      match do |body|
        body =~ Regexp.new("<img.*src=\"#{image_path}\"")
      end
    end
  end

  after :each do
    expect(response).to be_success
  end

  it 'supports GIF images' do
    get :gif
    expect(response.body).to have_image_tag '/assets/image_assets/gif/pic.gif'
  end

  it 'supports JPG images' do
    get :jpg
    expect(response.body).to have_image_tag '/assets/image_assets/jpg/pic.jpg'
  end

  it 'supports JPEG images' do
    get :jpeg
    expect(response.body).to have_image_tag '/assets/image_assets/jpeg/pic.jpeg'
  end

  it 'supports PNG images' do
    get :png
    expect(response.body).to have_image_tag '/assets/image_assets/png/pic.png'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sections_rails-0.11.0 spec/controllers/image_assets_controller_spec.rb
sections_rails-0.10.0 spec/controllers/image_assets_controller_spec.rb
sections_rails-0.9.0 spec/controllers/image_assets_controller_spec.rb
sections_rails-0.8.1 spec/controllers/image_assets_controller_spec.rb
sections_rails-0.8.0 spec/controllers/image_assets_controller_spec.rb