Sha256: ed7778819ed318933fe91c9a0f1b56fdd3bde7f77b0a56394a67da70395d27ef

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 KB

Contents

require "spec_helper"

describe Uploadcare::Rails::ActionView::FormBuilder, type: :helper do
  before :each do
    @post = Post.new
    @form = ActionView::Helpers::FormBuilder.new(:post, @post, helper, {})
  end

  it "should include uploader tag for name" do
    # not that post has uc file
    tag = @form.uploadcare_field :file
    tag.should be_kind_of(String)
    expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
  end

  it "should override uploadcare- attribute" do
    tag = @form.uploadcare_field :file, :uploadcare => {:multiple => true}
    expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
  end

  it "should override data- attribute" do
    tag = @form.uploadcare_field :file, :data => {:multiple => true}
    expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
  end

  it "should override data- and uploadcare- attributes" do
    tag = @form.uploadcare_field :file, :data => {:multiple => true}, :uploadcare => {:multiple => true}
    expect(tag).to have_selector('input[type="hidden"][data-multiple="false"]', visible: :all)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
uploadcare-rails-1.2.1 spec/helpers/form_helpers_has_file_spec.rb
uploadcare-rails-1.2.0 spec/helpers/form_helpers_has_file_spec.rb
uploadcare-rails-1.2.0.pre.alpha3 spec/helpers/form_helpers_has_file_spec.rb
uploadcare-rails-1.2.0.pre.alpha spec/helpers/form_helpers_has_file_spec.rb
uploadcare-rails-1.1.1 spec/helpers/form_helpers_has_file_spec.rb