Skip to content

Commit 4598335

Browse files
Paul CampbellPaul Campbell
Paul Campbell
authored and
Paul Campbell
committed
rlf stuff
1 parent 9b030c6 commit 4598335

File tree

801 files changed

+72415
-72415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

801 files changed

+72415
-72415
lines changed

app/helpers/top_cities_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
module TopCitiesHelper
2-
end
1+
module TopCitiesHelper
2+
end

spec/models/page_spec.rb

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2-
3-
describe Page do
4-
5-
describe "#url=" do
6-
7-
before do
8-
Page.stub!(:open_url).and_return(%Q[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
9-
"http://www.w3.org/TR/html4/loose.dtd">
10-
<html>
11-
<meta name="page" content="home">
12-
<head])
13-
@page = Page.new(:url => 'http://www.railsdevelopment.com/')
14-
end
15-
16-
it "should get the URL from the contents" do
17-
@page.url.should == 'home'
18-
end
19-
20-
end
21-
22-
describe "#robots" do
23-
24-
before do
25-
@page = Page.make_unsaved
26-
end
27-
28-
it "should have no robots" do
29-
@page.robots.should be_blank
30-
end
31-
32-
it "should have nofollow by itself" do
33-
@page.nofollow = true
34-
@page.robots.should == 'nofollow'
35-
end
36-
37-
it "should have both nofollow and noindex" do
38-
@page.nofollow = true
39-
@page.noindex = true
40-
@page.robots.should == 'noindex, nofollow'
41-
end
42-
43-
end
44-
1+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2+
3+
describe Page do
4+
5+
describe "#url=" do
6+
7+
before do
8+
Page.stub!(:open_url).and_return(%Q[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
9+
"http://www.w3.org/TR/html4/loose.dtd">
10+
<html>
11+
<meta name="page" content="home">
12+
<head])
13+
@page = Page.new(:url => 'http://www.railsdevelopment.com/')
14+
end
15+
16+
it "should get the URL from the contents" do
17+
@page.url.should == 'home'
18+
end
19+
20+
end
21+
22+
describe "#robots" do
23+
24+
before do
25+
@page = Page.make_unsaved
26+
end
27+
28+
it "should have no robots" do
29+
@page.robots.should be_blank
30+
end
31+
32+
it "should have nofollow by itself" do
33+
@page.nofollow = true
34+
@page.robots.should == 'nofollow'
35+
end
36+
37+
it "should have both nofollow and noindex" do
38+
@page.nofollow = true
39+
@page.noindex = true
40+
@page.robots.should == 'noindex, nofollow'
41+
end
42+
43+
end
44+
4545
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Show HTML
1+
Show HTML
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Index JSON
1+
Index JSON
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
New HTML
1+
New HTML
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
require "cases/helper"
2-
require 'models/topic'
3-
4-
class TestColumnAlias < ActiveRecord::TestCase
5-
fixtures :topics
6-
7-
QUERY = if 'Oracle' == ActiveRecord::Base.connection.adapter_name
8-
'SELECT id AS pk FROM topics WHERE ROWNUM < 2'
9-
else
10-
'SELECT id AS pk FROM topics'
11-
end
12-
13-
def test_column_alias
14-
records = Topic.connection.select_all(QUERY)
15-
assert_equal 'pk', records[0].keys[0]
16-
end
17-
end
1+
require "cases/helper"
2+
require 'models/topic'
3+
4+
class TestColumnAlias < ActiveRecord::TestCase
5+
fixtures :topics
6+
7+
QUERY = if 'Oracle' == ActiveRecord::Base.connection.adapter_name
8+
'SELECT id AS pk FROM topics WHERE ROWNUM < 2'
9+
else
10+
'SELECT id AS pk FROM topics'
11+
end
12+
13+
def test_column_alias
14+
records = Topic.connection.select_all(QUERY)
15+
assert_equal 'pk', records[0].keys[0]
16+
end
17+
end
Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
require "cases/helper"
2-
3-
class ColumnDefinitionTest < ActiveRecord::TestCase
4-
def setup
5-
@adapter = ActiveRecord::ConnectionAdapters::AbstractAdapter.new(nil)
6-
def @adapter.native_database_types
7-
{:string => "varchar"}
8-
end
9-
end
10-
11-
# Avoid column definitions in create table statements like:
12-
# `title` varchar(255) DEFAULT NULL
13-
def test_should_not_include_default_clause_when_default_is_null
14-
column = ActiveRecord::ConnectionAdapters::Column.new("title", nil, "varchar(20)")
15-
column_def = ActiveRecord::ConnectionAdapters::ColumnDefinition.new(
16-
@adapter, column.name, "string",
17-
column.limit, column.precision, column.scale, column.default, column.null)
18-
assert_equal "title varchar(20)", column_def.to_sql
19-
end
20-
21-
def test_should_include_default_clause_when_default_is_present
22-
column = ActiveRecord::ConnectionAdapters::Column.new("title", "Hello", "varchar(20)")
23-
column_def = ActiveRecord::ConnectionAdapters::ColumnDefinition.new(
24-
@adapter, column.name, "string",
25-
column.limit, column.precision, column.scale, column.default, column.null)
26-
assert_equal %Q{title varchar(20) DEFAULT 'Hello'}, column_def.to_sql
27-
end
28-
29-
def test_should_specify_not_null_if_null_option_is_false
30-
column = ActiveRecord::ConnectionAdapters::Column.new("title", "Hello", "varchar(20)", false)
31-
column_def = ActiveRecord::ConnectionAdapters::ColumnDefinition.new(
32-
@adapter, column.name, "string",
33-
column.limit, column.precision, column.scale, column.default, column.null)
34-
assert_equal %Q{title varchar(20) DEFAULT 'Hello' NOT NULL}, column_def.to_sql
35-
end
36-
end
1+
require "cases/helper"
2+
3+
class ColumnDefinitionTest < ActiveRecord::TestCase
4+
def setup
5+
@adapter = ActiveRecord::ConnectionAdapters::AbstractAdapter.new(nil)
6+
def @adapter.native_database_types
7+
{:string => "varchar"}
8+
end
9+
end
10+
11+
# Avoid column definitions in create table statements like:
12+
# `title` varchar(255) DEFAULT NULL
13+
def test_should_not_include_default_clause_when_default_is_null
14+
column = ActiveRecord::ConnectionAdapters::Column.new("title", nil, "varchar(20)")
15+
column_def = ActiveRecord::ConnectionAdapters::ColumnDefinition.new(
16+
@adapter, column.name, "string",
17+
column.limit, column.precision, column.scale, column.default, column.null)
18+
assert_equal "title varchar(20)", column_def.to_sql
19+
end
20+
21+
def test_should_include_default_clause_when_default_is_present
22+
column = ActiveRecord::ConnectionAdapters::Column.new("title", "Hello", "varchar(20)")
23+
column_def = ActiveRecord::ConnectionAdapters::ColumnDefinition.new(
24+
@adapter, column.name, "string",
25+
column.limit, column.precision, column.scale, column.default, column.null)
26+
assert_equal %Q{title varchar(20) DEFAULT 'Hello'}, column_def.to_sql
27+
end
28+
29+
def test_should_specify_not_null_if_null_option_is_false
30+
column = ActiveRecord::ConnectionAdapters::Column.new("title", "Hello", "varchar(20)", false)
31+
column_def = ActiveRecord::ConnectionAdapters::ColumnDefinition.new(
32+
@adapter, column.name, "string",
33+
column.limit, column.precision, column.scale, column.default, column.null)
34+
assert_equal %Q{title varchar(20) DEFAULT 'Hello' NOT NULL}, column_def.to_sql
35+
end
36+
end
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
require "cases/helper"
2-
3-
class ConnectionManagementTest < ActiveRecord::TestCase
4-
def setup
5-
@env = {}
6-
@app = stub('App')
7-
@management = ActiveRecord::ConnectionAdapters::ConnectionManagement.new(@app)
8-
9-
@connections_cleared = false
10-
ActiveRecord::Base.stubs(:clear_active_connections!).with { @connections_cleared = true }
11-
end
12-
13-
test "clears active connections after each call" do
14-
@app.expects(:call).with(@env)
15-
@management.call(@env)
16-
assert @connections_cleared
17-
end
18-
19-
test "doesn't clear active connections when running in a test case" do
20-
@env['rack.test'] = true
21-
@app.expects(:call).with(@env)
22-
@management.call(@env)
23-
assert !@connections_cleared
24-
end
1+
require "cases/helper"
2+
3+
class ConnectionManagementTest < ActiveRecord::TestCase
4+
def setup
5+
@env = {}
6+
@app = stub('App')
7+
@management = ActiveRecord::ConnectionAdapters::ConnectionManagement.new(@app)
8+
9+
@connections_cleared = false
10+
ActiveRecord::Base.stubs(:clear_active_connections!).with { @connections_cleared = true }
11+
end
12+
13+
test "clears active connections after each call" do
14+
@app.expects(:call).with(@env)
15+
@management.call(@env)
16+
assert @connections_cleared
17+
end
18+
19+
test "doesn't clear active connections when running in a test case" do
20+
@env['rack.test'] = true
21+
@app.expects(:call).with(@env)
22+
@management.call(@env)
23+
assert !@connections_cleared
24+
end
2525
end
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
require "cases/helper"
2-
3-
class FirebirdConnectionTest < ActiveRecord::TestCase
4-
def test_charset_properly_set
5-
fb_conn = ActiveRecord::Base.connection.instance_variable_get(:@connection)
6-
assert_equal 'UTF8', fb_conn.database.character_set
7-
end
8-
end
1+
require "cases/helper"
2+
3+
class FirebirdConnectionTest < ActiveRecord::TestCase
4+
def test_charset_properly_set
5+
fb_conn = ActiveRecord::Base.connection.instance_variable_get(:@connection)
6+
assert_equal 'UTF8', fb_conn.database.character_set
7+
end
8+
end
Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
require "cases/helper"
2-
3-
class MysqlConnectionTest < ActiveRecord::TestCase
4-
def setup
5-
super
6-
@connection = ActiveRecord::Base.connection
7-
end
8-
9-
def test_mysql_reconnect_attribute_after_connection_with_reconnect_true
10-
run_without_connection do |orig_connection|
11-
ActiveRecord::Base.establish_connection(orig_connection.merge({:reconnect => true}))
12-
assert ActiveRecord::Base.connection.raw_connection.reconnect
13-
end
14-
end
15-
16-
def test_mysql_reconnect_attribute_after_connection_with_reconnect_false
17-
run_without_connection do |orig_connection|
18-
ActiveRecord::Base.establish_connection(orig_connection.merge({:reconnect => false}))
19-
assert !ActiveRecord::Base.connection.raw_connection.reconnect
20-
end
21-
end
22-
23-
def test_no_automatic_reconnection_after_timeout
24-
assert @connection.active?
25-
@connection.update('set @@wait_timeout=1')
26-
sleep 2
27-
assert !@connection.active?
28-
end
29-
30-
def test_successful_reconnection_after_timeout_with_manual_reconnect
31-
assert @connection.active?
32-
@connection.update('set @@wait_timeout=1')
33-
sleep 2
34-
@connection.reconnect!
35-
assert @connection.active?
36-
end
37-
38-
def test_successful_reconnection_after_timeout_with_verify
39-
assert @connection.active?
40-
@connection.update('set @@wait_timeout=1')
41-
sleep 2
42-
@connection.verify!
43-
assert @connection.active?
44-
end
45-
46-
private
47-
48-
def run_without_connection
49-
original_connection = ActiveRecord::Base.remove_connection
50-
begin
51-
yield original_connection
52-
ensure
53-
ActiveRecord::Base.establish_connection(original_connection)
54-
end
55-
end
56-
end
1+
require "cases/helper"
2+
3+
class MysqlConnectionTest < ActiveRecord::TestCase
4+
def setup
5+
super
6+
@connection = ActiveRecord::Base.connection
7+
end
8+
9+
def test_mysql_reconnect_attribute_after_connection_with_reconnect_true
10+
run_without_connection do |orig_connection|
11+
ActiveRecord::Base.establish_connection(orig_connection.merge({:reconnect => true}))
12+
assert ActiveRecord::Base.connection.raw_connection.reconnect
13+
end
14+
end
15+
16+
def test_mysql_reconnect_attribute_after_connection_with_reconnect_false
17+
run_without_connection do |orig_connection|
18+
ActiveRecord::Base.establish_connection(orig_connection.merge({:reconnect => false}))
19+
assert !ActiveRecord::Base.connection.raw_connection.reconnect
20+
end
21+
end
22+
23+
def test_no_automatic_reconnection_after_timeout
24+
assert @connection.active?
25+
@connection.update('set @@wait_timeout=1')
26+
sleep 2
27+
assert !@connection.active?
28+
end
29+
30+
def test_successful_reconnection_after_timeout_with_manual_reconnect
31+
assert @connection.active?
32+
@connection.update('set @@wait_timeout=1')
33+
sleep 2
34+
@connection.reconnect!
35+
assert @connection.active?
36+
end
37+
38+
def test_successful_reconnection_after_timeout_with_verify
39+
assert @connection.active?
40+
@connection.update('set @@wait_timeout=1')
41+
sleep 2
42+
@connection.verify!
43+
assert @connection.active?
44+
end
45+
46+
private
47+
48+
def run_without_connection
49+
original_connection = ActiveRecord::Base.remove_connection
50+
begin
51+
yield original_connection
52+
ensure
53+
ActiveRecord::Base.establish_connection(original_connection)
54+
end
55+
end
56+
end

0 commit comments

Comments
 (0)