提交 e887fd9a 编写于 作者: R Ryuta Kamizono

Exercise test kwargs for scope name containing space

上级 ac65e560
......@@ -402,11 +402,11 @@ def pro; end
def test_spaces_in_scope_names
klass = Class.new(ActiveRecord::Base) do
self.table_name = "topics"
scope :"title containing space", -> { where("title LIKE '% %'") }
scope :"title containing space", ->(space: " ") { where("title LIKE '%#{space}%'") }
scope :approved, -> { where(approved: true) }
end
assert_equal klass.send(:"title containing space"), klass.where("title LIKE '% %'")
assert_equal klass.approved.send(:"title containing space"), klass.approved.where("title LIKE '% %'")
assert_equal klass.where("title LIKE '% %'"), klass.send(:"title containing space", space: " ")
assert_equal klass.approved.where("title LIKE '% %'"), klass.approved.send(:"title containing space", space: " ")
end
def test_find_all_should_behave_like_select
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册