Sha256: 79f5315786c67c24fc26d04315144b71207e7d18013b38980b64cc9bf6a6b3c1

Contents?: true

Size: 921 Bytes

Versions: 14

Compression:

Stored size: 921 Bytes

Contents

# coding: utf-8
require "spec_helper"
require "gettext_i18n_rails/model_attributes_finder"

if Rails::VERSION::MAJOR > 2
  module Test
    class Application < Rails::Application
    end
  end
end

describe GettextI18nRails::ModelAttributesFinder do
  let(:finder) { GettextI18nRails::ModelAttributesFinder.new }

  before do
    Rails.application rescue nil
  end

  describe :find do
    it "returns all AR models" do
      keys = finder.find({}).keys
      if Rails::VERSION::MAJOR > 2
        keys.should == [CarSeat, NotConventional, Part]
      else
        keys.should == [CarSeat, Part]
      end
    end

    it "returns all columns for each model" do
      attributes = finder.find({})
      attributes[CarSeat].should == ['id', 'seat_color']
      attributes[NotConventional].should == ['id', 'name'] if Rails::VERSION::MAJOR > 2
      attributes[Part].should == ['car_seat_id', 'id', 'name']
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gettext_i18n_rails-0.9.4 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.9.3 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.9.2 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.9.1 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.9.0 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.8.0 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.7.2 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.7.1 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.7.0 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.6.6 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.6.5 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.6.4 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.6.3 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.6.2 spec/gettext_i18n_rails/model_attributes_finder_spec.rb