Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ Style/TrailingCommaInArguments:

Layout/FirstHashElementIndentation:
EnforcedStyle: consistent

Style/OneClassPerFile:
Enabled: false
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,16 @@ task :render_git_revision do
`git fetch --tags >/dev/null 2>&1`
`git describe --long --always HEAD`.strip
end
core_timestamp = Dir.chdir(File.join(__dir__, 'ext', 'couchbase')) do # rubocop:disable ThreadSafety/DirChdir
`git log --max-count=1 --no-patch --format=%cd --date=format:%Y-%m-%dT%H:%M:%S HEAD`.strip
end

File.open(File.join(__dir__, "ext", "cache", "extconf_include.rb"), "a+") do |io|
io.puts(<<~REVISIONS)
cmake_flags << "-DEXT_GIT_REVISION=#{library_revision}"
cmake_flags << "-DCOUCHBASE_CXX_CLIENT_GIT_REVISION=#{core_revision}"
cmake_flags << "-DCOUCHBASE_CXX_CLIENT_GIT_DESCRIBE=#{core_describe}"
cmake_flags << "-DCOUCHBASE_CXX_CLIENT_BUILD_TIMESTAMP=#{core_timestamp}"
REVISIONS
end
end
Expand Down
2 changes: 1 addition & 1 deletion ext/couchbase
16 changes: 8 additions & 8 deletions test/crud_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,8 @@ def test_projection_preserve_array_indexes

def test_insert_get_projection_18_fields
doc_id = uniq_id(:project_too_many_fields)
doc = (1..18).each_with_object({}) do |n, obj|
obj["field#{n}"] = n
doc = (1..18).to_h do |n|
["field#{n}", n]
end

res = @collection.insert(doc_id, doc)
Expand All @@ -640,17 +640,17 @@ def test_insert_get_projection_18_fields
options = Options::Get.new
options.project((1..17).map { |n| "field#{n}" })
res = @collection.get(doc_id, options)
expected = (1..17).each_with_object({}) do |n, obj|
obj["field#{n}"] = n
expected = (1..17).to_h do |n|
["field#{n}", n]
end

assert_equal(expected, res.content, "expected result do not include field18")
end

def test_upsert_get_projection_16_fields_and_expiry
doc_id = uniq_id(:project_too_many_fields)
doc = (1..18).each_with_object({}) do |n, obj|
obj["field#{n}"] = n
doc = (1..18).to_h do |n|
["field#{n}", n]
end

options = Options::Upsert.new
Expand All @@ -663,8 +663,8 @@ def test_upsert_get_projection_16_fields_and_expiry
options.project((1..16).map { |n| "field#{n}" })
options.with_expiry = true
res = @collection.get(doc_id, options)
expected = (1..16).each_with_object({}) do |n, obj|
obj["field#{n}"] = n
expected = (1..16).to_h do |n|
["field#{n}", n]
end

assert_equal(expected, res.content, "expected result do not include field17, field18")
Expand Down
Loading