Skip to content

Commit

Permalink
Bootstrap spec suite
Browse files Browse the repository at this point in the history
Just getting it running for now
  • Loading branch information
Mat Brown committed Jul 30, 2011
1 parent f9d8679 commit 4d28560
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 1 deletion.
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--color
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ PATH
elastictastic (0.1.0)
activesupport (~> 3.0)
hashie
i18n

GEM
specs:
activesupport (3.0.9)
diff-lcs (1.1.2)
hashie (1.0.0)
i18n (0.5.0)
rspec (2.5.0)
rspec-core (~> 2.5.0)
rspec-expectations (~> 2.5.0)
Expand Down
4 changes: 4 additions & 0 deletions elastictastic.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ ElasticSearch's search functionality to query for those models.
DESC

s.files = Dir['lib/**/*.rb', 'spec/**/*.rb', 'README.md', 'CHANGELOG.md', 'LICENSE']
s.test_files = Dir['spec/examples/**/*.rb']
s.has_rdoc = true
s.extra_rdoc_files = 'README.md'
s.required_ruby_version = '>= 1.9'
s.add_runtime_dependency 'activesupport', '~> 3.0'
s.add_runtime_dependency 'i18n'
s.add_runtime_dependency 'hashie'
s.add_development_dependency 'rspec', '~> 2.0'
s.requirements << 'ElasticSearch'
end
12 changes: 11 additions & 1 deletion lib/elastictastic.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
require 'active_support/core_ext'

module Elastictastic
Elastictastic::CancelBulkOperation = Class.new(StandardError)
CancelBulkOperation = Class.new(StandardError)

autoload :Document, 'elastictastic/document'
autoload :Persistence, 'elastictastic/persistence'
autoload :Resource, 'elastictastic/resource'
autoload :Scope, 'elastictastic/scope'
autoload :Scoped, 'elastictastic/scoped'
autoload :Search, 'elastictastic/search'
autoload :Util, 'elastictastic/util'

class <<self
def build_transport(&block)
Expand Down
12 changes: 12 additions & 0 deletions spec/examples/resource_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require File.expand_path('../spec_helper', __FILE__)

describe Elastictastic::Resource do
describe '::mapping' do
let(:mapping) { Post.mapping }
let(:properties) { mapping['post']['properties'] }

it 'should set basic field' do
properties.should have_key('title')
end
end
end
8 changes: 8 additions & 0 deletions spec/examples/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'bundler'
Bundler.require(:default, :test)
require 'active_support'
require 'rspec/mocks'

Dir[File.expand_path('../../mocks/**/*.rb', __FILE__)].each do |mock|
require mock
end
5 changes: 5 additions & 0 deletions spec/mocks/post.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Post
include Elastictastic::Document

field :title
end

0 comments on commit 4d28560

Please sign in to comment.