-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
95 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
Chanko::Engine.routes.draw do | |||
end | |||
|
|||
Chanko::Application.routes.draw do | |||
mount Chanko::Engine => "/ext" | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,7 @@ | |||
# singletone issue will be fixed | |||
# https://github.com/radar/forem/commit/049057a8e94e59610365b6764c733eb7876c8351 | |||
require 'active_support/core_ext/kernel/singleton_class' | |||
require 'chanko/engine' | |||
|
|||
module Chanko | module Chanko | ||
require 'chanko/railtie' | |||
end | end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,4 @@ | |||
Chanko::Application.routes.draw do | Chanko::Application.routes.draw do | ||
mount Chanko::Engine => "/" | |||
match '/:controller(/:action(/:id))' | match '/:controller(/:action(/:id))' | ||
end | end |
7 changes: 7 additions & 0 deletions
7
spec/fixtures/test_units/engine_unit/app/controllers/engine_unit/top_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
module EngineUnit | |||
class TopController < ActionController::Base | |||
def top | |||
render :text => 'hoge' | |||
end | |||
end | |||
end |
8 changes: 8 additions & 0 deletions
8
spec/fixtures/test_units/engine_unit/app/models/engine_unit/comment.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
module EngineUnit | |||
class Comment < ActiveRecord::Base | |||
set_table_name :comments | |||
def hello | |||
'hello' | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
EngineUnit::Engine.routes.draw do | |||
match '/' => 'top#top' | |||
end | |||
|
|||
Chanko::Engine.routes.draw do | |||
mount EngineUnit::Engine => "/engine_unit" | |||
end | |||
|
5 changes: 5 additions & 0 deletions
5
spec/fixtures/test_units/engine_unit/lib/engine_unit/engine.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
module EngineUnit | |||
class Engine < ::Rails::Engine | |||
isolate_namespace EngineUnit | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,13 @@ | |||
require 'spec_helper' | |||
|
|||
describe "Chanko", :type => :integration do | |||
describe "Engine" do | |||
before do | |||
end | |||
|
|||
it 'access engine action' do | |||
visit "/engine_unit" | |||
(response || page).body.should == 'hoge' | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
require 'spec_helper' | |||
|
|||
describe Chanko do | |||
shared_examples_for 'engine' do | |||
describe 'model' do | |||
it 'use engine model method' do | |||
EngineUnit::Comment.new.hello.should == 'hello' | |||
end | |||
|
|||
it'save engine model' do | |||
expect { | |||
EngineUnit::Comment.create | |||
}.to change(EngineUnit::Comment, :count).from(0).to(1) | |||
end | |||
end | |||
end | |||
|
|||
context 'with cache_classes' do | |||
before { Chanko.config.cache_classes = true } | |||
it_should_behave_like 'engine' | |||
end | |||
|
|||
context 'without cache_classes' do | |||
before { Chanko.config.cache_classes = false } | |||
it_should_behave_like 'engine' | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters