Sha256: 660ab2b122cd2df6b6f4859ac54e50b2335ca27795672c2ca0d13f3fe13435a3
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
require 'spec_helper' require 'pry' RSpec.describe RailsAdmin::Config::Fields::Types::GlobalizeTabs do it 'renders all available locales as tabs' do visit '/page/new' expect(find('.globalize_tabs_type').find('.nav-tabs')).to have_content 'en cz ru' end context 'when translated page exists' do let!(:translated_page) { Page.create!( slug: '2001', image: 'poster.png', title: '2001: Space odyssey', content: '<p>Visionary</p>' ) } def perform visit "/page/#{translated_page.id}/edit" end describe 'localized data in correct tab' do it 'renders the default locale' do perform within(".localized-pane-en-page-#{translated_page.id}") do expect(find_field('Title').value).to eq('2001: Space odyssey') expect(find_field('Content')).to have_content('<p>Visionary</p>') end end it 'renders cz locale' do Globalize.with_locale(:cz) do translated_page.title = '2001: Vesmírná odysea' translated_page.content = '<p>Vizionář</p>' translated_page.save! end perform within(".localized-pane-cz-page-#{translated_page.id}") do expect(find_field('Title').value).to eq('2001: Vesmírná odysea') expect(find_field('Content')).to have_content('<p>Vizionář</p>') end end end end it 'works correctly with namespaced models' do note = Admin::Note.create(title: 'Fix bug with namespaces', image: 'urgent.png') visit "/admin~note/#{note.id}/edit" expect(page).to have_css(".localized-pane-en-admin-note-#{note.id}") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_admin_globalize_field-0.3.3 | spec/field_spec.rb |