Remove rails 4 support
This commit is contained in:
parent
2468cc74a5
commit
4b4375cf78
14 changed files with 13 additions and 328 deletions
|
|
@ -207,8 +207,3 @@ Layout/IndentHeredoc:
|
|||
Enabled: false
|
||||
Layout/ClosingHeredocIndentation:
|
||||
Enabled: false
|
||||
|
||||
# for rails 4 and ruby < 2.2.2
|
||||
Rails/HttpPositionalArguments:
|
||||
Exclude:
|
||||
- "spec/controllers/diaspora_federation/rails4_spec.rb"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ rvm:
|
|||
- 2.1
|
||||
gemfile:
|
||||
- Gemfile
|
||||
- test/gemfiles/rails4.Gemfile
|
||||
- test/gemfiles/no-rails.Gemfile
|
||||
|
||||
matrix:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ PATH
|
|||
valid (~> 1.0)
|
||||
diaspora_federation-json_schema (0.2.6)
|
||||
diaspora_federation-rails (0.2.6)
|
||||
actionpack (>= 4.2, < 6)
|
||||
actionpack (>= 5, < 6)
|
||||
diaspora_federation (= 0.2.6)
|
||||
diaspora_federation-test (0.2.6)
|
||||
diaspora_federation (= 0.2.6)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.required_ruby_version = "~> 2.1"
|
||||
|
||||
s.add_dependency "actionpack", ">= 4.2", "< 6"
|
||||
s.add_dependency "actionpack", ">= 5", "< 6"
|
||||
|
||||
s.add_dependency "diaspora_federation", DiasporaFederation::VERSION
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
namespace :gemfiles do
|
||||
desc "Generates rails4.Gemfile and no-rails.Gemfile"
|
||||
desc "Generates no-rails.Gemfile"
|
||||
task :generate do
|
||||
FileUtils.mkdir_p("test/gemfiles")
|
||||
FileUtils.rm(Dir["test/gemfiles/*.Gemfile.lock"])
|
||||
|
|
@ -10,11 +10,6 @@ namespace :gemfiles do
|
|||
original_gemfile.sub!(/^group :development do$.*?^end$\n\n/m, "")
|
||||
original_gemfile << "\n gem \"fabrication\", \"< 2.17.0\"\n" # new versions are not compatible with ruby 2.1
|
||||
|
||||
rails4_version = "4.2.8"
|
||||
rails4_gemfile = "#{original_gemfile}\ngem \"actionpack\", \"#{rails4_version}\"\n"
|
||||
rails4_path = "test/gemfiles/rails4.Gemfile"
|
||||
File.write(rails4_path, rails4_gemfile)
|
||||
|
||||
no_rails_gemfile = original_gemfile.dup
|
||||
no_rails_gemfile.sub!(/(gemspec\(name:.*)/) { "#{Regexp.last_match[1]} unless plugin == \"rails\"" }
|
||||
no_rails_gemfile.sub!(/^.*rspec-rails.*$\n/, "")
|
||||
|
|
@ -22,7 +17,6 @@ namespace :gemfiles do
|
|||
File.write(no_rails_path, no_rails_gemfile)
|
||||
|
||||
Bundler.with_clean_env do
|
||||
system("BUNDLE_GEMFILE=#{rails4_path} bundle install")
|
||||
system("BUNDLE_GEMFILE=#{no_rails_path} bundle install")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
module DiasporaFederation
|
||||
describe FetchController, type: :controller, rails: 5 do
|
||||
describe FetchController, type: :controller do
|
||||
routes { DiasporaFederation::Engine.routes }
|
||||
|
||||
let(:guid) { "12345678901234567890" }
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
module DiasporaFederation
|
||||
describe HCardController, type: :controller, rails: 5 do
|
||||
describe HCardController, type: :controller do
|
||||
routes { DiasporaFederation::Engine.routes }
|
||||
|
||||
describe "GET #hcard" do
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
# only some basic controller tests for rails 4
|
||||
module DiasporaFederation
|
||||
describe WebfingerController, type: :controller, rails: 4 do
|
||||
routes { DiasporaFederation::Engine.routes }
|
||||
|
||||
it "contains the webfinger result" do
|
||||
webfinger_xrd = DiasporaFederation::Discovery::WebFinger.new(
|
||||
acct_uri: "acct:#{alice.diaspora_id}",
|
||||
alias_url: alice.alias_url,
|
||||
hcard_url: alice.hcard_url,
|
||||
seed_url: alice.url,
|
||||
profile_url: alice.profile_url,
|
||||
atom_url: alice.atom_url,
|
||||
salmon_url: alice.salmon_url,
|
||||
subscribe_url: alice.subscribe_url,
|
||||
guid: alice.guid,
|
||||
public_key: alice.serialized_public_key
|
||||
).to_xml
|
||||
|
||||
get :webfinger, format: :xml, resource: alice.diaspora_id
|
||||
expect(response).to be_success
|
||||
expect(response.body).to eq(webfinger_xrd)
|
||||
end
|
||||
|
||||
it "404s when the person does not exist" do
|
||||
get :webfinger, format: :xml, resource: "me@mydiaspora.pod.com"
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
end
|
||||
|
||||
describe HCardController, type: :controller, rails: 4 do
|
||||
routes { DiasporaFederation::Engine.routes }
|
||||
|
||||
it "contains the hcard result" do
|
||||
hcard_html = DiasporaFederation::Discovery::HCard.new(
|
||||
guid: alice.guid,
|
||||
nickname: alice.nickname,
|
||||
full_name: alice.full_name,
|
||||
url: alice.url,
|
||||
photo_large_url: alice.photo_default_url,
|
||||
photo_medium_url: alice.photo_default_url,
|
||||
photo_small_url: alice.photo_default_url,
|
||||
public_key: alice.serialized_public_key,
|
||||
searchable: alice.searchable,
|
||||
first_name: alice.first_name,
|
||||
last_name: alice.last_name
|
||||
).to_html
|
||||
|
||||
get :hcard, guid: alice.guid
|
||||
expect(response).to be_success
|
||||
expect(response.body).to eq(hcard_html)
|
||||
end
|
||||
|
||||
it "404s when the person does not exist" do
|
||||
get :hcard, guid: "unknown_guid"
|
||||
expect(response).to be_not_found
|
||||
end
|
||||
end
|
||||
|
||||
describe ReceiveController, type: :controller, rails: 4 do
|
||||
routes { DiasporaFederation::Engine.routes }
|
||||
|
||||
describe "POST #public" do
|
||||
it "returns a 202 if queued correctly" do
|
||||
expect_callback(:queue_public_receive, "<diaspora/>", true)
|
||||
|
||||
post :public, xml: "<diaspora/>"
|
||||
expect(response.code).to eq("202")
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST #private" do
|
||||
it "returns a 202 if the callback returned true" do
|
||||
expect_callback(:queue_private_receive, "any-guid", "<diaspora/>", true).and_return(true)
|
||||
|
||||
post :private, guid: "any-guid", xml: "<diaspora/>"
|
||||
expect(response.code).to eq("202")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -15,21 +15,21 @@ module DiasporaFederation
|
|||
expect(response.code).to eq("422")
|
||||
end
|
||||
|
||||
it "returns a 202 if queued correctly", rails: 5 do
|
||||
it "returns a 202 if queued correctly" do
|
||||
expect_callback(:queue_public_receive, "<diaspora/>", true)
|
||||
|
||||
post :public, params: {xml: "<diaspora/>"}
|
||||
expect(response.code).to eq("202")
|
||||
end
|
||||
|
||||
it "unescapes the xml before sending it to the callback", rails: 5 do
|
||||
it "unescapes the xml before sending it to the callback" do
|
||||
expect_callback(:queue_public_receive, "<diaspora/>", true)
|
||||
|
||||
post :public, params: {xml: CGI.escape("<diaspora/>")}
|
||||
end
|
||||
end
|
||||
|
||||
context "magic envelope", rails: 5 do
|
||||
context "magic envelope" do
|
||||
before do
|
||||
Mime::Type.register("application/magic-envelope+xml", :magic_envelope)
|
||||
@request.env["CONTENT_TYPE"] = "application/magic-envelope+xml"
|
||||
|
|
@ -44,7 +44,7 @@ module DiasporaFederation
|
|||
end
|
||||
end
|
||||
|
||||
describe "POST #private", rails: 5 do
|
||||
describe "POST #private" do
|
||||
context "legacy salmon slap" do
|
||||
it "return a 404 if not queued successfully (unknown user guid)" do
|
||||
expect_callback(:queue_private_receive, "any-guid", "<diaspora/>", true).and_return(false)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ module DiasporaFederation
|
|||
end
|
||||
end
|
||||
|
||||
describe "GET #webfinger", rails: 5 do
|
||||
describe "GET #webfinger" do
|
||||
it "uses the JRD format as default" do
|
||||
get :webfinger, params: {resource: alice.diaspora_id}
|
||||
expect(response).to be_successful
|
||||
|
|
|
|||
|
|
@ -52,9 +52,7 @@ RSpec.configure do |config|
|
|||
expect_config.syntax = :expect
|
||||
end
|
||||
|
||||
if defined?(::Rails)
|
||||
config.filter_run_excluding rails: (::Rails::VERSION::MAJOR == 5 ? 4 : 5)
|
||||
else
|
||||
unless defined?(::Rails)
|
||||
config.exclude_pattern = "**/controllers/**/*_spec.rb, **/routing/**/*_spec.rb"
|
||||
config.filter_run_excluding rails: true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,13 +13,8 @@ Rails.application.configure do
|
|||
config.eager_load = false
|
||||
|
||||
# Configure static file server for tests with Cache-Control for performance.
|
||||
if Rails::VERSION::MAJOR == 5
|
||||
config.public_file_server.enable = true
|
||||
config.public_file_server.headers = {"Cache-Control" => "public, max-age=3600"}
|
||||
else
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
end
|
||||
config.public_file_server.enable = true
|
||||
config.public_file_server.headers = {"Cache-Control" => "public, max-age=3600"}
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
# Declare your gem's dependencies in diaspora_federation.gemspec.
|
||||
# Bundler will treat runtime dependencies like base dependencies, and
|
||||
# development dependencies will be added by default to the :development group.
|
||||
gemspec name: "diaspora_federation", path: "../../"
|
||||
|
||||
Dir["diaspora_federation-*.gemspec"].each do |gemspec|
|
||||
plugin = gemspec.scan(/diaspora_federation-(.*)\.gemspec/).flatten.first
|
||||
gemspec(name: "diaspora_federation-#{plugin}", development_group: plugin, path: "../../")
|
||||
end
|
||||
|
||||
# Declare any dependencies that are still in development here instead of in
|
||||
# your gemspec. These might include edge Rails or gems from your path or
|
||||
# Git. Remember to move these dependencies to your gemspec before releasing
|
||||
# your gem to rubygems.org.
|
||||
|
||||
group :test do
|
||||
# rspec formatter
|
||||
gem "fuubar", "2.3.2", require: false
|
||||
gem "nyan-cat-formatter", require: false
|
||||
|
||||
# test coverage
|
||||
gem "simplecov", "0.16.1", require: false
|
||||
gem "simplecov-rcov", "0.2.3", require: false
|
||||
|
||||
# test helpers
|
||||
gem "json-schema-rspec", "0.0.4"
|
||||
gem "rspec-collection_matchers", "~> 1.1.2"
|
||||
gem "rspec-json_expectations", "~> 2.1"
|
||||
gem "webmock", "~> 3.0"
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
gem "rake"
|
||||
|
||||
# unit tests
|
||||
gem "rspec", "~> 3.8.0"
|
||||
gem "rspec-rails", "~> 3.8.0"
|
||||
end
|
||||
|
||||
gem "fabrication", "< 2.17.0"
|
||||
|
||||
gem "actionpack", "4.2.8"
|
||||
|
|
@ -1,171 +0,0 @@
|
|||
PATH
|
||||
remote: ../..
|
||||
specs:
|
||||
diaspora_federation (0.2.6)
|
||||
faraday (>= 0.9.0, < 0.16.0)
|
||||
faraday_middleware (>= 0.10.0, < 0.14.0)
|
||||
nokogiri (~> 1.6, >= 1.6.8)
|
||||
typhoeus (~> 1.0)
|
||||
valid (~> 1.0)
|
||||
diaspora_federation-json_schema (0.2.6)
|
||||
diaspora_federation-rails (0.2.6)
|
||||
actionpack (>= 4.2, < 6)
|
||||
diaspora_federation (= 0.2.6)
|
||||
diaspora_federation-test (0.2.6)
|
||||
diaspora_federation (= 0.2.6)
|
||||
fabrication (~> 2.16)
|
||||
uuid (~> 2.3, >= 2.3.8)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionpack (4.2.8)
|
||||
actionview (= 4.2.8)
|
||||
activesupport (= 4.2.8)
|
||||
rack (~> 1.6)
|
||||
rack-test (~> 0.6.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (4.2.8)
|
||||
activesupport (= 4.2.8)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
activesupport (4.2.8)
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.6.0)
|
||||
public_suffix (>= 2.0.2, < 4.0)
|
||||
builder (3.2.3)
|
||||
concurrent-ruby (1.1.5)
|
||||
crack (0.4.3)
|
||||
safe_yaml (~> 1.0.0)
|
||||
crass (1.0.4)
|
||||
diff-lcs (1.3)
|
||||
docile (1.3.1)
|
||||
erubis (2.7.0)
|
||||
ethon (0.12.0)
|
||||
ffi (>= 1.3.0)
|
||||
fabrication (2.16.3)
|
||||
faraday (0.15.4)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday_middleware (0.13.1)
|
||||
faraday (>= 0.7.4, < 1.0)
|
||||
ffi (1.10.0)
|
||||
fuubar (2.3.2)
|
||||
rspec-core (~> 3.0)
|
||||
ruby-progressbar (~> 1.4)
|
||||
hashdiff (0.3.8)
|
||||
i18n (0.9.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
json (2.2.0)
|
||||
json-schema (2.8.1)
|
||||
addressable (>= 2.4)
|
||||
json-schema-rspec (0.0.4)
|
||||
json-schema (~> 2.5)
|
||||
rspec
|
||||
loofah (2.2.3)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
macaddr (1.7.1)
|
||||
systemu (~> 2.6.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.11.3)
|
||||
multipart-post (2.0.0)
|
||||
nokogiri (1.9.1)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
nyan-cat-formatter (0.12.0)
|
||||
rspec (>= 2.99, >= 2.14.2, < 4)
|
||||
public_suffix (3.0.3)
|
||||
rack (1.6.11)
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.9)
|
||||
activesupport (>= 4.2.0, < 5.0)
|
||||
nokogiri (~> 1.6)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.0.4)
|
||||
loofah (~> 2.2, >= 2.2.2)
|
||||
railties (4.2.8)
|
||||
actionpack (= 4.2.8)
|
||||
activesupport (= 4.2.8)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (12.3.2)
|
||||
rspec (3.8.0)
|
||||
rspec-core (~> 3.8.0)
|
||||
rspec-expectations (~> 3.8.0)
|
||||
rspec-mocks (~> 3.8.0)
|
||||
rspec-collection_matchers (1.1.3)
|
||||
rspec-expectations (>= 2.99.0.beta1)
|
||||
rspec-core (3.8.0)
|
||||
rspec-support (~> 3.8.0)
|
||||
rspec-expectations (3.8.2)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.8.0)
|
||||
rspec-json_expectations (2.1.0)
|
||||
rspec-mocks (3.8.0)
|
||||
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.0)
|
||||
ruby-progressbar (1.10.0)
|
||||
safe_yaml (1.0.5)
|
||||
simplecov (0.16.1)
|
||||
docile (~> 1.1)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
simplecov-rcov (0.2.3)
|
||||
simplecov (>= 0.4.1)
|
||||
systemu (2.6.5)
|
||||
thor (0.20.3)
|
||||
thread_safe (0.3.6)
|
||||
typhoeus (1.3.1)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (1.2.5)
|
||||
thread_safe (~> 0.1)
|
||||
uuid (2.3.9)
|
||||
macaddr (~> 1.0)
|
||||
valid (1.2.0)
|
||||
webmock (3.5.1)
|
||||
addressable (>= 2.3.6)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
actionpack (= 4.2.8)
|
||||
diaspora_federation!
|
||||
diaspora_federation-json_schema!
|
||||
diaspora_federation-rails!
|
||||
diaspora_federation-test!
|
||||
fabrication (< 2.17.0)
|
||||
fuubar (= 2.3.2)
|
||||
json-schema-rspec (= 0.0.4)
|
||||
nyan-cat-formatter
|
||||
rake
|
||||
rspec (~> 3.8.0)
|
||||
rspec-collection_matchers (~> 1.1.2)
|
||||
rspec-json_expectations (~> 2.1)
|
||||
rspec-rails (~> 3.8.0)
|
||||
simplecov (= 0.16.1)
|
||||
simplecov-rcov (= 0.2.3)
|
||||
webmock (~> 3.0)
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
Loading…
Reference in a new issue