-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
1,153 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ GEMS = %i[ | |
core | ||
data | ||
presenter | ||
assets | ||
mailer | ||
rake | ||
test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--require ../spec/spec_config | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
require "pakyow" | ||
require "pakyow/core" | ||
require "pakyow/support" | ||
require "pakyow/presenter" | ||
|
||
require "pakyow/assets/framework" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ def load | |
end | ||
end | ||
|
||
processable | ||
extension :es6 | ||
emits :js | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ def load | |
end | ||
end | ||
|
||
processable | ||
extension :sass | ||
emits :css | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
RSpec.describe "setting cache headers" do | ||
include_context "testable app" | ||
|
||
context "cache is enabled" do | ||
let :app_definition do | ||
Proc.new do | ||
instance_exec(&$assets_app_boilerplate) | ||
config.assets.cache = true | ||
end | ||
end | ||
|
||
context "requested file is public, but not an asset" do | ||
it "responds 200" do | ||
expect(call("/robots.txt")[0]).to eq(200) | ||
end | ||
|
||
it "does not respond with cache headers" do | ||
expect(call("/robots.txt")[1]).to eq("Content-Type" => "text/plain") | ||
end | ||
end | ||
|
||
context "requested file is public, and is an asset" do | ||
it "responds 200" do | ||
expect(call("/assets/cache/default.css")[0]).to eq(200) | ||
end | ||
|
||
it "responds with cache headers" do | ||
headers = call("/assets/cache/default.css")[1] | ||
expect(headers["Cache-Control"]).to eq("public, max-age=31536000") | ||
expect(headers["Vary"]).to eq("Accept-Encoding") | ||
expect(headers["Last-Modified"]).to_not be_nil | ||
expect(headers["Age"]).to_not be_nil | ||
end | ||
end | ||
end | ||
|
||
context "cache is disabled" do | ||
let :app_definition do | ||
Proc.new do | ||
instance_exec(&$assets_app_boilerplate) | ||
config.assets.cache = false | ||
end | ||
end | ||
|
||
context "requested file is public, but not an asset" do | ||
it "responds 200" do | ||
expect(call("/robots.txt")[0]).to eq(200) | ||
end | ||
|
||
it "does not respond with cache headers" do | ||
expect(call("/robots.txt")[1]).to eq("Content-Type" => "text/plain") | ||
end | ||
end | ||
|
||
context "requested file is public, and is an asset" do | ||
it "responds 200" do | ||
expect(call("/assets/cache/default.css")[0]).to eq(200) | ||
end | ||
|
||
it "does not respond with cache headers" do | ||
headers = call("/assets/cache/default.css")[1] | ||
expect(headers["Cache-Control"]).to be_nil | ||
expect(headers["Vary"]).to be_nil | ||
expect(headers["Last-Modified"]).to be_nil | ||
expect(headers["Age"]).to be_nil | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# TODO: test that load errors generated by types are handled | ||
# maybe abstract this so that types don't have to implement themselves |
18 changes: 18 additions & 0 deletions
18
pakyow-assets/spec/features/failures/missing_pack_warning_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
RSpec.describe "missing asset pack warning" do | ||
include_context "testable app" | ||
|
||
let :app_definition do | ||
Proc.new do | ||
instance_exec(&$assets_app_boilerplate) | ||
config.assets.autoloaded_packs = [:nonexistent] | ||
end | ||
end | ||
|
||
it "logs a warning" do | ||
expect_any_instance_of(Pakyow::Logger::RequestLogger).to receive(:warn) do |_, message| | ||
expect(message).to eq("Could not find pack `nonexistent'") | ||
end | ||
|
||
call("/packs/autoload") | ||
end | ||
end |
Oops, something went wrong.