Sha256: 0498e6184d61d2864a5115f0be2ad74f47474eff44380c19723c91d212d8e774

Contents?: true

Size: 969 Bytes

Versions: 7

Compression:

Stored size: 969 Bytes

Contents

require 'spec_helper'

describe Weeler::ActionView::Helpers::FormHelper, :type => :helper do

  let(:resource)  { FactoryGirl.create :dummy_post }
  let(:helper)    { ActionView::Helpers::FormBuilder.new(:post, resource, self, {})}

  let(:output)    {
    helper.image_upload_field :image
  }

  it 'create file field' do
    expect(output).to include 'type="file"'
    expect(output).to include 'name="post[image]"'
  end

  it 'creates a label' do
    expect(output).to include '<label'
  end

  it "creates img preview tag" do
    expect(output).to include '<img'
    expect(output).to include 'src="'+ Rails.root.join('sample/original.png').to_s+'"'
    expect(output).to include 'style="height: 80px;"'
  end
  
  context 'change size info and image url method' do
    
    it 'works on none java platforms' do
      expect(helper.image_upload_field(:image, image_url_method: "image.url('small')", size_info: "200x100")).to include("200x100")
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
weeler-1.6.0 spec/weeler/action_view/helpers/form_helper_spec.rb
weeler-1.5.4 spec/weeler/action_view/helpers/form_helper_spec.rb
weeler-1.5.2 spec/weeler/action_view/helpers/form_helper_spec.rb
weeler-1.5.1 spec/weeler/action_view/helpers/form_helper_spec.rb
weeler-1.4.0 spec/weeler/action_view/helpers/form_helper_spec.rb
weeler-1.2.0 spec/weeler/action_view/helpers/form_helper_spec.rb
weeler-1.1.0 spec/weeler/action_view/helpers/form_helper_spec.rb