Sha256: 3468be553148a741cf6b7316178c389b975e00eeeaa8853b6af6543f53b190f5

Contents?: true

Size: 1.51 KB

Versions: 5

Compression:

Stored size: 1.51 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
    assert cb.save_design_doc(design_doc)
  end

  def test_save_design_doc_with_bad_data
    assert_raises ArgumentError do
      cb.save_design_doc(123)
    end
  end

  def test_delete_design_doc
    cb.save_design_doc(design_doc)
    assert cb.delete_design_doc('blog')
  end

  def test_design_doc_access
    cb.save_design_doc(design_doc)
    assert cb.design_docs['blog']
  end

  def test_design_doc_missing_access
    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

5 entries across 5 versions & 1 rubygems

Version Path
couchbase-jruby-client-0.1.7-java test/test_design_docs.rb
couchbase-jruby-client-0.1.6-java test/test_design_docs.rb
couchbase-jruby-client-0.1.5-java test/test_design_docs.rb
couchbase-jruby-client-0.1.4 test/test_design_docs.rb
couchbase-jruby-client-0.1.3 test/test_design_docs.rb