Skip to content

Commit d958a88

Browse files
committed
moved test to integration
1 parent 9fa2a8f commit d958a88

File tree

7 files changed

+66
-38
lines changed

7 files changed

+66
-38
lines changed

app/helpers/matestack/ui/core/application_helper.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ def responder_for(page_class, options = {})
2626
end
2727
if params[:only_page]
2828
render html: render_page(page_class, true)
29-
elsif params[:layout]
30-
render html: render_page(page_class), layout: params[:layout]
3129
else
3230
render html: render_page(page_class), layout: true
3331
end

spec/dummy/config/routes.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
end
1919

2020
get '/example', to: 'example#page'
21-
get '/example_turbolinks', to: 'example#turbolinks'
2221

2322
scope :my_app do
2423
get 'my_first_page', to: 'my_app#my_first_page'

spec/usage/application.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// This is a manifest file that'll be compiled into application.js, which will include all the files
2+
// listed below.
3+
//
4+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6+
//
7+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
9+
//
10+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11+
// about supported directives.
12+
//
13+
//= require rails-ujs
14+
//= require activestorage
15+
//= require matestack-ui-core
16+
//= require_tree .
17+
18+
//= require demo/component
19+
20+
App.cable.subscriptions.create("MatestackUiCoreChannel", {
21+
received(data) {
22+
MatestackUiCore.matestackEventHub.$emit('MatestackUiCoreChannel', data)
23+
}
24+
});

spec/usage/base/turbolinks_spec.rb

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
describe "Turbolinks integration", type: :feature, js: true do
2+
before(:all) do
3+
FileUtils.cp('spec/usage/application_with_turbolinks.js', 'spec/dummy/app/assets/javascripts/application.js')
4+
end
5+
6+
before do
7+
Rails.application.routes.draw do
8+
get '/turbolinks', to: 'turbolinks#my_action', as: 'turbolinks_test_action'
9+
end
10+
11+
class TurbolinksController < ActionController::Base
12+
layout "application"
13+
14+
include Matestack::Ui::Core::ApplicationHelper
15+
16+
def my_action
17+
end
18+
end
19+
20+
module Pages::Turbolinks
21+
end
22+
23+
class Pages::Turbolinks::MyAction < Matestack::Ui::Page
24+
def response
25+
components {
26+
plain "Hello from matestack with turbolinks"
27+
}
28+
end
29+
end
30+
end
31+
32+
after do
33+
FileUtils.cp('spec/usage/application.js', 'spec/dummy/app/assets/javascripts/application.js')
34+
Rails.application.reload_routes!
35+
end
36+
37+
specify "Matestack can be used with turbolinks" do
38+
visit "/turbolinks"
39+
40+
expect(page).to have_text "Hello from matestack without turbolinks"
41+
end
42+
end

0 commit comments

Comments
 (0)