Sha256: 49dbd9157a46ad0231df8a4c8d71f2cc2de53cce675add94e621cdff3c3ca266

Contents?: true

Size: 910 Bytes

Versions: 11

Compression:

Stored size: 910 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
  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

11 entries across 11 versions & 2 rubygems

Version Path
gettext_i18n_rails-0.6.1 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.5.4 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
nulogy-gettext_i18n_rails-0.5.3.2 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
nulogy-gettext_i18n_rails-0.5.3.1 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.5.3 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
nulogy-gettext_i18n_rails-0.5.0.3 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.5.2 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
nulogy-gettext_i18n_rails-0.5.0.2 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.5.1 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
nulogy-gettext_i18n_rails-0.5.0.1 spec/gettext_i18n_rails/model_attributes_finder_spec.rb
gettext_i18n_rails-0.5.0 spec/gettext_i18n_rails/model_attributes_finder_spec.rb