community_spec.rb
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require 'rails_helper'
require 'rake'
require 'elasticsearch/extensions/test/cluster/tasks'
RSpec.configure do |config|
config.before :each, elasticsearch: true do
puts '='*10, 'before', '='*10
Elasticsearch::Extensions::Test::Cluster.start() unless Elasticsearch::Extensions::Test::Cluster.running?
end
config.after :suite do
puts '='*10, 'after', '='*10
Elasticsearch::Extensions::Test::Cluster.stop() if Elasticsearch::Extensions::Test::Cluster.running?
end
end
RSpec.describe Community, type: :model, elasticsearch: true do
before do
Environment.create!(:name => 'Noosfero', :contact_email => 'noosfero@localhost.localdomain', :is_default => true)
@environment = Environment.default
@environment.enabled_plugins = ['ElasticsearchPlugin']
@environment.save!
@community = Community.new(name: "Debian")
@community.save!
sleep 2
end
it "assert true" do
communities = Community.__elasticsearch__.search({}).records.to_a
p communities
expect(true).to be true
end
end