Navigation Menu

Skip to content

Commit

Permalink
Add Groonga::Client::Response::ColumnList::Column#sources alias
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 27, 2017
1 parent da9f890 commit 30fec31
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/groonga/client/response/column-list.rb
Expand Up @@ -95,6 +95,8 @@ def vector?
def index?
flags.include?("COLUMN_INDEX")
end

alias_method :sources, :source
end
end
end
Expand Down
30 changes: 30 additions & 0 deletions test/response/test-column-list.rb
Expand Up @@ -137,6 +137,36 @@ def test_index?
end
end
end

class TestSource < self
def create_response(sources)
columns = [
[
256,
"content",
"/tmp/test.db.0000100",
"var",
"COLUMN_INDEX|WITH_POSITION|PERSISTENT",
"Memos",
"ShortText",
sources,
]
]
super(columns)
end

def test_source
sources = ["Memos.title", "Memos.content"]
response = create_response(sources)
assert_equal(sources, response[0].source)
end

def test_sources
sources = ["Memos.title", "Memos.content"]
response = create_response(sources)
assert_equal(sources, response[0].sources)
end
end
end
end

0 comments on commit 30fec31

Please sign in to comment.