Skip to content

Commit 4debda4

Browse files
committed
Clean up use of __FILE__ in tests where a simple 'require' works fine
Remove old railsbridge-apps.md todo-lookin' file
1 parent 6a23536 commit 4debda4

12 files changed

+25
-77
lines changed

app.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,19 @@ def render_page
153153
end
154154

155155
get "/:site/:name.:ext" do
156-
if not sites.include?(params[:site])
157-
forward # send it on to the downstream file server
158-
else
156+
if sites.include?(params[:site])
159157
send_file "#{site_dir}/#{params[:name]}.#{params[:ext]}"
158+
else
159+
forward # send it on to the downstream file server
160160
end
161161
end
162162

163163
# todo: make this work in a general way, without hardcoded 'img'
164164
get "/:site/img/:name.:ext" do
165-
if not sites.include?(params[:site])
166-
forward # send it on to the downstream file server
167-
else
165+
if sites.include?(params[:site])
168166
send_file "#{site_dir}/img/#{params[:name]}.#{params[:ext]}"
167+
else
168+
forward # send it on to the downstream file server
169169
end
170170
end
171171

md2step

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/env ruby
22
here = File.expand_path File.dirname __FILE__
33
$:<<here
4-
require 'lib/github_flavored_markdown'
5-
include GithubFlavoredMarkdown
4+
65
ARGV.each do |arg|
76
old_path = arg
87
new_path = arg.gsub(/\.md$/, '.step')

railsbridge-apps.md

-43
This file was deleted.

spec/app_spec.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
here = File.expand_path File.dirname(__FILE__)
2-
require "#{here}/spec_helper"
1+
require "spec_helper"
32

4-
require "#{here}/../app"
3+
require_relative "../app"
54
require "rack/test"
65

76
# todo: use a dummy set of sites instead of the real "installfest" and "curriculum"

spec/contents_spec.rb

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
here = File.expand_path File.dirname(__FILE__)
2-
require "#{here}/spec_helper"
1+
require "spec_helper"
2+
3+
require_relative "../app"
4+
require_relative "../lib/contents"
35

4-
require "#{here}/../app"
5-
require "#{here}/../lib/contents"
6+
here = File.expand_path File.dirname(__FILE__)
67

78
describe Contents do
89
before :all do

spec/markdown_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
here = File.expand_path File.dirname(__FILE__)
2-
require "#{here}/spec_helper"
1+
require "spec_helper"
32

43
require "markdown_page"
54

spec/media_wiki_spec.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
here = File.expand_path File.dirname(__FILE__)
2-
require "#{here}/spec_helper"
3-
1+
require 'spec_helper'
42
require "media_wiki"
53

64
include MediaWiki

spec/site_index_spec.rb

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
here = File.expand_path File.dirname(__FILE__)
2-
require "#{here}/spec_helper"
1+
require "spec_helper"
32

4-
require "#{here}/../app"
5-
require "#{here}/../lib/site_index"
3+
require_relative "../app"
4+
require_relative "../lib/site_index"
65

76
describe Contents do
87
before :all do

spec/site_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
here = File.expand_path File.dirname(__FILE__)
2-
require "#{here}/spec_helper"
1+
require "spec_helper"
32

43
require "site"
54

spec/site_syntax_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
here = File.expand_path File.dirname(__FILE__)
2-
require "#{here}/spec_helper"
3-
require "#{here}/../app"
1+
require "spec_helper"
2+
require_relative "../app"
3+
44
require "site"
55

66
require "rack/test"

spec/step_page_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
here = File.expand_path File.dirname(__FILE__)
2-
require "#{here}/spec_helper"
1+
require "spec_helper"
32

43
require "step_page"
54

spec/step_spec.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
here = File.expand_path File.dirname(__FILE__)
2-
require "#{here}/spec_helper"
1+
require 'spec_helper'
32

43
require "step_page"
54

65
describe Step do
7-
86
def to_html nokogiri_node
97
nokogiri_node.serialize(:save_with => 0).chomp
108
end

0 commit comments

Comments
 (0)