Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change coding style

  • Loading branch information...
commit 3faf9e5f6853436f29e486adea69a6d004025bcb 1 parent ac47a28
@ab9 authored
View
12 Gemfile
@@ -1,11 +1,11 @@
-source "http://rubygems.org/"
+source 'http://rubygems.org/'
ruby '1.9.3'
-gem "sinatra", "~> 1.3.3"
-gem "classnamer", "~> 2.2.4"
+gem 'sinatra', '~> 1.3.3'
+gem 'classnamer', '~> 2.2.4'
group :development do
- gem "rake", "10.0.3"
- gem "minitest", "4.3.3"
- gem "rack-test", "0.6.2"
+ gem 'rake', '10.0.3'
+ gem 'minitest', '4.3.3'
+ gem 'rack-test', '0.6.2'
end
View
6 test/test_helper.rb
@@ -1,3 +1,3 @@
-require "web_classnamer"
-require "minitest/autorun"
-require "rack/test"
+require 'web_classnamer'
+require 'minitest/autorun'
+require 'rack/test'
View
48 test/web_classnamer_test.rb
@@ -1,4 +1,4 @@
-require "test_helper"
+require 'test_helper'
class WebClassnamerTest < MiniTest::Unit::TestCase
include Rack::Test::Methods
@@ -10,66 +10,66 @@ def app
# Serving HTML
def test_root_response_has_ok_status
- get "/"
+ get '/'
assert last_response.ok?
end
def test_root_response_has_html_content_type
- get "/"
- assert_equal "text/html;charset=utf-8",
- last_response.headers["Content-Type"]
+ get '/'
+ assert_equal 'text/html;charset=utf-8',
+ last_response.headers['Content-Type']
end
def test_root_response_has_classnamer_in_content
- get "/"
- assert last_response.body.include?("Classnamer")
+ get '/'
+ assert last_response.body.include?('Classnamer')
end
def test_html_response_has_ok_status
- get "/index.html"
+ get '/index.html'
assert last_response.ok?
end
def test_html_response_has_html_content_type
- get "/index.html"
- assert_equal "text/html;charset=utf-8",
- last_response.headers["Content-Type"]
+ get '/index.html'
+ assert_equal 'text/html;charset=utf-8',
+ last_response.headers['Content-Type']
end
def test_html_response_has_classnamer_in_content
- get "/"
- assert last_response.body.include?("Classnamer")
+ get '/'
+ assert last_response.body.include?('Classnamer')
end
def test_html_response_has_generated_name_in_content
- Classnamer.stub(:generate, "FooBarBaz") do
- get "/"
- assert last_response.body.include?("FooBarBaz")
+ Classnamer.stub :generate, 'FooBarBaz' do
+ get '/'
+ assert last_response.body.include?('FooBarBaz')
end
end
# Serving plain text
def test_text_response_has_ok_status
- get "/index.txt"
+ get '/index.txt'
assert last_response.ok?
end
def test_text_response_has_text_content_type
- get "/index.txt"
- assert_equal "text/plain;charset=utf-8",
- last_response.headers["Content-Type"]
+ get '/index.txt'
+ assert_equal 'text/plain;charset=utf-8',
+ last_response.headers['Content-Type']
end
def test_text_response_ends_with_line_feed
- get "/index.txt"
+ get '/index.txt'
assert_match /\n\Z/m, last_response.body
end
def test_text_response_has_generated_name_in_content
- Classnamer.stub(:generate, "FooBarBaz") do
- get "/index.txt"
- assert last_response.body.include?("FooBarBaz")
+ Classnamer.stub :generate, 'FooBarBaz' do
+ get '/index.txt'
+ assert last_response.body.include?('FooBarBaz')
end
end
end
View
12 web_classnamer.rb
@@ -1,15 +1,15 @@
-require "sinatra"
+require 'sinatra'
require "classnamer"
-get "/" do
+get '/' do
erb :index
end
-get "/index.html" do
+get '/index.html' do
erb :index
end
-get "/index.txt" do
- [200, {"Content-Type" => "text/plain;charset=utf-8"},
- "#{Classnamer.generate}\n".encode!(Encoding.find("UTF-8"))]
+get '/index.txt' do
+ [200, {'Content-Type' => 'text/plain;charset=utf-8'},
+ "#{Classnamer.generate}\n".encode!(Encoding.find('UTF-8'))]
end
Please sign in to comment.
Something went wrong with that request. Please try again.