spec/simple/httpd/helpers_spec.rb in simple-httpd-0.3.0 vs spec/simple/httpd/helpers_spec.rb in simple-httpd-0.3.1
- old
+ new
@@ -1,15 +1,32 @@
require "spec_helper"
-describe Simple::Httpd do
- describe "helpers" do
- it "loads helpers from the same directory tree" do
- http.get "/helpers/ex2"
- expect_response "ex2_helper"
+describe "Simple::Httpd::Helpers" do
+ H = Simple::Httpd::Helpers
+
+ describe ".filtered_stacktrace" do
+ def some_stacktrace(depth = 1)
+ if depth == 0
+ caller
+ else
+ some_stacktrace(depth-1)
+ end
end
- it "does not load helpers from other directory tree even on the same URL tree" do
- http.get "/helpers/ex1"
- expect_response status: 404
+ def filtered_stacktrace
+ H.filtered_stacktrace(some_stacktrace)
+ end
+
+ it "removes .rvm lines" do
+ actual = filtered_stacktrace
+
+ expect(actual.grep(/lines removed/).count).to eq(1)
+ expect(actual.grep(/helpers_spec/).count).to be > 1
+ expect(actual.grep(/some_stacktrace/).count).to eq(1)
+ end
+
+ it "shortens paths" do
+ source_path = filtered_stacktrace.grep(/helpers_spec/).first
+ expect(source_path).to start_with("./")
end
end
end