summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-04-03 11:22:16 +0200
committerAzul <azul@leap.se>2013-04-03 11:22:16 +0200
commit654ab25fa4659119d5ddaa9ae116fce69a386ab1 (patch)
tree0f0adf5a0c92a20a7084c251dafac7a420f9b640
parentf4172ac9ea7a484659fa2019119533bc9569880f (diff)
make sure user tests also run when run from users subdir
* The APP_CONFIG needs to be initialized in core so that is required from other engines * paths for load_views need to be relative to the model - not to rails root.
-rw-r--r--core/config/initializers/load_config.rb (renamed from config/initializers/load_config.rb)0
-rw-r--r--help/app/models/ticket.rb3
-rw-r--r--users/app/models/user.rb3
-rw-r--r--users/test/integration/api/rack_test.rb12
4 files changed, 16 insertions, 2 deletions
diff --git a/config/initializers/load_config.rb b/core/config/initializers/load_config.rb
index b2b0318..b2b0318 100644
--- a/config/initializers/load_config.rb
+++ b/core/config/initializers/load_config.rb
diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb
index a456fe5..738487a 100644
--- a/help/app/models/ticket.rb
+++ b/help/app/models/ticket.rb
@@ -47,7 +47,8 @@ class Ticket < CouchRest::Model::Base
view :by_is_open_and_created_at
view :by_is_open_and_updated_at
- load_views(Rails.root.join('help', 'app', 'designs', 'ticket'))
+ own_path = Pathname.new(File.dirname(__FILE__))
+ load_views(own_path.join('..', 'designs', 'ticket'))
end
validates :title, :presence => true
diff --git a/users/app/models/user.rb b/users/app/models/user.rb
index c9b367f..62c5054 100644
--- a/users/app/models/user.rb
+++ b/users/app/models/user.rb
@@ -47,7 +47,8 @@ class User < CouchRest::Model::Base
timestamps!
design do
- load_views(Rails.root.join('users', 'app', 'designs', 'user'))
+ own_path = Pathname.new(File.dirname(__FILE__))
+ load_views(own_path.join('..', 'designs', 'user'))
view :by_login
view :by_created_at
end
diff --git a/users/test/integration/api/rack_test.rb b/users/test/integration/api/rack_test.rb
new file mode 100644
index 0000000..da960f2
--- /dev/null
+++ b/users/test/integration/api/rack_test.rb
@@ -0,0 +1,12 @@
+CONFIG_RU = (Rails.root + 'config.ru').to_s
+OUTER_APP = Rack::Builder.parse_file(CONFIG_RU).first
+
+class RackTest < ActiveSupport::TestCase
+ include Rack::Test::Methods
+ include Warden::Test::Helpers
+ include LeapWebCore::AssertResponses
+
+ def app
+ OUTER_APP
+ end
+end