Fixed formatting issues
This commit is contained in:
parent
5a956c67e2
commit
c2f9bfda27
@ -4,7 +4,7 @@ module Mongoid
|
|||||||
attr_accessor :field_name_prefix
|
attr_accessor :field_name_prefix
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
self.field_name_prefix = '_'
|
self.field_name_prefix = "_"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ describe Mongoid::Enum::Configuration do
|
|||||||
|
|
||||||
describe "field_name_prefix" do
|
describe "field_name_prefix" do
|
||||||
it "has '_' as default value" do
|
it "has '_' as default value" do
|
||||||
expect(subject.field_name_prefix).to eq '_'
|
expect(subject.field_name_prefix).to eq "_"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -25,7 +25,7 @@ describe Mongoid::Enum do
|
|||||||
it "uses prefix defined in configuration" do
|
it "uses prefix defined in configuration" do
|
||||||
old_field_name_prefix = Mongoid::Enum.configuration.field_name_prefix
|
old_field_name_prefix = Mongoid::Enum.configuration.field_name_prefix
|
||||||
Mongoid::Enum.configure do |config|
|
Mongoid::Enum.configure do |config|
|
||||||
config.field_name_prefix = '___'
|
config.field_name_prefix = "___"
|
||||||
end
|
end
|
||||||
UserWithoutPrefix = Class.new do
|
UserWithoutPrefix = Class.new do
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
@ -33,7 +33,7 @@ describe Mongoid::Enum do
|
|||||||
|
|
||||||
enum :status, [:awaiting_approval, :approved, :banned]
|
enum :status, [:awaiting_approval, :approved, :banned]
|
||||||
end
|
end
|
||||||
expect(UserWithoutPrefix).to have_field '___status'
|
expect(UserWithoutPrefix).to have_field "___status"
|
||||||
Mongoid::Enum.configure do |config|
|
Mongoid::Enum.configure do |config|
|
||||||
config.field_name_prefix = old_field_name_prefix
|
config.field_name_prefix = old_field_name_prefix
|
||||||
end
|
end
|
||||||
@ -195,7 +195,8 @@ describe Mongoid::Enum do
|
|||||||
|
|
||||||
describe ".configuration" do
|
describe ".configuration" do
|
||||||
it "returns Configuration object" do
|
it "returns Configuration object" do
|
||||||
expect(Mongoid::Enum.configuration).to be_instance_of Mongoid::Enum::Configuration
|
expect(Mongoid::Enum.configuration)
|
||||||
|
.to be_instance_of Mongoid::Enum::Configuration
|
||||||
end
|
end
|
||||||
it "returns same object when called multiple times" do
|
it "returns same object when called multiple times" do
|
||||||
expect(Mongoid::Enum.configuration).to be Mongoid::Enum.configuration
|
expect(Mongoid::Enum.configuration).to be Mongoid::Enum.configuration
|
||||||
@ -204,7 +205,8 @@ describe Mongoid::Enum do
|
|||||||
|
|
||||||
describe ".configure" do
|
describe ".configure" do
|
||||||
it "yields configuration if block is given" do
|
it "yields configuration if block is given" do
|
||||||
expect { |b| Mongoid::Enum.configure &b }.to yield_with_args Mongoid::Enum.configuration
|
expect { |b| Mongoid::Enum.configure &b }
|
||||||
|
.to yield_with_args Mongoid::Enum.configuration
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user