From faefc55457d13f5b66debd7b31e3b48c958383e7 Mon Sep 17 00:00:00 2001 From: Luke Barratt Date: Sun, 12 Apr 2015 10:42:34 +0100 Subject: [PATCH 1/4] Remove travis config. Added CircleCI config. --- .travis.yml | 18 ------------------ circle.yml | 4 ++++ config/database.circle.yml | 7 +++++++ 3 files changed, 11 insertions(+), 18 deletions(-) delete mode 100644 .travis.yml create mode 100644 circle.yml create mode 100644 config/database.circle.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0d41268..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: ruby -bundler_args: --jobs=3 --retry=3 -cache: - bundler: true -addons: - code_climate: - repo_token: b3db5b7df9a0a1d0fd3503e72d7431ffbfa172492c2840d590ccb2fafd9172d3 -rvm: - - 2.1.2 -env: - - MYSQL_USERNAME=travis - - APP_SECRET=2d3a08dfea079fe45bcb7f830b010eda -before_script: - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start -script: - - RAILS_ENV=test bundle exec rake db:create db:migrate db:test:prepare - - RAILS_ENV=test bundle exec rspec spec diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..4a2665c --- /dev/null +++ b/circle.yml @@ -0,0 +1,4 @@ +database: + override: + - mv config/database.circle.yml config/database.yml + - bundle exec rake db:create db:schema:load --trace diff --git a/config/database.circle.yml b/config/database.circle.yml new file mode 100644 index 0000000..59273a8 --- /dev/null +++ b/config/database.circle.yml @@ -0,0 +1,7 @@ +test: + socket: /var/run/mysqld/mysqld.sock + host: localhost + database: circle_ruby_test + adapter: mysql2 + encoding: utf8 + username: ubuntu From e61c9fbf766320ea0b52dcd6844e3c5b1efb79c5 Mon Sep 17 00:00:00 2001 From: Luke Barratt Date: Sat, 25 Apr 2015 22:35:01 +0100 Subject: [PATCH 2/4] Fixes Google Calendar feed test. Use the current timezone when checking for DST. --- spec/features/calendar/google_calendar_widget_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/calendar/google_calendar_widget_spec.rb b/spec/features/calendar/google_calendar_widget_spec.rb index d0ed17f..0c605a7 100644 --- a/spec/features/calendar/google_calendar_widget_spec.rb +++ b/spec/features/calendar/google_calendar_widget_spec.rb @@ -75,7 +75,7 @@ feature 'Google Calendar widget', js: :true do end def timezone_adjusted - if Time.now.dst? + if Time.zone.now.dst? "14:30 EDT" else "15:30 EST" From ee0f92262dc6c812f39a26d1756896ab0efa42a1 Mon Sep 17 00:00:00 2001 From: Luke Barratt Date: Sat, 25 Apr 2015 22:40:09 +0100 Subject: [PATCH 3/4] Show CircleCI's status badge in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1165047..b7c9e71 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/ENSL/ensl.org.svg?branch=master)](https://travis-ci.org/ENSL/ensl.org) +[![Circle CI](https://circleci.com/gh/ENSL/ensl.org.svg?style=svg)](https://circleci.com/gh/ENSL/ensl.org) [![Code Climate](https://codeclimate.com/github/ENSL/ensl.org.png)](https://codeclimate.com/github/ENSL/ensl.org) [![Code Climate](https://codeclimate.com/github/ENSL/ensl.org/coverage.png)](https://codeclimate.com/github/ENSL/ensl.org) From 8f73a18500fb16619e25cf80bb9d86cd3a8608cf Mon Sep 17 00:00:00 2001 From: Luke Barratt Date: Sat, 25 Apr 2015 23:15:10 +0100 Subject: [PATCH 4/4] Stub Google Calendar's JSON response globally for each spec --- spec/features/calendar/google_calendar_widget_spec.rb | 6 ------ spec/spec_helper.rb | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/spec/features/calendar/google_calendar_widget_spec.rb b/spec/features/calendar/google_calendar_widget_spec.rb index 0c605a7..c9082fb 100644 --- a/spec/features/calendar/google_calendar_widget_spec.rb +++ b/spec/features/calendar/google_calendar_widget_spec.rb @@ -1,13 +1,7 @@ require 'spec_helper' feature 'Google Calendar widget', js: :true do - let(:events_list_json) { JSON.parse(File.read(Rails.root.join('spec/fixtures/google_calendar.json'))) } - before do - GoogleCalendar::Request.stub(:events_list) do - GoogleCalendar::EventList.new(events_list_json, Time.zone.name) - end - visit root_path end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e13b83b..e31306e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,4 +31,12 @@ RSpec.configure do |config| config.fixture_path = "#{::Rails.root}/spec/fixtures" config.order = 'random' config.use_transactional_fixtures = false + + config.before(:each) do + events_list_json = JSON.parse(File.read(Rails.root.join('spec/fixtures/google_calendar.json'))) + + GoogleCalendar::Request.stub(:events_list) do + GoogleCalendar::EventList.new(events_list_json, Time.zone.name) + end + end end