Few issues with this patch, some comments inline, but first problem is
it does not apply, and you are changing several lines that have already
been changed/removed in next.
On Sat, 2010-07-24 at 00:34 -0400, Mohammed Morsi wrote:
---
src/spec/controllers/users_controller_spec.rb | 4 ++--
src/spec/spec_helper.rb | 4 ++--
src/test/fixtures/users.yml | 5 +++++
.../functional/user_sessions_controller_test.rb | 2 +-
src/test/functional/users_controller_test.rb | 5 +++--
src/test/unit/provider_test.rb | 8 ++++----
6 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/spec/controllers/users_controller_spec.rb
b/src/spec/controllers/users_controller_spec.rb
index 231a533..bdb5604 100644
--- a/src/spec/controllers/users_controller_spec.rb
+++ b/src/spec/controllers/users_controller_spec.rb
@@ -38,7 +38,7 @@ describe UsersController do
|perm| perm.role.name.eql?('Instance Creator and User')
}.should be_true
id = User.find(:first, :conditions => ['login = ?',
"tuser2"]).id
- response.should redirect_to("http://test.host/users/show/#{id}")
+ response.should redirect_to("http://test.host/users/#{id}")
This
is one that has already been fixed. It was changed to:
response.should redirect_to(user_url(user))
end
it "fails to create pool" do
@@ -70,7 +70,7 @@ describe UsersController do
:password_confirmation => "testpass" }
}.should change{ User.count }
id = User.find(:first, :conditions => ['login = ?',
"tuser3"]).id
- response.should redirect_to("http://test.host/users/show/#{id}")
+ response.should redirect_to("http://test.host/users/#{id}")
end
Same for this one ^
it "should not allow a regular user to create user" do
diff --git a/src/spec/spec_helper.rb b/src/spec/spec_helper.rb
index 4a72e06..ea87cdb 100644
--- a/src/spec/spec_helper.rb
+++ b/src/spec/spec_helper.rb
@@ -13,8 +13,8 @@ require 'authlogic/test_case'
# in ./support/ and its subdirectories.
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each
{|f| require f}
-# factories are not loaded automatically (at least with rspec 1.3.0 on Fedora 13)
-Dir[File.expand_path(File.join(File.dirname(__FILE__),'factories','**','*.rb'))].each
{|f| puts f;require f}
+# factories are not loaded automatically (at least with rspec 1.3.0 on Fedora 13) (yes
they are)
+#Dir[File.expand_path(File.join(File.dirname(__FILE__),'factories','**','*.rb'))].each
{|f| puts f;require f}
This line was already removed ^
Spec::Runner.configure do |config|
# If you're not using ActiveRecord you should remove these
diff --git a/src/test/fixtures/users.yml b/src/test/fixtures/users.yml
index d51db27..f523201 100644
--- a/src/test/fixtures/users.yml
+++ b/src/test/fixtures/users.yml
@@ -2,14 +2,19 @@
test_user:
login: tuser
+ first_name: test
+ last_name: user
email: tuser(a)example.com
password_salt: <%= salt = Authlogic::Random.hex_token %>
crypted_password: <%=
Authlogic::CryptoProviders::Sha512.encrypt("testpass" + salt) %>
persistence_token:
5136b29cb04a5b8840fe74451b8bdf83531f57c072826eaf63a5c05e71828ed58fc5359a2f22b02e54298d64e043a870bc03d898249dd7f577f6c5418d5ba5a6
single_access_token: YxaPK0smnUj2t9Pq0xuK
perishable_token: XZO-3xU2OIqHAUJOkDMX
+
test_admin:
login: tadmin
+ first_name: test
+ last_name: admin
email: tadmin(a)example.com
password_salt: <%= salt = Authlogic::Random.hex_token %>
crypted_password: <%=
Authlogic::CryptoProviders::Sha512.encrypt("testpass" + salt) %>
diff --git a/src/test/functional/user_sessions_controller_test.rb
b/src/test/functional/user_sessions_controller_test.rb
index fae1757..21d63a8 100644
--- a/src/test/functional/user_sessions_controller_test.rb
+++ b/src/test/functional/user_sessions_controller_test.rb
@@ -11,7 +11,7 @@ class UserSessionsControllerTest < ActionController::TestCase
post :create, :user_session => { :login => "tuser", :password =>
"testpass" }
assert user_session = UserSession.find
assert_equal users(:test_user), user_session.user
- assert_redirected_to account_path
+ assert_redirected_to dashboard_url
end
test "should destroy user session" do
diff --git a/src/test/functional/users_controller_test.rb
b/src/test/functional/users_controller_test.rb
index 0f04dd2..9691e8b 100644
--- a/src/test/functional/users_controller_test.rb
+++ b/src/test/functional/users_controller_test.rb
@@ -1,7 +1,7 @@
require 'test_helper'
class UsersControllerTest < ActionController::TestCase
- fixtures :users
+ fixtures :base_permission_objects, :users, :roles
test "should get new" do
get :new
@@ -15,7 +15,8 @@ class UsersControllerTest < ActionController::TestCase
:password_confirmation => "testpass" }
end
- assert_redirected_to account_path
+ id = User.find(:first, :conditions => ['login = ?',
"tuser2"]).id
+ assert_redirected_to "http://test.host/users/#{id}"
This should probably match the spec if we keep this around for a bit
(but really, the whole file should just be removed, as we dont use
test:unit anymore).
end
test "should show user" do
diff --git a/src/test/unit/provider_test.rb b/src/test/unit/provider_test.rb
index 877fd9c..f56f8a4 100644
--- a/src/test/unit/provider_test.rb
+++ b/src/test/unit/provider_test.rb
@@ -8,10 +8,10 @@ class ProviderTest < ActiveSupport::TestCase
:cloud_type => "EC2")
end
# The following three tests assume you have the deltacloud-framework
- # running and configured on localhost:3000
+ # running and configured on localhost:3001
test "is valid with good url" do
- @provider.url = "http://localhost:3000/api"
+ @provider.url = "http://localhost:3001/api"
flunk "That URL should have worked. Is framework running?" if
@provider.invalid?
end
@@ -29,7 +29,7 @@ class ProviderTest < ActiveSupport::TestCase
end
test "should return DeltaCloud if successful connection" do
- @provider.url = "http://localhost:3000/api"
- assert_instance_of(DeltaCloud, @provider.connect)
+ @provider.url = "http://localhost:3001/api"
+ assert_instance_of(DeltaCloud::API, @provider.connect)
end
end