Sha256: 2c9c3edf02cfb3e14f54a774e8f05b7281afd04291b03b25b31f8061a8a74833

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

require "spec_helper"

describe Mongoid::Userstamp::GemConfig do
  subject { Mongoid::Userstamp::GemConfig.new }

  describe "#initialize" do
    context "without block" do
      it { should be_a Mongoid::Userstamp::GemConfig }
      it { subject.created_name.should eq :created_by }
      it { subject.updated_name.should eq :updated_by }
      it { subject.user_reader.should eq :current_user }
    end

    context "with block" do
      subject do
        Mongoid::Userstamp::GemConfig.new do |u|
          u.created_name = :c_by
          u.updated_name = :u_by
          u.user_reader = :foo
        end
      end

      it { should be_a Mongoid::Userstamp::GemConfig }
      it { subject.created_name.should eq :c_by }
      it { subject.updated_name.should eq :u_by }
      it { subject.user_reader.should eq :foo }
    end
  end

  describe "deprecated methods" do
    subject do
      Mongoid::Userstamp::GemConfig.new do |u|
        u.user_model = :bar
        u.created_column = :bing
        u.updated_column = :baz
      end
    end
    it { -> { subject }.should_not raise_error }
    it { should be_a Mongoid::Userstamp::GemConfig }
    it { subject.created_name.should eq :bing }
    it { subject.updated_name.should eq :baz }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid-userstamps-3.4.1 spec/unit/gem_config_spec.rb
mongoid-userstamps-3.4.0 spec/unit/gem_config_spec.rb
mongoid-userstamps-3.3.0 spec/unit/gem_config_spec.rb
mongoid-userstamps-3.2.1 spec/unit/gem_config_spec.rb