Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6dd5bbf

Browse files
Fix Travis integration
1 parent 4b0718b commit 6dd5bbf

File tree

10 files changed

+53
-11
lines changed

10 files changed

+53
-11
lines changed

‎.rubocop.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
AllCops:
22
Exclude:
33
- spec/dummy/db/schema.rb
4+
- vendor/bundle/**/*
45

56
Documentation:
67
Enabled: false
@@ -62,6 +63,7 @@ Metrics/LineLength:
6263
Exclude:
6364
- spec/dummy/**/*
6465
- spec/channels/chat_channel_spec.rb
66+
- config/routes.rb
6567

6668
Metrics/ParameterLists:
6769
Max: 5

‎.travis.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@ language: ruby
22
cache: bundler
33
rvm:
44
- 2.5.1
5+
6+
sudo: required
7+
8+
before_install:
9+
- sudo apt-get update
10+
- sudo apt-get install chromium-chromedriver
11+
- "export PATH=$PATH:/usr/lib/chromium-browser/"

‎README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# ActiveAdminChat
2+
3+
[![Build Status](https://travis-ci.org/rootstrap/active_admin_chat.svg?branch=master)](https://travis-ci.org/rootstrap/active_admin_chat)
4+
25
Get a chat for your ActiveAdmin app out of the box.
36

47
## Installation

‎config/routes.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace ActiveAdminChat.namespace do
44
get "#{ActiveAdminChat.page_name}/:id", to: "#{ActiveAdminChat.page_name}#show"
55
post "#{ActiveAdminChat.user_model_name}/:#{ActiveAdminChat.user_relation_name}_id/#{ActiveAdminChat.page_name}",
6-
to: "#{ActiveAdminChat.page_name}#create"
6+
to: "#{ActiveAdminChat.page_name}#create"
77
end
88
end
99
end

‎lib/active_admin_chat.rb‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ def setup
3333

3434
::ActiveAdmin.send :include, ActiveAdminChat::ActiveAdmin
3535
::ActiveAdmin::Application.send :include, ActiveAdminChat::ActiveAdmin::Application
36-
::ActiveAdmin::Views::IndexAsTable::IndexTableFor.send :prepend, ActiveAdminChat::ActiveAdmin::Views::IndexAsTable::IndexTableFor
36+
::ActiveAdmin::Views::IndexAsTable::IndexTableFor.send(
37+
:prepend,
38+
ActiveAdminChat::ActiveAdmin::Views::IndexAsTable::IndexTableFor
39+
)

‎lib/active_admin_chat/active_admin/application.rb‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ def show
2323
end
2424

2525
def create
26-
conversation = ActiveAdminChat.conversation_klass
27-
.find_or_create_by!(
28-
"#{user_relation_name_id}": params[:"#{user_relation_name_id}"]
29-
)
26+
conversation =
27+
ActiveAdminChat.conversation_klass
28+
.find_or_create_by!(
29+
"#{user_relation_name_id}": params[:"#{user_relation_name_id}"]
30+
)
3031
redirect_to action: 'show', id: conversation
3132
end
3233

@@ -48,7 +49,8 @@ def messages
4849
.includes(:sender).order(created_at: :desc)
4950

5051
if params[:created_at].present?
51-
page_messages = page_messages.where('created_at < ?', DateTime.parse(params[:created_at]))
52+
page_messages = page_messages.where('created_at < ?',
53+
DateTime.parse(params[:created_at]))
5254
end
5355
page_messages.limit(ActiveAdminChat.messages_per_page).reverse
5456
end

‎lib/active_admin_chat/active_admin/index_table_for.rb‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ module IndexAsTable
55
module IndexTableFor
66
def send_message_link(resource)
77
text_node link_to 'Send Message',
8-
"#{ActiveAdminChat.user_model_name}/#{resource.id}/#{ActiveAdminChat.page_name}",
8+
send_message_path(resource.id),
99
method: :post
1010
end
11+
12+
private
13+
14+
def send_message_path(id)
15+
"#{ActiveAdminChat.user_model_name}/#{id}/#{ActiveAdminChat.page_name}"
16+
end
1117
end
1218
end
1319
end

‎spec/features/chat_page_spec.rb‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
find('#send-message').native.send_keys(:return)
4747

4848
expect(page).to have_content('A new message')
49-
expect(page).to have_content(Time.current.strftime(':%M - %m/%d/%Y').sub(/(0)?(\d)\/0(\d)/, '2円/3円'))
49+
expect(page).to have_content(Time.current.strftime(':%M - %m/%d/%Y')
50+
.sub(%r{(0)?(\d)\/0(\d)}, '2円/3円'))
5051

5152
visit admin_chat_path
5253

@@ -73,7 +74,8 @@
7374
find('#send-message').native.send_keys(:return)
7475

7576
expect(page).to have_content('A new message')
76-
expect(page).to have_content(Time.current.strftime(':%M - %m/%d/%Y').sub(/(0)?(\d)\/0(\d)/, '2円/3円'))
77+
expect(page).to have_content(Time.current.strftime(':%M - %m/%d/%Y')
78+
.sub(%r{(0)?(\d)\/0(\d)}, '2円/3円'))
7779

7880
visit admin_chat_path
7981

‎spec/generators/install_generator_spec.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
contains "config.message_model_name = 'message'"
4444
contains "config.admin_user_model_name = 'admin_user'"
4545
contains "config.user_model_name = 'api/user'"
46-
contains "config.messages_per_page = 25"
46+
contains 'config.messages_per_page = 25'
4747
end
4848
end
4949
end

‎spec/rails_helper.rb‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
require 'rspec/rails'
88
# Add additional requires below this line. Rails is not loaded until this point!
99
require 'action_cable/testing/rspec'
10+
require 'selenium/webdriver'
1011

1112
# Setup ActiveAdmin
1213
ActiveAdmin.application.load_paths = [File.expand_path('dummy/app/admin', __dir__)]
@@ -29,6 +30,22 @@
2930
#
3031
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
3132

33+
Capybara.register_driver :chrome do |app|
34+
Capybara::Selenium::Driver.new(app, browser: :chrome)
35+
end
36+
37+
Capybara.register_driver :headless_chrome do |app|
38+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
39+
chromeOptions: { args: %w[headless no-sandbox disable-gpu] }
40+
)
41+
42+
Capybara::Selenium::Driver.new app,
43+
browser: :chrome,
44+
desired_capabilities: capabilities
45+
end
46+
47+
Capybara.javascript_driver = :headless_chrome
48+
3249
# Checks for pending migrations and applies them before tests are run.
3350
# If you are not using ActiveRecord, you can remove these lines.
3451
begin

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /