Skip to content

Commit

Permalink
Merge pull request #254 from okkez/use-test-unit-rails
Browse files Browse the repository at this point in the history
Use test-unit-rails instead of rspec-rails
  • Loading branch information
okkez authored Aug 8, 2018
2 parents 7ca1ea4 + c4856db commit 037dc06
Show file tree
Hide file tree
Showing 117 changed files with 3,054 additions and 3,648 deletions.
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ group :development, :test do
gem "rake"
gem "pry"
gem "pry-rails"
gem "rspec-rails", "~> 3.0"
gem "test-unit-rails", github: "test-unit/test-unit-rails", branch: "support-system-test-case"
gem "test-unit-notify"
end

group :development do
Expand All @@ -21,10 +22,11 @@ end

group :test do
gem "factory_bot_rails"
gem "capybara", "~> 3.3.1"
gem "capybara", "~> 3.4.2"
gem "capybara-screenshot"
gem "chromedriver-helper"
gem "simplecov", "~> 0.16.1", require: false
gem "webmock", "~> 3.3.0"
gem "timecop"
gem "selenium-webdriver", "~> 3.12.0"
gem "selenium-webdriver", "~> 3.13.1"
end
69 changes: 44 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
GIT
remote: git://github.com/test-unit/test-unit-rails.git
revision: 32adf391ed6e35b55bf21193f0c0556f4bcc7792
branch: support-system-test-case
specs:
test-unit-rails (5.1.4)
rails (>= 5.1.2)
test-unit (>= 3.1.7)
test-unit-activesupport (>= 1.0.8)
test-unit-capybara (>= 1.0.5)
test-unit-rr (>= 1.0.4)

PATH
remote: .
specs:
Expand Down Expand Up @@ -78,6 +90,8 @@ GEM
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
archive-zip (0.11.0)
io-like (~> 0.3.0)
arel (9.0.0)
aws-eventstream (1.0.1)
aws-partitions (1.96.0)
Expand Down Expand Up @@ -108,7 +122,7 @@ GEM
msgpack (~> 1.0)
bson (4.3.0)
builder (3.2.3)
capybara (3.3.1)
capybara (3.4.2)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
Expand All @@ -120,6 +134,9 @@ GEM
launchy
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (1.2.0)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
coderay (1.1.2)
concurrent-ruby (1.0.5)
cool.io (1.5.3)
Expand Down Expand Up @@ -155,14 +172,14 @@ GEM
faraday (0.15.2)
multipart-post (>= 1.2, < 3)
ffi (1.9.25)
fluent-plugin-elasticsearch (2.11.1)
fluent-plugin-elasticsearch (2.11.2)
elasticsearch
excon
fluentd (>= 0.14.20)
fluent-plugin-mongo (1.1.2)
fluentd (>= 0.14.12, < 2)
mongo (~> 2.6.0)
fluent-plugin-s3 (1.1.3)
fluent-plugin-s3 (1.1.4)
aws-sdk-s3 (~> 1.0)
aws-sdk-sqs (~> 1.0)
fluentd (>= 0.14.2, < 2)
Expand Down Expand Up @@ -205,6 +222,7 @@ GEM
concurrent-ruby (~> 1.0)
i18n_generators (2.1.1)
rails (>= 3.0.0)
io-like (0.3.0)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
Expand Down Expand Up @@ -239,6 +257,7 @@ GEM
nio4r (2.3.1)
nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
power_assert (1.1.3)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
Expand All @@ -249,7 +268,7 @@ GEM
rack (2.0.5)
rack-proxy (0.6.4)
rack
rack-test (1.0.0)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.0)
actioncable (= 5.2.0)
Expand Down Expand Up @@ -281,23 +300,7 @@ GEM
ffi (>= 0.5.0, < 2)
request_store (1.4.1)
rack (>= 1.4)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-rails (3.7.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
rr (1.2.1)
ruby_dep (1.5.0)
ruby_parser (3.11.0)
sexp_processor (~> 4.9)
Expand All @@ -314,7 +317,7 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (3.12.0)
selenium-webdriver (3.13.1)
childprocess (~> 0.5)
rubyzip (~> 1.2)
serverengine (2.0.7)
Expand All @@ -341,6 +344,20 @@ GEM
httpclient (>= 2.7)
msgpack (>= 0.5.6, < 2)
temple (0.8.0)
test-unit (3.2.8)
power_assert
test-unit-activesupport (1.0.9)
activesupport
test-unit
test-unit-capybara (1.0.6)
capybara (>= 2.1.0)
json
test-unit (>= 2.5.3)
test-unit-notify (1.0.4)
test-unit (>= 2.4.9)
test-unit-rr (1.0.5)
rr (>= 1.1.1)
test-unit (>= 2.5.2)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
Expand Down Expand Up @@ -375,18 +392,20 @@ PLATFORMS
DEPENDENCIES
better_errors
binding_of_caller
capybara (~> 3.3.1)
capybara (~> 3.4.2)
capybara-screenshot
chromedriver-helper
factory_bot_rails
fluentd-ui!
i18n_generators (= 2.1.1)
listen (>= 3.0.5, < 3.2)
pry
pry-rails
rake
rspec-rails (~> 3.0)
selenium-webdriver (~> 3.12.0)
selenium-webdriver (~> 3.13.1)
simplecov (~> 0.16.1)
test-unit-notify
test-unit-rails!
timecop
web-console (~> 3.6)
webmock (~> 3.3.0)
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require_relative 'config/application'

Rails.application.load_tasks

Expand Down
25 changes: 18 additions & 7 deletions app/javascript/packs/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,32 @@ import "lodash/lodash";
$(document).ready(() => {
const SettingSection = {
template: "#vue-setting-section",
props: ["id", "content", "type", "name", "arg"],
props: ["initialId", "initialContent", "initialType", "initialName", "initialArg"],
data: function() {
return {
mode: "default",
processing: false
processing: false,
id: null,
content: null,
type: null,
name: null,
arg: null
};
},
created: function() {
this.initialState();
this.id = this.initialId;
this.content = this.initialContent;
this.type = this.initialType;
this.name = this.initialName;
this.arg = this.initialArg;
},
computed: {
endpoint: function() {
return "/api/settings/" + this.id;
},
token: function() {
return Rails.csrfToken();
}
},
methods: {
Expand All @@ -35,7 +48,6 @@ $(document).ready(() => {
this.destroy();
},
onSubmit: function(_event) {
const token = document.getElementsByName("csrf-token")[0].getAttribute("content");
this.processing = true;
this.content = $(`#${this.id} textarea.form-control`)[0].dataset.content;
$.ajax({
Expand All @@ -47,10 +59,10 @@ $(document).ready(() => {
content: this.content
},
headers: {
"X-CSRF-Token": token
"X-CSRF-Token": this.token
}
}).then((data)=> {
_.each(data, function(v,k){
_.each(data, (v, k) => {
this[k] = v;
});
this.initialState();
Expand All @@ -63,7 +75,6 @@ $(document).ready(() => {
this.mode = "default";
},
destroy: function(){
const token = document.getElementsByName("csrf-token")[0].getAttribute("content");
$.ajax({
url: this.endpoint,
method: "POST",
Expand All @@ -72,7 +83,7 @@ $(document).ready(() => {
id: this.id
},
headers: {
"X-CSRF-Token": token
"X-CSRF-Token": this.token
}
}).then(()=> {
this.$parent.update();
Expand Down
22 changes: 12 additions & 10 deletions app/views/fluentd/settings/source_and_output.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,21 @@
%p.empty= t('.setting_empty')
%setting-section{"v-if" => "loaded && sections.sources.length > 0",
"v-for" => "source in sections.sources",
"v-bind:id" => "source.id",
"v-bind:content" => "source.content",
"v-bind:type" => "source.type",
"v-bind:name" => "source.name",
"v-bind:arg" => "source.arg"}
"v-bind:key" => "source.id",
"v-bind:initial-id" => "source.id",
"v-bind:initial-content" => "source.content",
"v-bind:initial-type" => "source.type",
"v-bind:initial-name" => "source.name",
"v-bind:initial-arg" => "source.arg"}
.col-xl-6.output
%h3= t('.out')
%div{"v-if" => "loaded && sections.matches.length == 0"}
%p.empty= t('.setting_empty')
%setting-section{"v-if" => "loaded && sections.matches.length > 0",
"v-for" => "match in sections.matches",
"v-bind:id" => "match.id",
"v-bind:content" => "match.content",
"v-bind:type" => "match.type",
"v-bind:name" => "match.name",
"v-bind:arg" => "match.arg"}
"v-bind:key" => "match.id",
"v-bind:initial-id" => "match.id",
"v-bind:initial-content" => "match.content",
"v-bind:initial-type" => "match.type",
"v-bind:initial-name" => "match.name",
"v-bind:initial-arg" => "match.arg"}
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
require "action_view/railtie"
# require "action_cable/engine"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
require "rails/test_unit/railtie"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/ruby2.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ group :development, :test do
gem "rake"
gem "pry"
gem "pry-rails"
gem "rspec-rails", "~> 3.0"
gem "test-unit-rails", github: "test-unit/test-unit-rails"
end

group :development do
Expand All @@ -19,6 +19,7 @@ group :test do
gem "factory_bot_rails"
gem "capybara", "~> 3.1.1"
gem "capybara-screenshot"
gem "chromedriver-helper"
gem "simplecov", "~> 0.16.1", require: false
gem "webmock", "~> 3.3.0"
gem "timecop"
Expand Down
Loading

0 comments on commit 037dc06

Please sign in to comment.