Sha256: 589e80c543e9f651282f4360378372cc8bb667ab8e3052595f919a6412b1b505
Contents?: true
Size: 1.12 KB
Versions: 21
Compression:
Stored size: 1.12 KB
Contents
require 'rails_helper' RSpec.shared_examples_for "ActiveAdmin::Localizers::ResourceLocalizer" do it "should use proper translation" do string = ActiveAdmin::Localizers::ResourceLocalizer.t(action, model: model, model_name: model_name) expect(string).to eq translation end it "should accessible via ActiveAdmin::Localizers" do resource = double(resource_label: model, resource_name: double(i18n_key: model_name)) localizer = ActiveAdmin::Localizers.resource(resource) expect(localizer.t(action)).to eq translation end end RSpec.describe ActiveAdmin::Localizers::ResourceLocalizer do let(:action) { 'new_model' } let(:model) { 'Comment' } let(:model_name) { 'comment' } it_behaves_like "ActiveAdmin::Localizers::ResourceLocalizer" do let(:translation) { 'New Comment' } end describe "model action specified" do around do |example| with_translation active_admin: {resources: {comment: {new_model: 'Write comment'}}} do example.call end end it_behaves_like "ActiveAdmin::Localizers::ResourceLocalizer" do let(:translation) { 'Write comment' } end end end
Version data entries
21 entries across 21 versions & 4 rubygems