projects
/
rails.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2c52b06
)
reverting last change, which included posgres config specific things
author
Shaun McDonald
<shaun@shaunmcdonald.me.uk>
Mon, 13 Apr 2009 00:10:37 +0000
(
00:10
+0000)
committer
Shaun McDonald
<shaun@shaunmcdonald.me.uk>
Mon, 13 Apr 2009 00:10:37 +0000
(
00:10
+0000)
app/models/acl.rb
patch
|
blob
|
history
config/database.yml
patch
|
blob
|
history
config/initializers/sql_session_store.rb
patch
|
blob
|
history
db/migrate/025_add_end_time_to_changesets.rb
patch
|
blob
|
history
test/functional/changeset_controller_test.rb
patch
|
blob
|
history
diff --git
a/app/models/acl.rb
b/app/models/acl.rb
index dbcb38993b6b905f0e5be691147387488c6f5023..5fb99b9e5bfd7bbfeb0f93a3c64da86ee19846f9 100644
(file)
--- a/
app/models/acl.rb
+++ b/
app/models/acl.rb
@@
-1,12
+1,12
@@
class Acl < ActiveRecord::Base
def self.find_by_address(address, options)
class Acl < ActiveRecord::Base
def self.find_by_address(address, options)
- self.with_scope(:find => {:conditions => ["
?
& netmask = address", address]}) do
+ self.with_scope(:find => {:conditions => ["
inet_aton(?)
& netmask = address", address]}) do
return self.find(:first, options)
end
end
def self.find_all_by_address(address, options)
return self.find(:first, options)
end
end
def self.find_all_by_address(address, options)
- self.with_scope(:find => {:conditions => ["
?
& netmask = address", address]}) do
+ self.with_scope(:find => {:conditions => ["
inet_aton(?)
& netmask = address", address]}) do
return self.find(:all, options)
end
end
return self.find(:all, options)
end
end
diff --git
a/config/database.yml
b/config/database.yml
index 2c61345b1ec7bf3a18aa50c3a372d5bf5ceaa456..cc3f9a1a5fb26e4fd5b2186728c3e4d5c6b45127 100644
(file)
--- a/
config/database.yml
+++ b/
config/database.yml
@@
-11,26
+11,26
@@
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
- adapter:
postgre
sql
+ adapter:
my
sql
database: openstreetmap
database: openstreetmap
- username:
shaunmcdonald
- password:
postgres
-
#
host: localhost
+ username:
openstreetmap
+ password:
openstreetmap
+ host: localhost
encoding: utf8
# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
encoding: utf8
# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
- adapter:
postgre
sql
+ adapter:
my
sql
database: osm_test
database: osm_test
- username:
shaunmcdonald
- password:
postgres
-
#
host: localhost
+ username:
osm_test
+ password:
osm_test
+ host: localhost
encoding: utf8
production:
encoding: utf8
production:
- adapter:
postgre
sql
+ adapter:
my
sql
database: osm
username: osm
password: osm
database: osm
username: osm
password: osm
diff --git
a/config/initializers/sql_session_store.rb
b/config/initializers/sql_session_store.rb
index 4325c6d4c717ab1f090760687c78294b3fcd6404..fd6c11d4447b2f66bfae1fcf8e861369201e9b2c 100644
(file)
--- a/
config/initializers/sql_session_store.rb
+++ b/
config/initializers/sql_session_store.rb
@@
-1,2
+1,2
@@
# Use the MySQL interface for SqlSessionStore
# Use the MySQL interface for SqlSessionStore
-SqlSessionStore.session_class =
Postgre
sqlSession
+SqlSessionStore.session_class =
My
sqlSession
diff --git
a/db/migrate/025_add_end_time_to_changesets.rb
b/db/migrate/025_add_end_time_to_changesets.rb
index 553fd9e2ac9a48ae0a7d69b8d6af5766e1368332..b87ce3fdebabcf12abd2d1a192eb36547b9f155b 100644
(file)
--- a/
db/migrate/025_add_end_time_to_changesets.rb
+++ b/
db/migrate/025_add_end_time_to_changesets.rb
@@
-7,8
+7,8
@@
class AddEndTimeToChangesets < ActiveRecord::Migration
# it appears that execute will only accept string arguments, so
# this is an ugly, ugly hack to get some sort of mysql/postgres
# independence. now i have to go wash my brain with bleach.
# it appears that execute will only accept string arguments, so
# this is an ugly, ugly hack to get some sort of mysql/postgres
# independence. now i have to go wash my brain with bleach.
-
#
execute("update changesets set closed_at=(now()-'1 hour') where open=(1=0)")
-
#
execute("update changesets set closed_at=(now()+'1 hour') where open=(1=1)")
+ execute("update changesets set closed_at=(now()-'1 hour') where open=(1=0)")
+ execute("update changesets set closed_at=(now()+'1 hour') where open=(1=1)")
# remove the open column as it is unnecessary now and denormalises
# the table.
# remove the open column as it is unnecessary now and denormalises
# the table.
diff --git
a/test/functional/changeset_controller_test.rb
b/test/functional/changeset_controller_test.rb
index 932d685bb49fa67041af4f3001cc80a194ea0408..6465c894de77d95a09008feb53daffb3460d3133 100644
(file)
--- a/
test/functional/changeset_controller_test.rb
+++ b/
test/functional/changeset_controller_test.rb
@@
-4,6
+4,14
@@
require 'changeset_controller'
class ChangesetControllerTest < ActionController::TestCase
api_fixtures
class ChangesetControllerTest < ActionController::TestCase
api_fixtures
+ def basic_authorization(user, pass)
+ @request.env["HTTP_AUTHORIZATION"] = "Basic %s" % Base64.encode64("#{user}:#{pass}")
+ end
+
+ def content(c)
+ @request.env["RAW_POST_DATA"] = c.to_s
+ end
+
# -----------------------
# Test simple changeset creation
# -----------------------
# -----------------------
# Test simple changeset creation
# -----------------------
@@
-40,18
+48,6
@@
class ChangesetControllerTest < ActionController::TestCase
assert_response :bad_request, "creating a invalid changeset should fail"
end
assert_response :bad_request, "creating a invalid changeset should fail"
end
- def test_create_invalid_no_content
- basic_authorization "test@openstreetmap.org", "test"
- put :create
- assert_response :bad_request, "creating a changeset with no content should fail"
- end
-
- def test_create_wrong_method
- basic_authorization "test@openstreetmap.org", "test"
- get :create
- assert_response :method_not_allowed
- end
-
##
# check that the changeset can be read and returns the correct
# document structure.
##
# check that the changeset can be read and returns the correct
# document structure.
@@
-252,9
+248,7
@@
EOF
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
content "<osm><changeset>" +
"<tag k='created_by' v='osm test suite checking changesets'/>" +
"</changeset></osm>"
- assert_difference('Changeset.count', 1) do
- put :create
- end
+ put :create
assert_response :success
changeset_id = @response.body.to_i
end
assert_response :success
changeset_id = @response.body.to_i
end