Sha256: 8270dc4f9c0329795757ed7a399d90d9590a0552bebc3acb04a64cab8db0b0d6

Contents?: true

Size: 1.65 KB

Versions: 4

Compression:

Stored size: 1.65 KB

Contents

# Author:: Mike Evans <mike@urlgonomics.com>
# Copyright:: 2013 Urlgonomics LLC.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require File.join(File.dirname(__FILE__), 'setup')

class TestDesignDocs < Minitest::Test

  def test_save_design_doc
    skip unless $mock.real?
    assert cb.save_design_doc(design_doc)
  end

  def test_save_design_doc_with_bad_data
    skip unless $mock.real?
    assert_raises ArgumentError do
      cb.save_design_doc(123)
    end
  end

  def test_delete_design_doc
    skip unless $mock.real?
    cb.save_design_doc(design_doc)
    assert cb.delete_design_doc('blog')
  end

  def test_design_doc_access
    skip unless $mock.real?
    cb.save_design_doc(design_doc)
    assert cb.design_docs['blog']
  end

  def test_design_doc_missing_access
    skip unless $mock.real?
    refute cb.design_docs['missing']
  end

  def design_doc
    {
      '_id'      => '_design/blog',
      'language' => 'javascript',
      'views' => {
        'recent_posts' => {
          'map' => <<-JS
            function (doc, meta) {
              emit(doc.name);
            }
          JS
        }
      }
    }
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
couchbase-jruby-client-0.2.2-java test/test_design_docs.rb
couchbase-jruby-client-0.2.1-java test/test_design_docs.rb
couchbase-jruby-client-0.2.0-java test/test_design_docs.rb
couchbase-jruby-client-0.1.9-java test/test_design_docs.rb