Commit 11abaf99 by Alex Dusenbery

EDUCATOR-313: Bump ruby to 2.4.1; Use latest newrelic_rpm package; Add…

EDUCATOR-313: Bump ruby to 2.4.1; Use latest newrelic_rpm package;  Add test-forum docker-compose service.
parent f02a05e8
......@@ -31,3 +31,5 @@ log/
.redcar/
/nbproject
.idea/
.ruby-version
\ No newline at end of file
......@@ -5,10 +5,10 @@ services:
language: ruby
rvm:
- "1.9.3"
- "2.4.1"
install:
- docker-compose -f ./.travis/docker-compose-travis.yml up -d
- docker-compose -f ./.travis/docker-compose-travis.yml build test-forum
script:
- docker exec forum_testing /edx/app/forum/cs_comments_service/.travis/run_tests.sh
- docker-compose -f ./.travis/docker-compose-travis.yml run --rm test-forum
......@@ -8,13 +8,21 @@ services:
mongo:
image: mongo:3.0.14
container_name: "mongo.edx"
forum:
image: edxops/forum:latest
forum-base:
image: edxops/forum:ruby2.4.1 # TODO: switch back to latest after configuration release
container_name: forum_testing
volumes:
- ..:/edx/app/forum/cs_comments_service
forum:
extends: forum-base
command: tail -f /dev/null
depends_on:
- "elasticsearch"
- "mongo"
test-forum:
extends: forum-base
command: /edx/app/forum/cs_comments_service/.travis/run_tests.sh
depends_on:
- "elasticsearch"
- "mongo"
\ No newline at end of file
source 'https://rubygems.org'
ruby "1.9.3"
ruby "2.4.1"
gem 'pry'
gem 'pry-nav'
......@@ -16,9 +16,8 @@ gem 'sinatra-param', '~> 1.4'
gem 'yajl-ruby'
gem 'mongoid', '~> 5.0.0'
gem 'bson', '~>3.1'
gem 'bson', '~> 3.1'
gem 'bson_ext'
gem 'protected_attributes'
......@@ -49,12 +48,13 @@ group :test do
gem 'guard'
gem 'guard-unicorn'
gem 'rack-test', :require => 'rack/test'
gem 'rspec', '~> 2.11.0'
gem 'webmock', '~> 1.22'
gem 'rspec', '~> 3.6.0'
gem 'rspec-its'
gem 'rspec-collection_matchers'
gem 'webmock', '~> 3.0.1'
end
# FIXME Remove version restriction once ruby upgraded to 2.x
gem 'newrelic_rpm', '~> 3.16.0'
gem 'newrelic_rpm'
gem 'unicorn'
gem "rack-timeout"
gem "i18n"
......
......@@ -23,36 +23,36 @@ GIT
GEM
remote: https://rubygems.org/
specs:
activemodel (4.2.4)
activesupport (= 4.2.4)
activemodel (4.2.8)
activesupport (= 4.2.8)
builder (~> 3.1)
activesupport (4.2.4)
activesupport (4.2.8)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
bson (3.2.4)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
bson (3.2.6)
bson_ext (1.5.1)
builder (3.2.2)
codecov (0.1.2)
builder (3.2.3)
codecov (0.1.10)
json
simplecov
url
coderay (1.0.7)
coderay (1.1.1)
crack (0.4.3)
safe_yaml (~> 1.0.0)
dalli (2.1.0)
delayed_job (4.1.1)
activesupport (>= 3.0, < 5.0)
delayed_job_mongoid (2.2.0)
dalli (2.7.6)
delayed_job (4.1.3)
activesupport (>= 3.0, < 5.2)
delayed_job_mongoid (2.3.0)
delayed_job (>= 3.0, < 5)
mongoid (>= 3.0, < 6)
mongoid-compatibility
diff-lcs (1.1.3)
mongoid (>= 3.0, < 7)
mongoid-compatibility (>= 0.4.0)
diff-lcs (1.3)
docile (1.1.5)
domain_name (0.5.24)
domain_name (0.5.20170404)
unf (>= 0.0.5, < 1.0.0)
elasticsearch (1.1.2)
elasticsearch-api (= 1.1.2)
......@@ -66,39 +66,53 @@ GEM
elasticsearch-transport (1.1.2)
faraday
multi_json
enumerize (0.11.0)
enumerize (2.1.2)
activesupport (>= 3.2)
factory_girl (4.5.0)
factory_girl (4.8.0)
activesupport (>= 3.0.0)
faker (1.6.1)
faker (1.7.3)
i18n (~> 0.5)
faraday (0.11.0)
faraday (0.12.1)
multipart-post (>= 1.2, < 3)
guard (1.3.2)
listen (>= 0.4.2)
thor (>= 0.14.6)
guard-unicorn (0.0.7)
ffi (1.9.18)
formatador (0.2.5)
guard (2.14.1)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-unicorn (0.2.0)
guard (>= 1.1)
hashdiff (0.2.3)
hashie (3.4.6)
http-cookie (1.0.2)
hashdiff (0.3.4)
hashie (3.5.5)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (0.7.0)
json (1.8.3)
kgio (2.10.0)
listen (0.5.0)
method_source (0.8)
mime-types (2.6.1)
i18n (0.8.4)
json (2.1.0)
kgio (2.11.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
lumberjack (1.0.12)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.8.1)
mongo (2.1.1)
minitest (5.10.2)
mongo (2.1.2)
bson (~> 3.0)
mongoid (5.0.0)
activemodel (~> 4.0)
mongo (~> 2.1)
origin (~> 2.1)
tzinfo (>= 0.3.37)
mongoid-compatibility (0.3.1)
mongoid-compatibility (0.4.1)
activesupport
mongoid (>= 2.0)
mongoid_cleaner (1.2.0)
......@@ -108,77 +122,94 @@ GEM
rake
multi_json (1.12.1)
multipart-post (2.0.0)
netrc (0.10.3)
newrelic_rpm (3.16.0.318)
nokogiri (1.6.8)
nenv (0.3.0)
netrc (0.11.0)
newrelic_rpm (3.16.3.323)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
origin (2.1.1)
pkg-config (1.1.7)
protected_attributes (1.1.3)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
origin (2.3.1)
protected_attributes (1.1.4)
activemodel (>= 4.0.1, < 5.0)
pry (0.9.10)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.3.1)
pry-nav (0.2.2)
pry (~> 0.9.10)
rack (1.6.4)
rack-protection (1.2.0)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-nav (0.2.4)
pry (>= 0.9.10, < 0.11.0)
public_suffix (2.0.5)
rack (1.6.8)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
rack-timeout (0.3.2)
raindrops (0.15.0)
rake (10.4.2)
rdiscount (1.6.8)
rest-client (1.8.0)
rack-timeout (0.4.2)
raindrops (0.18.0)
rake (12.0.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rdiscount (2.2.0.1)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.2)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.2)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.6.0)
rspec-collection_matchers (1.1.3)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.6.0)
rspec-support (~> 3.6.0)
rspec-expectations (3.6.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-its (1.2.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.6.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
ruby_dep (1.5.0)
safe_yaml (1.0.4)
simplecov (0.11.1)
shellany (0.0.1)
simplecov (0.14.1)
docile (~> 1.1.0)
json (~> 1.8)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
sinatra (1.3.3)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
simplecov-html (0.10.1)
sinatra (1.4.8)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
sinatra-param (1.4.0)
sinatra (~> 1.3)
slop (3.3.2)
thor (0.16.0)
thread_safe (0.3.5)
tilt (1.3.3)
tzinfo (1.2.2)
slop (3.6.0)
thor (0.19.4)
thread_safe (0.3.6)
tilt (2.0.7)
tzinfo (1.2.3)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
unicorn (4.9.0)
unf_ext (0.0.7.4)
unicorn (5.3.0)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
url (0.3.2)
webmock (1.22.3)
webmock (3.0.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
will_paginate (3.0.7)
will_paginate (3.1.6)
will_paginate_mongoid (2.0.1)
mongoid
will_paginate (~> 3.0)
yajl-ruby (1.2.1)
yajl-ruby (1.3.0)
PLATFORMS
ruby
......@@ -203,7 +234,7 @@ DEPENDENCIES
mongoid-tree!
mongoid_cleaner (~> 1.2.0)
mongoid_magic_counter_cache
newrelic_rpm (~> 3.16.0)
newrelic_rpm
nokogiri (~> 1.6.8)
protected_attributes
pry
......@@ -215,13 +246,15 @@ DEPENDENCIES
rdiscount
rest-client
rs_voteable_mongo!
rspec (~> 2.11.0)
rspec (~> 3.6.0)
rspec-collection_matchers
rspec-its
sinatra
sinatra-param (~> 1.4)
unicorn
webmock (~> 1.22)
webmock (~> 3.0.1)
will_paginate_mongoid (~> 2.0)
yajl-ruby
BUNDLED WITH
1.12.5
1.15.2
......@@ -104,6 +104,17 @@ If you'd like to view additional options for the command, append the `--help` op
__ http://rspec.info/
Running Tests with Docker
---------------------
You can also use docker-compose to run your tests as follows (assuming you have
docker-compose installed):
.. code-block::
$ docker-compose -f .travis/docker-compose-travis.yml run --rm test-forum
Internationalization (i18n) and Localization (l10n)
---------------------------------------------------
......
require 'task_helpers'
require_relative '../task_helpers'
namespace :search do
desc 'Indexes content updated in the last N minutes.'
......
......@@ -12,7 +12,7 @@ describe 'Comment API' do
comment = thread.comments.first
get "/api/v1/comments/#{comment.id}"
last_response.should be_ok
last_response.content_type.should == 'application/json;charset=utf-8'
last_response.content_type.should == 'application/json'
end
it 'retrieves information of a single comment' do
......
......@@ -439,7 +439,7 @@ describe 'app' do
it { should be_ok }
it 'returns JSON' do
expect(subject.content_type).to eq 'application/json;charset=utf-8'
expect(subject.content_type).to eq 'application/json'
end
it 'get information of a single comment thread' do
......@@ -697,7 +697,7 @@ describe 'app' do
changed_thread.comment_count.should == orig_count + 1
comment = changed_thread.comments.select { |c| c["body"] == "new comment" }.first
comment.should_not be_nil
comment.anonymous.should be_true
comment.anonymous.should be true
end
it "returns 400 when the thread does not exist" do
post "/api/v1/threads/does_not_exist/comments", default_params
......
......@@ -166,7 +166,7 @@ describe 'app' do
thread = CommentThread.find(body['id'])
expect(thread).to_not be_nil
expect(thread['anonymous']).to be_true
expect(thread['anonymous']).to be true
end
it 'returns error when title, body or course id does not exist' do
......
......@@ -82,7 +82,7 @@ describe "app" do
it "does not contain cohort group_id if not defined" do
thread_notification = get_thread_notification("dummy comment content")
thread_notification.has_key?("group_id").should be_false
thread_notification.has_key?("group_id").should be false
end
it "returns only threads subscribed to by user" do
......
......@@ -5,7 +5,7 @@ describe "search:rebuild_index" do
include_context "rake"
before do
TaskHelpers::ElasticsearchHelper.stub!(:rebuild_index)
TaskHelpers::ElasticsearchHelper.stub(:rebuild_index)
end
its(:prerequisites) { should include("environment") }
......@@ -34,7 +34,7 @@ describe "search:catchup" do
include_context "rake"
before do
TaskHelpers::ElasticsearchHelper.stub!(:catchup_index)
TaskHelpers::ElasticsearchHelper.stub(:catchup_index)
end
its(:prerequisites) { should include("environment") }
......
......@@ -50,14 +50,14 @@ describe Comment do
context 'with standalone_thread' do
it 'returns false' do
comment = make_comment(author, standalone_thread, "comment")
expect(comment.course_context?).to be_false
expect(comment.course_context?).to be false
end
end
context 'with course_thread' do
it 'returns true' do
comment = make_comment(author, course_thread, "comment")
expect(comment.course_context?).to be_true
expect(comment.course_context?).to be true
end
end
......@@ -65,7 +65,7 @@ describe Comment do
it 'returns false' do
comment = make_comment(author, course_thread, "comment")
comment.comment_thread_id = 'not a thread'
expect(comment.course_context?).to be_false
expect(comment.course_context?).to be false
end
end
end
......@@ -74,14 +74,14 @@ describe Comment do
context 'with standalone_thread' do
it 'returns true' do
comment = make_comment(author, standalone_thread, "comment")
expect(comment.standalone_context?).to be_true
expect(comment.standalone_context?).to be true
end
end
context 'with course_thread' do
it 'returns false' do
comment = make_comment(author, course_thread, "comment")
expect(comment.standalone_context?).to be_false
expect(comment.standalone_context?).to be false
end
end
......@@ -89,7 +89,7 @@ describe Comment do
it 'returns false' do
comment = make_comment(author, course_thread, "comment")
comment.comment_thread_id = 'not a thread'
expect(comment.standalone_context?).to be_false
expect(comment.standalone_context?).to be false
end
end
......
......@@ -85,11 +85,11 @@ describe ThreadPresenter do
# with response=false and recursive=false
hash = ThreadPresenter.new(thread, @reader, false, num_comments, is_endorsed).to_hash(false, 0, nil, false)
check_thread_result(@reader, thread, hash)
['children', 'resp_skip', 'resp_limit', 'resp_total'].each {|k| (hash.has_key? k).should be_false }
['children', 'resp_skip', 'resp_limit', 'resp_total'].each {|k| (hash.has_key? k).should be false }
# with response=false and recursive=true
hash = ThreadPresenter.new(thread, @reader, false, num_comments, is_endorsed).to_hash(false, 0, nil, true)
check_thread_result(@reader, thread, hash)
['children', 'resp_skip', 'resp_limit', 'resp_total'].each {|k| (hash.has_key? k).should be_false }
['children', 'resp_skip', 'resp_limit', 'resp_total'].each {|k| (hash.has_key? k).should be false }
end
end
......
......@@ -10,6 +10,8 @@ end
require File.join(File.dirname(__FILE__), '..', 'app')
require 'rack/test'
require 'rspec/its'
require 'rspec/collection_matchers'
require 'sinatra'
require 'yajl'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment