diff --git a/spec/draper/collection_decorator_spec.rb b/spec/draper/collection_decorator_spec.rb index 129ec68..0ef99ef 100644 --- a/spec/draper/collection_decorator_spec.rb +++ b/spec/draper/collection_decorator_spec.rb @@ -76,7 +76,7 @@ describe Draper::CollectionDecorator do end it "raises error on invalid options" do - expect { Draper::CollectionDecorator.new(source, valid_options.merge(foo: 'bar')) }.to raise_error(ArgumentError, 'Unknown key: foo') + expect { Draper::CollectionDecorator.new(source, valid_options.merge(foo: 'bar')) }.to raise_error(ArgumentError, /Unknown key/) end end end diff --git a/spec/draper/decorated_association_spec.rb b/spec/draper/decorated_association_spec.rb index 090b25f..3d4e730 100644 --- a/spec/draper/decorated_association_spec.rb +++ b/spec/draper/decorated_association_spec.rb @@ -15,7 +15,7 @@ describe Draper::DecoratedAssociation do end it "raises error on invalid options" do - expect { Draper::DecoratedAssociation.new(owner, :association, valid_options.merge(foo: 'bar')) }.to raise_error(ArgumentError, 'Unknown key: foo') + expect { Draper::DecoratedAssociation.new(owner, :association, valid_options.merge(foo: 'bar')) }.to raise_error(ArgumentError, /Unknown key/) end end end diff --git a/spec/draper/decorator_spec.rb b/spec/draper/decorator_spec.rb index 83aaae5..217416e 100755 --- a/spec/draper/decorator_spec.rb +++ b/spec/draper/decorator_spec.rb @@ -15,7 +15,7 @@ describe Draper::Decorator do end it "raises error on invalid options" do - expect { decorator_class.new(source, valid_options.merge(foo: 'bar')) }.to raise_error(ArgumentError, 'Unknown key: foo') + expect { decorator_class.new(source, valid_options.merge(foo: 'bar')) }.to raise_error(ArgumentError, /Unknown key/) end end @@ -87,7 +87,7 @@ describe Draper::Decorator do end it "raises error on invalid options" do - expect { ProductDecorator.decorate_collection(source, valid_options.merge(foo: 'bar')) }.to raise_error(ArgumentError, 'Unknown key: foo') + expect { ProductDecorator.decorate_collection(source, valid_options.merge(foo: 'bar')) }.to raise_error(ArgumentError, /Unknown key/) end end @@ -272,7 +272,7 @@ describe Draper::Decorator do end it "raises error on invalid options" do - expect { decorator_class.decorates_association :similar_products, valid_options.merge(foo: 'bar') }.to raise_error(ArgumentError, 'Unknown key: foo') + expect { decorator_class.decorates_association :similar_products, valid_options.merge(foo: 'bar') }.to raise_error(ArgumentError, /Unknown key/) end end diff --git a/spec/dummy/app/controllers/localized_urls.rb b/spec/dummy/app/controllers/localized_urls.rb index 1fd349e..9d9b35d 100644 --- a/spec/dummy/app/controllers/localized_urls.rb +++ b/spec/dummy/app/controllers/localized_urls.rb @@ -1,5 +1,5 @@ module LocalizedUrls def default_url_options(options = {}) - {locale: I18n.locale, host: "www.example.com", port: nil} + {locale: I18n.locale, host: "www.example.com", port: 12345} end end diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index 6c219a8..9d218ba 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -47,13 +47,13 @@ module Dummy # This will create an empty whitelist of attributes available for mass-assignment for all models # in your app. As such, your models will need to explicitly whitelist or blacklist accessible # parameters by using an attr_accessible or attr_protected declaration. - config.active_record.whitelist_attributes = true + # config.active_record.whitelist_attributes = true # Enable the asset pipeline - config.assets.enabled = true + # config.assets.enabled = true # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' + # config.assets.version = '1.0' # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the diff --git a/spec/dummy/config/environments/development.rb b/spec/dummy/config/environments/development.rb index e58bfbb..d707335 100644 --- a/spec/dummy/config/environments/development.rb +++ b/spec/dummy/config/environments/development.rb @@ -20,15 +20,15 @@ Dummy::Application.configure do config.action_dispatch.best_standards_support = :builtin # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict + # config.active_record.mass_assignment_sanitizer = :strict # Log the query plan for queries taking more than this (works # with SQLite, MySQL, and PostgreSQL) - config.active_record.auto_explain_threshold_in_seconds = 0.5 + # config.active_record.auto_explain_threshold_in_seconds = 0.5 # Do not compress assets - config.assets.compress = false + # config.assets.compress = false # Expands the lines which load the assets - config.assets.debug = true + # config.assets.debug = true end diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb index 0adb49d..968336c 100644 --- a/spec/dummy/config/environments/test.rb +++ b/spec/dummy/config/environments/test.rb @@ -8,7 +8,7 @@ Dummy::Application.configure do config.cache_classes = true # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true + # config.serve_static_assets = true config.static_cache_control = "public, max-age=3600" # Log error messages when you accidentally call methods on nil @@ -25,7 +25,7 @@ Dummy::Application.configure do config.action_controller.allow_forgery_protection = false # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict + # config.active_record.mass_assignment_sanitizer = :strict # Print deprecation notices to the stderr config.active_support.deprecation = :stderr diff --git a/spec/dummy/config/initializers/wrap_parameters.rb b/spec/dummy/config/initializers/wrap_parameters.rb deleted file mode 100644 index 999df20..0000000 --- a/spec/dummy/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] -end - -# Disable root element in JSON by default. -ActiveSupport.on_load(:active_record) do - self.include_root_in_json = false -end diff --git a/spec/dummy/spec/decorators/post_decorator_spec.rb b/spec/dummy/spec/decorators/post_decorator_spec.rb index 4817997..ea8f41c 100755 --- a/spec/dummy/spec/decorators/post_decorator_spec.rb +++ b/spec/dummy/spec/decorators/post_decorator_spec.rb @@ -13,11 +13,11 @@ describe PostDecorator do end it "can use url helpers with its model" do - subject.url_with_model.should == "http://www.example.com/en/posts/#{source.id}" + subject.url_with_model.should == "http://www.example.com:12345/en/posts/#{source.id}" end it "can use url helpers with its id" do - subject.url_with_id.should == "http://www.example.com/en/posts/#{source.id}" + subject.url_with_id.should == "http://www.example.com:12345/en/posts/#{source.id}" end it "can be passed implicitly to url_for" do diff --git a/spec/dummy/spec/mailers/post_mailer_spec.rb b/spec/dummy/spec/mailers/post_mailer_spec.rb index 2e435ba..13cc97d 100644 --- a/spec/dummy/spec/mailers/post_mailer_spec.rb +++ b/spec/dummy/spec/mailers/post_mailer_spec.rb @@ -19,11 +19,11 @@ describe PostMailer do end it "can use url helpers with a model" do - subject.should have_css "#url_with_model", text: "http://www.example.com/en/posts/#{post.id}" + subject.should have_css "#url_with_model", text: "http://www.example.com:12345/en/posts/#{post.id}" end it "can use url helpers with an id" do - subject.should have_css "#url_with_id", text: "http://www.example.com/en/posts/#{post.id}" + subject.should have_css "#url_with_id", text: "http://www.example.com:12345/en/posts/#{post.id}" end end end diff --git a/spec/dummy/spec/models/post_spec.rb b/spec/dummy/spec/models/post_spec.rb index 7533f04..44aefdb 100644 --- a/spec/dummy/spec/models/post_spec.rb +++ b/spec/dummy/spec/models/post_spec.rb @@ -6,6 +6,7 @@ describe Post do subject { Post.first } it "is true for other instances' decorators" do + pending if Rails.version.start_with?("3.0") other = Post.first subject.should_not be other (subject == other.decorate).should be_true diff --git a/spec/integration/integration_spec.rb b/spec/integration/integration_spec.rb index b18846b..5ffa0c8 100644 --- a/spec/integration/integration_spec.rb +++ b/spec/integration/integration_spec.rb @@ -22,11 +22,11 @@ app.start_server do end it "can use url helpers with a model" do - page.should have_text("http://www.example.com/en/posts/1").in("#url_with_model") + page.should have_text("http://www.example.com:12345/en/posts/1").in("#url_with_model") end it "can use url helpers with an id" do - page.should have_text("http://www.example.com/en/posts/1").in("#url_with_id") + page.should have_text("http://www.example.com:12345/en/posts/1").in("#url_with_id") end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f3a610f..ac0ef90 100755 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -27,7 +27,3 @@ require 'support/decorators/specific_product_decorator' require 'support/decorators/products_decorator' require 'support/decorators/some_thing_decorator' require 'support/decorators/decorator_with_application_helper' - -class << Rails - undef application # Avoid silly Rails bug: https://github.com/rails/rails/pull/6429 -end