Skip to content

Skip test dependent on Scrivito from forked repo PR #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Nov 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ cache:
- bundler
script:
- bundle exec rake db:migrate --trace
- bundle exec rake
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bundle exec rspec spec; fi
- if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_PULL_REQUEST_SLUG" = "coderdojo-japan/coderdojo.jp" ]; then bundle exec rspec spec; fi
- if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_PULL_REQUEST_SLUG" != "coderdojo-japan/coderdojo.jp" ]; then bundle exec rspec spec --tag ~@scrivito; fi
env:
global:
- TZ='Asia/Tokyo'
6 changes: 0 additions & 6 deletions app/controllers/cms_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
class CmsController < ApplicationController
include Scrivito::ControllerActions

title ||= ENV['SCRIVITO_WORKSPACE'] || 'DEFAULT_WORKSPACE'
Scrivito::Workspace.create(title: title) unless Scrivito::Workspace.find_by_title(title)
Scrivito::Workspace.use(title)

LoginPage.create(title: 'ログイン')
end
2 changes: 1 addition & 1 deletion app/controllers/docs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def index

def show
@doc = Document.new(params[:id])
redirect_to scrivito_path(Obj.root) if not @doc.exists?
redirect_to root_url unless @doc.exists?
@content = Kramdown::Document.new(@doc.content, input: 'GFM').to_html
@url = request.url
end
Expand Down
8 changes: 8 additions & 0 deletions config/initializers/scrivito.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@
end
end
end

if ENV.key?('SCRIVITO_TENANT') && ENV.key?('SCRIVITO_API_KEY')
title = ENV.fetch('SCRIVITO_WORKSPACE', 'DEFAULT_WORKSPACE')
Scrivito::Workspace.create(title: title) unless Scrivito::Workspace.find_by_title(title)
Scrivito::Workspace.use(title)

LoginPage.create(title: 'ログイン')
end
2 changes: 1 addition & 1 deletion spec/controllers/blog_post_page_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe BlogPostPageController, type: :controller do
RSpec.describe BlogPostPageController, type: :controller, scrivito: true do
render_views

describe "GET Blog Post Page" do
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/docs_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

it 'when invalid filename' do
get :show, params: { id: '../not_found' }
expect(response).to redirect_to controller.scrivito_path(Obj.root)
expect(response).to redirect_to controller.root_url
expect(response.status).to eq 302
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/sessions_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe SessionsController, type: :controller do
RSpec.describe SessionsController, type: :controller, scrivito: true do
describe "GET #create" do
it "param match" do
get :create, params: { email: ENV['SCRIVITO_EMAIL'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe SotechshaOverviewPageController, type: :controller do
RSpec.describe SotechshaOverviewPageController, type: :controller, scrivito: true do
render_views

describe "GET #index" do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/news_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
require 'rails_helper'

RSpec.feature "News", type: :feature do
RSpec.feature "News", type: :feature, scrivito: true do
describe "GET /news/2016/12/12/new-backend" do
scenario "Title should be formatted" do
visit "/news/2016/12/12/new-backend"
Expand Down
2 changes: 1 addition & 1 deletion spec/features/sotechsha_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
require 'rails_helper'

RSpec.feature "Sotechsha", type: :feature, retry: 3 do
RSpec.feature "Sotechsha", type: :feature, scrivito: true, retry: 3 do

describe "GET /sotechsha/num" do
scenario "Quizzes should be permalink" do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'rails_helper'
include Scrivito::ControllerHelper

RSpec.feature "Users", type: :feature do
RSpec.feature "Users", type: :feature, scrivito: true do
subject { page }

describe "log in" do
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/news_pages_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe "NewsPages", type: :request do
RSpec.describe "NewsPages", type: :request, scrivito: true do
describe "GET /news/2016/12/12/new-backend" do
it "Blog post should be rendered" do
get '/news/2016/12/12/new-backend'
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/sotechshas_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rails_helper'

RSpec.describe "Sotechshas", type: :request do
RSpec.describe "Sotechshas", type: :request, scrivito: true do

describe "Quizzes should be permalink" do
it "Quizzes should be permalink" do
Expand Down