Sha256: 4bad3f45f8b98ee7f0662aee87d5717ec69beef8fd99185ad9ed4314d9995c59

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8

require 'spec_helper'

module ConstructorPages
  describe 'Image type field' do
    before :all do
      ConstructorCore::User.delete_all
      @user = ConstructorCore::User.create email: 'ivanzotov@gmail.com', password: '123qweASD'
    end

    before :each do
      Page.delete_all
      Field.delete_all
      Template.delete_all

      Field::TYPES.each do |t|
        "constructor_pages/types/#{t}_type".classify.constantize.delete_all
      end

      @template = Template.create name: 'Brand', code_name: 'brand'

      login_as @user
    end

    it 'should upload image' do
      field = Field.create name: 'Logo', code_name: 'logo', type_value: 'image', template: @template
      _page = Page.create name: 'Zanussi'

      visit pages.edit_page_path(_page)
      page.should have_content('Logo')
      attach_file('Logo', Rails.root.to_s+'/app/assets/images/upload_image.png')
      click_button 'Update Page'
      _page.reload
      _page.logo.should_not be_nil
      visit pages.edit_page_path(_page)
      save_and_open_page
      page.should have_selector('img[alt="Upload image"]')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
constructor-pages-0.8.14 spec/features/constructor_pages/types/image_type_spec.rb
constructor-pages-0.8.13 spec/features/constructor_pages/types/image_type_spec.rb
constructor-pages-0.8.12 spec/features/constructor_pages/types/image_type_spec.rb
constructor-pages-0.8.11 spec/features/constructor_pages/types/image_type_spec.rb
constructor-pages-0.8.10 spec/features/constructor_pages/types/image_type_spec.rb
constructor-pages-0.8.8 spec/features/constructor_pages/types/image_type_spec.rb
constructor-pages-0.8.7 spec/features/constructor_pages/types/image_type_spec.rb
constructor-pages-0.8.6 spec/features/constructor_pages/types/image_type_spec.rb