mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Allow running specs from any directory (#609)
This commit is contained in:
parent
d237d3ef7d
commit
926206a46c
2 changed files with 8 additions and 8 deletions
|
@ -100,7 +100,7 @@ describe "Macros" do
|
||||||
describe "#send_file" do
|
describe "#send_file" do
|
||||||
it "sends file with given path and default mime-type" do
|
it "sends file with given path and default mime-type" do
|
||||||
get "/" do |env|
|
get "/" do |env|
|
||||||
send_file env, "./spec/asset/hello.ecr"
|
send_file env, "#{__DIR__}/asset/hello.ecr"
|
||||||
end
|
end
|
||||||
|
|
||||||
request = HTTP::Request.new("GET", "/")
|
request = HTTP::Request.new("GET", "/")
|
||||||
|
@ -112,7 +112,7 @@ describe "Macros" do
|
||||||
|
|
||||||
it "sends file with given path and given mime-type" do
|
it "sends file with given path and given mime-type" do
|
||||||
get "/" do |env|
|
get "/" do |env|
|
||||||
send_file env, "./spec/asset/hello.ecr", "image/jpeg"
|
send_file env, "#{__DIR__}/asset/hello.ecr", "image/jpeg"
|
||||||
end
|
end
|
||||||
|
|
||||||
request = HTTP::Request.new("GET", "/")
|
request = HTTP::Request.new("GET", "/")
|
||||||
|
@ -136,7 +136,7 @@ describe "Macros" do
|
||||||
|
|
||||||
it "sends file with given path and given filename" do
|
it "sends file with given path and given filename" do
|
||||||
get "/" do |env|
|
get "/" do |env|
|
||||||
send_file env, "./spec/asset/hello.ecr", filename: "image.jpg"
|
send_file env, "#{__DIR__}/asset/hello.ecr", filename: "image.jpg"
|
||||||
end
|
end
|
||||||
|
|
||||||
request = HTTP::Request.new("GET", "/")
|
request = HTTP::Request.new("GET", "/")
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
require "./spec_helper"
|
require "./spec_helper"
|
||||||
|
|
||||||
macro render_with_base_and_layout(filename)
|
macro render_with_base_and_layout(filename)
|
||||||
render "spec/asset/#{{{filename}}}", "spec/asset/layout.ecr"
|
render "#{__DIR__}/asset/#{{{filename}}}", "#{__DIR__}/asset/layout.ecr"
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Views" do
|
describe "Views" do
|
||||||
it "renders file" do
|
it "renders file" do
|
||||||
get "/view/:name" do |env|
|
get "/view/:name" do |env|
|
||||||
name = env.params.url["name"]
|
name = env.params.url["name"]
|
||||||
render "spec/asset/hello.ecr"
|
render "#{__DIR__}/asset/hello.ecr"
|
||||||
end
|
end
|
||||||
request = HTTP::Request.new("GET", "/view/world")
|
request = HTTP::Request.new("GET", "/view/world")
|
||||||
client_response = call_request_on_app(request)
|
client_response = call_request_on_app(request)
|
||||||
|
@ -28,7 +28,7 @@ describe "Views" do
|
||||||
it "renders layout" do
|
it "renders layout" do
|
||||||
get "/view/:name" do |env|
|
get "/view/:name" do |env|
|
||||||
name = env.params.url["name"]
|
name = env.params.url["name"]
|
||||||
render "spec/asset/hello.ecr", "spec/asset/layout.ecr"
|
render "#{__DIR__}/asset/hello.ecr", "#{__DIR__}/asset/layout.ecr"
|
||||||
end
|
end
|
||||||
request = HTTP::Request.new("GET", "/view/world")
|
request = HTTP::Request.new("GET", "/view/world")
|
||||||
client_response = call_request_on_app(request)
|
client_response = call_request_on_app(request)
|
||||||
|
@ -40,7 +40,7 @@ describe "Views" do
|
||||||
name = env.params.url["name"]
|
name = env.params.url["name"]
|
||||||
var1 = "serdar"
|
var1 = "serdar"
|
||||||
var2 = "kemal"
|
var2 = "kemal"
|
||||||
render "spec/asset/hello_with_content_for.ecr", "spec/asset/layout_with_yield_and_vars.ecr"
|
render "#{__DIR__}/asset/hello_with_content_for.ecr", "#{__DIR__}/asset/layout_with_yield_and_vars.ecr"
|
||||||
end
|
end
|
||||||
request = HTTP::Request.new("GET", "/view/world")
|
request = HTTP::Request.new("GET", "/view/world")
|
||||||
client_response = call_request_on_app(request)
|
client_response = call_request_on_app(request)
|
||||||
|
@ -52,7 +52,7 @@ describe "Views" do
|
||||||
it "renders layout with content_for" do
|
it "renders layout with content_for" do
|
||||||
get "/view/:name" do |env|
|
get "/view/:name" do |env|
|
||||||
name = env.params.url["name"]
|
name = env.params.url["name"]
|
||||||
render "spec/asset/hello_with_content_for.ecr", "spec/asset/layout_with_yield.ecr"
|
render "#{__DIR__}/asset/hello_with_content_for.ecr", "#{__DIR__}/asset/layout_with_yield.ecr"
|
||||||
end
|
end
|
||||||
request = HTTP::Request.new("GET", "/view/world")
|
request = HTTP::Request.new("GET", "/view/world")
|
||||||
client_response = call_request_on_app(request)
|
client_response = call_request_on_app(request)
|
||||||
|
|
Loading…
Reference in a new issue