diff --git a/Gemfile b/Gemfile index 9f2e6c9..b4e1314 100644 --- a/Gemfile +++ b/Gemfile @@ -4,5 +4,5 @@ gemspec # jquery-rails is used by the dummy application gem "jquery-rails" - +gem 'activeresource' gem 'debugger' diff --git a/Gemfile.lock b/Gemfile.lock index 7f2e6e0..e34778b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,185 +1,192 @@ PATH remote: . specs: - maily_herald (0.0.1) + maily_herald (0.8.0) liquid (~> 2.6.1) - rails (> 3.2) + rails (~> 4.0.0) sidekiq (~> 2.17.8) GEM remote: http://rubygems.org/ specs: - actionmailer (3.2.18) - actionpack (= 3.2.18) - mail (~> 2.5.4) - actionpack (3.2.18) - activemodel (= 3.2.18) - activesupport (= 3.2.18) - builder (~> 3.0.0) + actionmailer (4.0.13) + actionpack (= 4.0.13) + mail (~> 2.5, >= 2.5.4) + actionpack (4.0.13) + activesupport (= 4.0.13) + builder (~> 3.1.0) erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.18) - activesupport (= 3.2.18) - builder (~> 3.0.0) - activerecord (3.2.18) - activemodel (= 3.2.18) - activesupport (= 3.2.18) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.18) - activemodel (= 3.2.18) - activesupport (= 3.2.18) - activesupport (3.2.18) - i18n (~> 0.6, >= 0.6.4) - multi_json (~> 1.0) - arel (3.0.3) - builder (3.0.4) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.13) + activesupport (= 4.0.13) + builder (~> 3.1.0) + activerecord (4.0.13) + activemodel (= 4.0.13) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.13) + arel (~> 4.0.0) + activerecord-deprecated_finders (1.0.4) + activeresource (4.0.0) + activemodel (~> 4.0) + activesupport (~> 4.0) + rails-observers (~> 0.1.1) + activesupport (4.0.13) + i18n (~> 0.6, >= 0.6.9) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + arel (4.0.2) + builder (3.1.4) celluloid (0.15.2) timers (~> 1.1.0) coderay (1.1.0) - columnize (0.8.9) - connection_pool (2.0.0) - database_cleaner (1.3.0) + columnize (0.9.0) + connection_pool (2.1.3) + database_cleaner (1.4.1) debugger (1.6.8) columnize (>= 0.3.1) debugger-linecache (~> 1.2.0) debugger-ruby_core_source (~> 1.3.5) debugger-linecache (1.2.0) - debugger-ruby_core_source (1.3.5) + debugger-ruby_core_source (1.3.8) diff-lcs (1.2.5) - docile (1.1.3) + docile (1.1.5) erubis (2.7.0) - factory_girl (4.4.0) + factory_girl (4.5.0) activesupport (>= 3.0.0) - factory_girl_rails (4.4.1) - factory_girl (~> 4.4.0) + factory_girl_rails (4.5.0) + factory_girl (~> 4.5.0) railties (>= 3.0.0) - ffi (1.9.3) + ffi (1.9.8) formatador (0.2.5) - guard (2.6.1) + guard (2.12.5) formatador (>= 0.2.4) listen (~> 2.7) lumberjack (~> 1.0) + nenv (~> 0.1) + notiffany (~> 0.0) pry (>= 0.9.12) + shellany (~> 0.0) thor (>= 0.18.1) - guard-rspec (4.2.10) + guard-compat (1.2.1) + guard-rspec (4.5.0) guard (~> 2.1) - rspec (>= 2.14, < 4.0) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) hike (1.2.3) - i18n (0.6.9) - journey (1.0.4) - jquery-rails (3.1.0) + i18n (0.7.0) + jquery-rails (3.1.2) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - json (1.8.1) - liquid (2.6.1) - listen (2.7.7) + json (1.8.2) + liquid (2.6.2) + listen (2.9.0) celluloid (>= 0.15.2) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) - lumberjack (1.0.6) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) + lumberjack (1.0.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) method_source (0.8.2) - mime-types (1.25.1) - multi_json (1.10.1) - polyglot (0.3.5) - pry (0.10.0) + mime-types (2.4.3) + minitest (4.7.5) + multi_json (1.11.0) + nenv (0.2.0) + notiffany (0.0.6) + nenv (~> 0.1) + shellany (~> 0.0) + pry (0.10.1) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.4) - rack - rack-test (0.6.2) + rack (1.5.2) + rack-test (0.6.3) rack (>= 1.0) - rails (3.2.18) - actionmailer (= 3.2.18) - actionpack (= 3.2.18) - activerecord (= 3.2.18) - activeresource (= 3.2.18) - activesupport (= 3.2.18) - bundler (~> 1.0) - railties (= 3.2.18) - railties (3.2.18) - actionpack (= 3.2.18) - activesupport (= 3.2.18) - rack-ssl (~> 1.3.2) + rails (4.0.13) + actionmailer (= 4.0.13) + actionpack (= 4.0.13) + activerecord (= 4.0.13) + activesupport (= 4.0.13) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.13) + sprockets-rails (~> 2.0) + rails-observers (0.1.2) + activemodel (~> 4.0) + railties (4.0.13) + actionpack (= 4.0.13) + activesupport (= 4.0.13) rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.3.2) + thor (>= 0.18.1, < 2.0) + rake (10.4.2) rb-fsevent (0.9.4) rb-inotify (0.9.5) ffi (>= 0.5.0) - rdoc (3.12.2) - json (~> 1.4) - redcarpet (3.2.2) - redis (3.1.0) - redis-namespace (1.5.1) + redcarpet (3.2.3) + redis (3.2.1) + redis-namespace (1.5.2) redis (~> 3.0, >= 3.0.4) - rspec (3.0.0) - rspec-core (~> 3.0.0) - rspec-expectations (~> 3.0.0) - rspec-mocks (~> 3.0.0) - rspec-core (3.0.0) - rspec-support (~> 3.0.0) - rspec-expectations (3.0.0) + rspec (3.2.0) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-core (3.2.3) + rspec-support (~> 3.2.0) + rspec-expectations (3.2.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.0.0) - rspec-mocks (3.0.1) - rspec-support (~> 3.0.0) - rspec-rails (3.0.1) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.0.0) - rspec-expectations (~> 3.0.0) - rspec-mocks (~> 3.0.0) - rspec-support (~> 3.0.0) - rspec-support (3.0.0) + rspec-support (~> 3.2.0) + rspec-mocks (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-rails (3.2.1) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-support (~> 3.2.0) + rspec-support (3.2.2) + shellany (0.0.1) sidekiq (2.17.8) celluloid (= 0.15.2) connection_pool (~> 2.0) json redis (~> 3.1) redis-namespace (~> 1.3) - simplecov (0.8.2) + simplecov (0.9.2) docile (~> 1.1.0) - multi_json - simplecov-html (~> 0.8.0) - simplecov-html (0.8.0) - slop (3.5.0) - spring (1.1.3) - spring-commands-rspec (1.0.2) + multi_json (~> 1.0) + simplecov-html (~> 0.9.0) + simplecov-html (0.9.0) + slop (3.6.0) + spring (1.3.4) + spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (2.2.2) + sprockets (2.12.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.9) + sprockets-rails (2.2.4) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (>= 2.8, < 4.0) + sqlite3 (1.3.10) thor (0.19.1) + thread_safe (0.3.5) tilt (1.4.1) - timecop (0.7.1) + timecop (0.7.3) timers (1.1.0) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.41) + tzinfo (0.3.43) yard (0.8.7.6) PLATFORMS ruby DEPENDENCIES + activeresource database_cleaner debugger factory_girl_rails diff --git a/app/models/maily_herald/periodical_mailing.rb b/app/models/maily_herald/periodical_mailing.rb index 3c64634..8e9bfca 100644 --- a/app/models/maily_herald/periodical_mailing.rb +++ b/app/models/maily_herald/periodical_mailing.rb @@ -46,7 +46,7 @@ def run if schedule.entity deliver_to schedule.entity else - MailyHerald.logger.log_processing(schedule.mailing, {:class => schedule.entity_type, :id => schedule.entity_id}, prefix: "Removing schedule for non-existing entity") + MailyHerald.logger.log_processing(schedule.mailing, {class: schedule.entity_type, id: schedule.entity_id}, prefix: "Removing schedule for non-existing entity") schedule.destroy end end diff --git a/app/models/maily_herald/sequence.rb b/app/models/maily_herald/sequence.rb index 5646824..229ff15 100644 --- a/app/models/maily_herald/sequence.rb +++ b/app/models/maily_herald/sequence.rb @@ -54,7 +54,7 @@ def run if schedule.entity schedule.mailing.deliver_to schedule.entity else - MailyHerald.logger.log_processing(schedule.mailing, {:class => schedule.entity_type, :id => schedule.entity_id}, prefix: "Removing schedule for non-existing entity") + MailyHerald.logger.log_processing(schedule.mailing, {class: schedule.entity_type, id: schedule.entity_id}, prefix: "Removing schedule for non-existing entity") schedule.destroy end end diff --git a/maily_herald.gemspec b/maily_herald.gemspec index 88067d1..c61a491 100644 --- a/maily_herald.gemspec +++ b/maily_herald.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |s| s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) } s.test_files = `git ls-files -- {spec,features}/**/`.split("\n") - s.add_dependency "rails", "> 3.2" + s.add_dependency "rails", "~> 4.0.0" s.add_dependency "liquid", "~> 2.6.1" s.add_dependency "sidekiq", "~> 2.17.8" diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb index 078e758..b5bca8e 100644 --- a/spec/dummy/config/environments/test.rb +++ b/spec/dummy/config/environments/test.rb @@ -28,7 +28,7 @@ # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - ActionMailer::Base.default :from => "no-reply@foo.com>" + ActionMailer::Base.default from: "no-reply@foo.com>" # Raise exception on mass assignment protection for Active Record models config.active_record.mass_assignment_sanitizer = :strict diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index 3fcb124..5aa9b62 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -9,74 +9,74 @@ # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # -# It's strongly recommended to check this file into your version control system. +# It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150205120443) do +ActiveRecord::Schema.define(version: 20150205120443) do - create_table "maily_herald_dispatches", :force => true do |t| - t.string "type", :null => false + create_table "maily_herald_dispatches", force: true do |t| + t.string "type", null: false t.integer "sequence_id" - t.integer "list_id", :null => false + t.integer "list_id", null: false t.text "conditions" t.text "start_at" t.string "mailer_name" - t.string "name", :null => false + t.string "name", null: false t.string "title" t.string "subject" t.string "from" - t.string "state", :default => "disabled" + t.string "state", default: "disabled" t.text "template" t.integer "absolute_delay" t.integer "period" t.boolean "override_subscription" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end - add_index "maily_herald_dispatches", ["name"], :name => "index_maily_herald_dispatches_on_name", :unique => true + add_index "maily_herald_dispatches", ["name"], name: "index_maily_herald_dispatches_on_name", unique: true - create_table "maily_herald_lists", :force => true do |t| - t.string "name", :null => false + create_table "maily_herald_lists", force: true do |t| + t.string "name", null: false t.string "title" t.string "context_name" end - create_table "maily_herald_logs", :force => true do |t| - t.integer "entity_id", :null => false - t.string "entity_type", :null => false + create_table "maily_herald_logs", force: true do |t| + t.integer "entity_id", null: false + t.string "entity_type", null: false t.string "entity_email" t.integer "mailing_id" - t.string "status", :null => false + t.string "status", null: false t.text "data" t.datetime "processing_at" end - create_table "maily_herald_subscriptions", :force => true do |t| - t.integer "entity_id", :null => false - t.integer "list_id", :null => false - t.string "entity_type", :null => false - t.string "token", :null => false + create_table "maily_herald_subscriptions", force: true do |t| + t.integer "entity_id", null: false + t.integer "list_id", null: false + t.string "entity_type", null: false + t.string "token", null: false t.text "settings" t.text "data" - t.boolean "active", :default => false, :null => false + t.boolean "active", default: false, null: false t.datetime "delivered_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end - create_table "products", :force => true do |t| + create_table "products", force: true do |t| t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end - create_table "users", :force => true do |t| + create_table "users", force: true do |t| t.string "name" t.string "email" - t.boolean "weekly_notifications", :default => true - t.boolean "active", :default => true - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.boolean "weekly_notifications", default: true + t.boolean "active", default: true + t.datetime "created_at" + t.datetime "updated_at" end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb new file mode 100644 index 0000000..ae56d53 --- /dev/null +++ b/spec/rails_helper.rb @@ -0,0 +1,50 @@ +# This file is copied to spec/ when you run 'rails generate rspec:install' +ENV['RAILS_ENV'] ||= 'test' +require 'spec_helper' +require File.expand_path('../../config/environment', __FILE__) +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 migrations 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! +end