elasticsearch-embedded 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ describe Elasticsearch::Embedded::RSpec do
2
+
3
+ describe 'RSpec configuration' do
4
+
5
+ let(:stub_config) { double(:rspec_configuration).as_null_object }
6
+ let(:filters) { [:elasticsearch, :search] }
7
+ let(:cluster) { double(:cluster).as_null_object }
8
+
9
+ before :each do
10
+ allow(::RSpec).to receive(:configure).and_yield(stub_config)
11
+ end
12
+
13
+ describe '.configure_with' do
14
+
15
+ before :each do
16
+ allow(Elasticsearch::Embedded::RSpec::ElasticSearchHelpers).to receive(:memoized_cluster).and_return(cluster)
17
+ end
18
+
19
+ it 'should include helpers module into RSpec configuration' do
20
+ expect(stub_config).to receive(:include).with(Elasticsearch::Embedded::RSpec::ElasticSearchHelpers, *filters)
21
+ subject.configure_with(*filters)
22
+ end
23
+
24
+ it 'should configure before hooks' do
25
+ expect(stub_config).to receive(:before).with(:each, *filters).and_yield
26
+ subject.configure_with(*filters)
27
+ expect(cluster).to have_received(:ensure_started!)
28
+ expect(cluster).to have_received(:delete_all_indices!)
29
+ end
30
+
31
+ it 'should configure after suite hook' do
32
+ expect(stub_config).to receive(:after).with(:suite).and_yield
33
+ subject.configure_with(*filters)
34
+ expect(cluster).to have_received(:stop)
35
+ end
36
+
37
+ end
38
+
39
+ # This version is intended to be used with default configuration, i.e. without filters
40
+ describe '.configure' do
41
+
42
+ it 'should use :elastisearch filter only' do
43
+ subject.configure
44
+ expect(stub_config).to have_received(:include).with(Elasticsearch::Embedded::RSpec::ElasticSearchHelpers, :elasticsearch)
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -0,0 +1,39 @@
1
+ describe Elasticsearch::Embedded do
2
+
3
+ describe '.verbosity' do
4
+
5
+ after { Logging.logger[subject].level = :info }
6
+
7
+ it 'should allow numbers' do
8
+ expect {
9
+ subject.verbosity(2)
10
+ }.to change { Logging.logger[subject].level }.from(Logging::LEVELS['info']).to(Logging::LEVELS['warn'])
11
+ end
12
+
13
+ it 'should allow level strings' do
14
+ expect {
15
+ subject.verbosity('warn')
16
+ }.to change { Logging.logger[subject].level }.from(Logging::LEVELS['info']).to(Logging::LEVELS['warn'])
17
+ end
18
+
19
+ it 'should keep level to info on invalid levels' do
20
+ expect {
21
+ subject.verbosity('foo')
22
+ }.to_not change { Logging.logger[subject].level }
23
+ end
24
+
25
+ end
26
+
27
+ describe '.mute!' do
28
+
29
+ after { Logging.logger[subject].appenders = Logging.appenders.stdout }
30
+
31
+ it 'should remove all appenders' do
32
+ expect {
33
+ subject.mute!
34
+ }.to change { Logging.logger[subject].appenders }.to([])
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,66 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+ # Main gem file
4
+ require 'elasticsearch-embedded'
5
+ # Used to stub calls to filesystem
6
+ require 'fakefs/spec_helpers'
7
+
8
+ # Used in integration tests
9
+ require 'elasticsearch'
10
+ # Activate gem behavior with :elasticsearch tagged specs
11
+ Elasticsearch::Embedded::RSpec.configure
12
+
13
+ RSpec.configure do |config|
14
+ config.filter_run :focus
15
+ config.run_all_when_everything_filtered = true
16
+
17
+ # Many RSpec users commonly either run the entire suite or an individual
18
+ # file, and it's useful to allow more verbose output when running an
19
+ # individual spec file.
20
+ if config.files_to_run.one?
21
+ # Use the documentation formatter for detailed output,
22
+ # unless a formatter has already been configured
23
+ # (e.g. via a command-line flag).
24
+ config.default_formatter = 'doc'
25
+ end
26
+
27
+ # Print the 10 slowest examples and example groups at the
28
+ # end of the spec run, to help surface which specs are running
29
+ # particularly slow.
30
+ config.profile_examples = 10
31
+
32
+ # Run specs in random order to surface order dependencies. If you find an
33
+ # order dependency and want to debug it, you can fix the order by providing
34
+ # the seed, which is printed after each run.
35
+ # --seed 1234
36
+ config.order = :random
37
+
38
+ # Seed global randomization in this process using the `--seed` CLI option.
39
+ # Setting this allows you to use `--seed` to deterministically reproduce
40
+ # test failures related to randomization by passing the same `--seed` value
41
+ # as the one that triggered the failure.
42
+ Kernel.srand config.seed
43
+
44
+ # rspec-expectations config goes here. You can use an alternate
45
+ # assertion/expectation library such as wrong or the stdlib/minitest
46
+ # assertions if you prefer.
47
+ config.expect_with :rspec do |expectations|
48
+ # Enable only the newer, non-monkey-patching expect syntax.
49
+ # For more details, see:
50
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
51
+ expectations.syntax = :expect
52
+ end
53
+
54
+ # rspec-mocks config goes here. You can use an alternate test double
55
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
56
+ config.mock_with :rspec do |mocks|
57
+ # Enable only the newer, non-monkey-patching expect syntax.
58
+ # For more details, see:
59
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
60
+ mocks.syntax = :expect
61
+
62
+ # Prevents you from mocking or stubbing a method that does not exist on
63
+ # a real object. This is generally recommended.
64
+ mocks.verify_partial_doubles = true
65
+ end
66
+ end
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: elasticsearch-embedded
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Fabio Napoleoni
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruby-progressbar
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 1.5.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.5.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubyzip
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: logging
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 1.8.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.8.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 3.0.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 3.0.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: fakefs
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 0.5.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 0.5.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: elasticsearch
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 1.0.2
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: 1.0.2
125
+ description:
126
+ email:
127
+ - f.napoleoni@gmail.com
128
+ executables:
129
+ - embedded-elasticsearch
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - .gitignore
134
+ - .rspec
135
+ - .travis.yml
136
+ - Changelog.md
137
+ - Gemfile
138
+ - LICENSE.txt
139
+ - README.md
140
+ - Rakefile
141
+ - bin/embedded-elasticsearch
142
+ - elasticsearch-embedded.gemspec
143
+ - lib/elasticsearch-embedded.rb
144
+ - lib/elasticsearch/embedded.rb
145
+ - lib/elasticsearch/embedded/cluster.rb
146
+ - lib/elasticsearch/embedded/downloader.rb
147
+ - lib/elasticsearch/embedded/logger_configuration.rb
148
+ - lib/elasticsearch/embedded/rspec_configuration.rb
149
+ - lib/elasticsearch/embedded/version.rb
150
+ - spec/lib/elasticsearch/embedded/cluster_spec.rb
151
+ - spec/lib/elasticsearch/embedded/downloader_spec.rb
152
+ - spec/lib/elasticsearch/embedded/rspec_configuration_spec.rb
153
+ - spec/lib/elasticsearch/embedded_spec.rb
154
+ - spec/spec_helper.rb
155
+ homepage: https://github.com/fabn/elasticsearch-embedded
156
+ licenses:
157
+ - MIT
158
+ metadata: {}
159
+ post_install_message:
160
+ rdoc_options: []
161
+ require_paths:
162
+ - lib
163
+ required_ruby_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - '>='
166
+ - !ruby/object:Gem::Version
167
+ version: 1.9.2
168
+ required_rubygems_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - '>='
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ requirements: []
174
+ rubyforge_project:
175
+ rubygems_version: 2.2.2
176
+ signing_key:
177
+ specification_version: 4
178
+ summary: Install an embedded version of elasticsearch into your project
179
+ test_files:
180
+ - spec/lib/elasticsearch/embedded/cluster_spec.rb
181
+ - spec/lib/elasticsearch/embedded/downloader_spec.rb
182
+ - spec/lib/elasticsearch/embedded/rspec_configuration_spec.rb
183
+ - spec/lib/elasticsearch/embedded_spec.rb
184
+ - spec/spec_helper.rb