1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
thoughtbot--factory_bot/spec/acceptance/static_attribute_deprecation_spec.rb
Oliver Peate 91d3fd9ca4 Deprecate static attributes (#1135)
For further background on the motivation behind this change, see this commit: eaf2b40
2018-08-01 17:45:38 -04:00

37 lines
931 B
Ruby

describe "static attribute deprecation warnings" do
context "using #add_attribute" do
it "prints where attribute is declared" do
define_model("User", name: :string)
declare_factory = Proc.new do
FactoryBot.define do
factory :user do
add_attribute(:name, "alice")
end
end
end
expect(declare_factory).to output(
/called from .*static_attribute_deprecation_spec\.rb:9/m
).to_stderr
end
end
context "an implicit attribute via method missing" do
it "prints where attribute is declared" do
define_model("User", name: :string)
declare_factory = Proc.new do
FactoryBot.define do
factory :user do
name "Alice"
end
end
end
expect(declare_factory).to output(
/called from .*static_attribute_deprecation_spec\.rb:27/m
).to_stderr
end
end
end