diff --git a/.circleci/config.yml b/.circleci/config.yml index 8b80af9e0fc2..9f4ce1a3f7bd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,9 +53,20 @@ jobs: name: eslint command: yarn run eslint - - run: - name: brakeman - command: brakeman + # - run: + # name: brakeman + # command: brakeman + + # - run: + # name: Copy files + # command: | + # cp shared/config/database.yml config/database.yml + # cp shared/config/application.yml config/application.yml + + # Run rails tests + - type: shell + command: | + rspec $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) # Store yarn / webpacker cache - save_cache: diff --git a/.eslintrc.js b/.eslintrc.js index 599c6d269c14..6ad57866eb1f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -25,7 +25,8 @@ module.exports = { 'allowFirstLine': false } }], - 'vue/html-self-closing': false + 'vue/html-self-closing': 'off', + "vue/no-v-html": 'off' }, settings: { 'import/resolver': { diff --git a/.rspec b/.rspec new file mode 100644 index 000000000000..c99d2e7396e1 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--require spec_helper diff --git a/Gemfile b/Gemfile index 22b721ddd14d..f29d36675372 100644 --- a/Gemfile +++ b/Gemfile @@ -56,13 +56,17 @@ gem 'foreman' # static analysis gem 'brakeman' +group :development do + gem 'web-console' + gem 'letter_opener' +end + group :development, :test do gem 'byebug', platform: :mri - gem 'letter_opener' - gem 'web-console' gem 'listen' gem 'spring' gem 'spring-watcher-listen' gem 'seed_dump' gem 'rubocop', '~> 0.74.0', require: false + gem 'rspec-rails', '~> 3.8' end diff --git a/Gemfile.lock b/Gemfile.lock index 968443e21d3c..ceb423c642c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -172,6 +172,7 @@ GEM crass (1.0.4) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) + diff-lcs (1.3) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dotenv (0.7.0) @@ -329,6 +330,23 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) + rspec-core (3.8.2) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.4) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-rails (3.8.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.2) rubocop (0.74.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) @@ -456,6 +474,7 @@ DEPENDENCIES redis-rack-cache responders rest-client + rspec-rails (~> 3.8) rubocop (~> 0.74.0) sass-rails (~> 5.0) seed_dump diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index 1bbe4413e9bb..c0a4006d2e12 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -28,6 +28,6 @@ def create_reset_token_link(user) user.reset_password_token = enc user.reset_password_sent_at = Time.now.utc user.save(validate: false) - "/u/auth/password/edit?config=default&redirect_url=&reset_password_token="+raw + "/app/auth/password/edit?config=default&redirect_url=&reset_password_token="+raw end end diff --git a/app/helpers/frontend_urls_helper.rb b/app/helpers/frontend_urls_helper.rb new file mode 100644 index 000000000000..46ff71cd0dde --- /dev/null +++ b/app/helpers/frontend_urls_helper.rb @@ -0,0 +1,6 @@ +module FrontendUrlsHelper + def frontend_url(path, **query_params) + url_params = query_params.blank? ? "" : "?#{query_params.to_query}" + "#{root_url}app/#{path}#{url_params}" + end +end diff --git a/app/javascript/src/api/auth.js b/app/javascript/src/api/auth.js index 220bfa76dccf..3ea00b2ca6af 100644 --- a/app/javascript/src/api/auth.js +++ b/app/javascript/src/api/auth.js @@ -7,6 +7,7 @@ import moment from 'moment'; import Cookies from 'js-cookie'; import endPoints from './endPoints'; +import { frontendURL } from '../helper/URLHelper'; export default { login(creds) { @@ -65,7 +66,7 @@ export default { if (error.response.status === 401) { Cookies.remove('auth_data'); Cookies.remove('user'); - window.location = '/login'; + window.location = frontendURL('login'); } reject(error); }); @@ -80,7 +81,7 @@ export default { .then(response => { Cookies.remove('auth_data'); Cookies.remove('user'); - window.location = '/u/login'; + window.location = frontendURL('login'); resolve(response); }) .catch(error => { diff --git a/app/javascript/src/components/buttons/FormSubmitButton.vue b/app/javascript/src/components/buttons/FormSubmitButton.vue index 6b4e69a7279b..fb977e72e776 100644 --- a/app/javascript/src/components/buttons/FormSubmitButton.vue +++ b/app/javascript/src/components/buttons/FormSubmitButton.vue @@ -1,8 +1,8 @@ @@ -10,19 +10,34 @@ import Spinner from '../Spinner'; export default { - props: { - disabled: Boolean, - loading: Boolean, - buttonText: String, - buttonClass: String, - iconClass: String, - }, components: { Spinner, }, + props: { + disabled: { + type: Boolean, + default: false, + }, + loading: { + type: Boolean, + default: false, + }, + buttonText: { + type: String, + default: '', + }, + buttonClass: { + type: String, + default: '', + }, + iconClass: { + type: String, + default: '', + }, + }, computed: { computedClass() { - return `button ${this.buttonClass || ' '}`; + return `button nice ${this.buttonClass || ' '}`; }, }, }; diff --git a/app/javascript/src/components/buttons/ResolveButton.vue b/app/javascript/src/components/buttons/ResolveButton.vue index 6e6e28990a45..24e045ee76cb 100644 --- a/app/javascript/src/components/buttons/ResolveButton.vue +++ b/app/javascript/src/components/buttons/ResolveButton.vue @@ -1,8 +1,13 @@ @@ -13,9 +18,7 @@ import { mapGetters } from 'vuex'; import Spinner from '../Spinner'; export default { - props: [ - 'conversationId', - ], + props: ['conversationId'], data() { return { isLoading: false, @@ -50,5 +53,3 @@ export default { }, }; - - diff --git a/app/javascript/src/components/layout/Sidebar.vue b/app/javascript/src/components/layout/Sidebar.vue index dee22c1a3693..7581ddcc2d8e 100644 --- a/app/javascript/src/components/layout/Sidebar.vue +++ b/app/javascript/src/components/layout/Sidebar.vue @@ -1,47 +1,56 @@