From 35283001f6f7643009e43db5405e69e73dc1829c Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Fri, 7 Apr 2017 11:20:46 +0800 Subject: [PATCH 01/13] test --- config/deploy/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 681e372..ba0fb83 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -17,7 +17,7 @@ # property set. Specify the username and a domain or IP for the server. # Don't use `:all`, it's a meta role. -server '139.162.23.218', user: 'deploy', roles: %w{app db web}, my_property: :my_value +server '103.29.69.230', user: 'deploy', roles: %w{app db web}, my_property: :my_value # role :app, %w{deploy@example.com}, my_property: :my_value # role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value # role :db, %w{deploy@example.com} From fb1281c915bf821acf87c8c6aa1b6c405298e811 Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Fri, 7 Apr 2017 13:54:38 +0800 Subject: [PATCH 02/13] test2 --- Gemfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index 29e5531..9e9dde2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,9 @@ source 'https://rubygems.org' + + + # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server From 159e4e6cb5a56facc0dec81acc97fe01edbb0135 Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Fri, 7 Apr 2017 16:15:06 +0800 Subject: [PATCH 03/13] test3 --- Gemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile b/Gemfile index 9e9dde2..69678de 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,6 @@ source 'https://rubygems.org' - # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server From 77a34e041feba08f2b01133134b22eb189708a32 Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Fri, 7 Apr 2017 16:22:51 +0800 Subject: [PATCH 04/13] test4 --- Gemfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Gemfile b/Gemfile index 69678de..2f548b5 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,11 @@ source 'https://rubygems.org' + + + + + # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server From 7a1534a4b0f53177ae11135b673124938b262a4a Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Fri, 7 Apr 2017 16:54:37 +0800 Subject: [PATCH 05/13] test5 --- Gemfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Gemfile b/Gemfile index 2f548b5..9e9dde2 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,6 @@ source 'https://rubygems.org' - - - - # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server From 149b2318c28095f3fb2c8a4b660eed32366e92ff Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Fri, 7 Apr 2017 17:00:53 +0800 Subject: [PATCH 06/13] test6 --- Gemfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index 9e9dde2..9d24d38 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,9 @@ source 'https://rubygems.org' + + + # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server From ea73016b0144f18ceaf04c407afb77e977f96475 Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Mon, 10 Apr 2017 14:52:42 +0800 Subject: [PATCH 07/13] test7 --- Gemfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Gemfile b/Gemfile index 9d24d38..9e9dde2 100644 --- a/Gemfile +++ b/Gemfile @@ -4,9 +4,6 @@ source 'https://rubygems.org' - - - # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server From f7a928d9269b36cc446575ff95a33c6cb4e9f32c Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Mon, 10 Apr 2017 15:23:50 +0800 Subject: [PATCH 08/13] test9 --- Gemfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Gemfile b/Gemfile index 9e9dde2..29e5531 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,6 @@ source 'https://rubygems.org' - - - # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server From 14b198fe7462bf521b927b28b54f239383565466 Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Mon, 10 Apr 2017 16:34:39 +0800 Subject: [PATCH 09/13] =?UTF-8?q?test=CB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index 29e5531..9e9dde2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,9 @@ source 'https://rubygems.org' + + + # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server From cf90c5e694f360fa9566d7502c413c0d2a0fa566 Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Mon, 10 Apr 2017 16:39:21 +0800 Subject: [PATCH 10/13] =?UTF-8?q?test=CB=991?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index 9e9dde2..9d24d38 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,9 @@ source 'https://rubygems.org' + + + # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server From 3aa87e6a74d8b84e0e88791e4b3ad3464547f298 Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Mon, 10 Apr 2017 16:55:46 +0800 Subject: [PATCH 11/13] add rspec --- .rspec | 2 + Gemfile | 1 + Gemfile.lock | 19 ++++++++ spec/models/hello_spec.rb | 7 +++ spec/rails_helper.rb | 57 ++++++++++++++++++++++ spec/spec_helper.rb | 99 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 185 insertions(+) create mode 100644 .rspec create mode 100644 spec/models/hello_spec.rb create mode 100644 spec/rails_helper.rb create mode 100644 spec/spec_helper.rb diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..83e16f8 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--require spec_helper diff --git a/Gemfile b/Gemfile index 9d24d38..5168682 100644 --- a/Gemfile +++ b/Gemfile @@ -55,6 +55,7 @@ end group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platform: :mri + gem 'rspec-rails' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index c06f575..9c78226 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -83,6 +83,7 @@ GEM railties (>= 4.1.0, < 5.1) responders warden (~> 1.2.3) + diff-lcs (1.2.5) erubis (2.7.0) execjs (2.7.0) faker (1.6.6) @@ -187,6 +188,23 @@ GEM remotipart (1.3.1) responders (2.3.0) railties (>= 4.2.0, < 5.1) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-rails (3.5.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) sass (3.4.22) sass-rails (5.0.6) railties (>= 4.0.0, < 6) @@ -253,6 +271,7 @@ DEPENDENCIES puma (~> 3.0) rails (~> 5.0.0, >= 5.0.0.1) remotipart (~> 1.0) + rspec-rails sass-rails (~> 5.0) spring spring-watcher-listen (~> 2.0.0) diff --git a/spec/models/hello_spec.rb b/spec/models/hello_spec.rb new file mode 100644 index 0000000..eae49d3 --- /dev/null +++ b/spec/models/hello_spec.rb @@ -0,0 +1,7 @@ +require 'rails_helper' + +describe "Hello" do + it "Hi" do + expect(1 + 1).to eq(2) + end +end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb new file mode 100644 index 0000000..6f1ab14 --- /dev/null +++ b/spec/rails_helper.rb @@ -0,0 +1,57 @@ +# This file is copied to spec/ when you run 'rails generate rspec:install' +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../config/environment', __FILE__) +# Prevent database truncation if the environment is production +abort("The Rails environment is running in production mode!") if Rails.env.production? +require 'spec_helper' +require 'rspec/rails' +# Add additional requires below this line. Rails is not loaded until this point! + +# Requires supporting ruby files with custom matchers and macros, etc, in +# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are +# run as spec files by default. This means that files in spec/support that end +# in _spec.rb will both be required and run as specs, causing the specs to be +# run twice. It is recommended that you do not name files matching this glob to +# end with _spec.rb. You can configure this pattern with the --pattern +# option on the command line or in ~/.rspec, .rspec or `.rspec-local`. +# +# The following line is provided for convenience purposes. It has the downside +# of increasing the boot-up time by auto-requiring all files in the support +# directory. Alternatively, in the individual `*_spec.rb` files, manually +# require only the support files necessary. +# +# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } + +# Checks for pending migration and applies them before tests are run. +# If you are not using ActiveRecord, you can remove this line. +ActiveRecord::Migration.maintain_test_schema! + +RSpec.configure do |config| + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, remove the following line or assign false + # instead of true. + config.use_transactional_fixtures = true + + # RSpec Rails can automatically mix in different behaviours to your tests + # based on their file location, for example enabling you to call `get` and + # `post` in specs under `spec/controllers`. + # + # You can disable this behaviour by removing the line below, and instead + # explicitly tag your specs with their type, e.g.: + # + # RSpec.describe UsersController, :type => :controller do + # # ... + # end + # + # The different available types are documented in the features, such as in + # https://relishapp.com/rspec/rspec-rails/docs + config.infer_spec_type_from_file_location! + + # Filter lines from Rails gems in backtraces. + config.filter_rails_from_backtrace! + # arbitrary gems may also be filtered via: + # config.filter_gems_from_backtrace("gem name") +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..8f698be --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,99 @@ +# This file was generated by the `rails generate rspec:install` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# The `.rspec` file also contains a few flags that are not defaults but that +# users commonly want. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + + # This option will default to `:apply_to_host_groups` in RSpec 4 (and will + # have no way to turn it off -- the option exists only for backwards + # compatibility in RSpec 3). It causes shared context metadata to be + # inherited by the metadata hash of host groups and examples, rather than + # triggering implicit auto-inclusion in groups with matching metadata. + config.shared_context_metadata_behavior = :apply_to_host_groups + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # This allows you to limit a spec run to individual examples or groups + # you care about by tagging them with `:focus` metadata. When nothing + # is tagged with `:focus`, all examples get run. RSpec also provides + # aliases for `it`, `describe`, and `context` that include `:focus` + # metadata: `fit`, `fdescribe` and `fcontext`, respectively. + config.filter_run_when_matching :focus + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ + # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + config.disable_monkey_patching! + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = 'doc' + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end +end From 173a7ac41f4755ac1d03adc495fbb94a2fe3cbbc Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Tue, 11 Apr 2017 15:12:32 +0800 Subject: [PATCH 12/13] test10 --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index 5168682..d406394 100644 --- a/Gemfile +++ b/Gemfile @@ -5,8 +5,6 @@ source 'https://rubygems.org' - - # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server From a418e6ed4ca3ed254f019bc3f8fb1d447738c4ed Mon Sep 17 00:00:00 2001 From: HEROGWP Date: Tue, 11 Apr 2017 15:34:02 +0800 Subject: [PATCH 13/13] test11 --- Gemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Gemfile b/Gemfile index d406394..48ba16a 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,6 @@ source 'https://rubygems.org' - # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use Puma as the app server