You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2008/08/16 02:46:52 UTC

svn commit: r686426 - in /ode/sandbox/singleshot: README app/controllers/tasks_controller.rb spec/controllers/activity_controller_spec.rb spec/controllers/sessions_controller_spec.rb spec/controllers/tasks_controller_spec.rb spec/people.rb spec/tasks.rb

Author: assaf
Date: Fri Aug 15 17:46:52 2008
New Revision: 686426

URL: http://svn.apache.org/viewvc?rev=686426&view=rev
Log:
Most specs are working now, with the exception of tasks controller.

Modified:
    ode/sandbox/singleshot/README
    ode/sandbox/singleshot/app/controllers/tasks_controller.rb
    ode/sandbox/singleshot/spec/controllers/activity_controller_spec.rb
    ode/sandbox/singleshot/spec/controllers/sessions_controller_spec.rb
    ode/sandbox/singleshot/spec/controllers/tasks_controller_spec.rb
    ode/sandbox/singleshot/spec/people.rb
    ode/sandbox/singleshot/spec/tasks.rb

Modified: ode/sandbox/singleshot/README
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/README?rev=686426&r1=686425&r2=686426&view=diff
==============================================================================
--- ode/sandbox/singleshot/README (original)
+++ ode/sandbox/singleshot/README Fri Aug 15 17:46:52 2008
@@ -1,7 +1,6 @@
 == Setting up the environment
 
-Singleshot is developed against Rails 2.1.  To get moving you need to first
-install Rails 2.1 or later.
+Singleshot is developed against Rails Edge.
 
 To get the latest copy use one of the following:
 

Modified: ode/sandbox/singleshot/app/controllers/tasks_controller.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/controllers/tasks_controller.rb?rev=686426&r1=686425&r2=686426&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/controllers/tasks_controller.rb (original)
+++ ode/sandbox/singleshot/app/controllers/tasks_controller.rb Fri Aug 15 17:46:52 2008
@@ -72,6 +72,11 @@
   end
 
 
+  def create
+    @task = Task.create!(params[:task])
+    head :created, :location=>@task
+  end
+
   def show
     @title = @task.title
     @alternate = { Mime::HTML=>task_url(@task),

Modified: ode/sandbox/singleshot/spec/controllers/activity_controller_spec.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/spec/controllers/activity_controller_spec.rb?rev=686426&r1=686425&r2=686426&view=diff
==============================================================================
--- ode/sandbox/singleshot/spec/controllers/activity_controller_spec.rb (original)
+++ ode/sandbox/singleshot/spec/controllers/activity_controller_spec.rb Fri Aug 15 17:46:52 2008
@@ -33,7 +33,6 @@
     it 'should return root element activities' do
       authenticate do
         get 'index', :format=>Mime::XML
-        p response.body
       end
     end
 

Modified: ode/sandbox/singleshot/spec/controllers/sessions_controller_spec.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/spec/controllers/sessions_controller_spec.rb?rev=686426&r1=686425&r2=686426&view=diff
==============================================================================
--- ode/sandbox/singleshot/spec/controllers/sessions_controller_spec.rb (original)
+++ ode/sandbox/singleshot/spec/controllers/sessions_controller_spec.rb Fri Aug 15 17:46:52 2008
@@ -2,81 +2,86 @@
 
 
 describe SessionsController do
+  controller_name :sessions
 
   it 'should route show/create/destroy actions to same URL' do
     route_for(:controller =>'sessions', :action=>'show').should eql('/session')
   end
 
-end
 
+  describe 'GET' do
 
-describe SessionsController, 'GET' do
+    it 'should render login page' do
+      get :show
+      response.should be_ok
+      response.should render_template('sessions/show')
+    end
 
-  it 'should render login page' do
-    get :show
-    response.should be_ok
-    response.should render_template('sessions/show')
   end
 
-end
 
+  describe 'POST' do
 
-describe SessionsController, 'POST' do
+    before :all do
+      @credentials = { :login=>'assaf', :password=>'secret' }
+      @person = person(@credentials[:login])
+    end
 
-  include Specs::Authentication
+    it 'should redirect to login page with no error if login is empty' do
+      post :create
+      response.should redirect_to(session_url)
+      flash[:error].should be_blank
+      session[:person_id].should be_nil
+    end
 
-  before :all do
-    @credentials = { :login=>'assaf', :password=>'secret' }
-    @person = person(@credentials[:login])
-  end
+    it 'should redirect to login page with error, if login/password do not match' do
+      post :create, @credentials.merge(:password=>'wrong')
+      response.should redirect_to(session_url)
+      flash[:error].should match(/no account/i)
+      session[:person_id].should be_nil
+    end
 
-  it 'should redirect to login page with no error if login is empty' do
-    post :create
-    response.should redirect_to(session_url)
-    flash[:error].should be_blank
-    session[:person_id].should be_nil
-  end
+    it 'should establish new session if authenticated' do
+      post :create, @credentials
+      flash[:error].should be_nil
+      session[:person_id].should eql(@person.id)
+    end
 
-  it 'should redirect to login page with error, if login/password do not match' do
-    post :create, @credentials.merge(:password=>'wrong')
-    response.should redirect_to(session_url)
-    flash[:error].should match(/no account/i)
-    session[:person_id].should be_nil
-  end
+    it 'should redirect to root_url if authenticated' do
+      post :create, @credentials
+      response.should redirect_to(root_url)
+    end
 
-  it 'should establish new session if authenticated' do
-    post :create, @credentials
-    flash[:error].should be_nil
-    session[:person_id].should eql(@person.id)
-  end
+    it 'should redirect to flash[:return_to] if specified' do
+      post :create, @credentials, nil, { :return_to=>'http://foo' }
+      response.should redirect_to('http://foo')
+    end
 
-  it 'should redirect to root_url if authenticated' do
-    post :create, @credentials
-    response.should redirect_to(root_url)
   end
 
-  it 'should redirect to flash[:return_to] if specified' do
-    post :create, @credentials, nil, { :return_to=>'http://foo' }
-    response.should redirect_to('http://foo')
+
+  describe 'DELETE' do
+
+    before :each do
+      session[:person_id] = 1
+    end
+
+    it 'should destroy session' do
+      delete :destroy
+      session[:person_id].should be_nil
+    end
+
+    it 'should redirect to root URL' do
+      delete :destroy
+      response.should redirect_to(root_url)
+    end
+
   end
 
 end
 
 
-describe SessionsController, 'DELETE' do
 
-  before :each do
-    session[:person_id] = 1
-  end
 
-  it 'should destroy session' do
-    delete :destroy
-    session[:person_id].should be_nil
-  end
 
-  it 'should redirect to root URL' do
-    delete :destroy
-    response.should redirect_to(root_url)
-  end
 
-end

Modified: ode/sandbox/singleshot/spec/controllers/tasks_controller_spec.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/spec/controllers/tasks_controller_spec.rb?rev=686426&r1=686425&r2=686426&view=diff
==============================================================================
--- ode/sandbox/singleshot/spec/controllers/tasks_controller_spec.rb (original)
+++ ode/sandbox/singleshot/spec/controllers/tasks_controller_spec.rb Fri Aug 15 17:46:52 2008
@@ -1,200 +1,143 @@
 require File.dirname(__FILE__) + '/../spec_helper'
 
 describe TasksController do
-
-end
-
-
-describe TasksController, 'authentication' do
-
-  include Specs::Tasks
-
-  before :all do
-    @person = person('assaf')
-  end
   
-  def session_authenticate(person)
-    session[:person_id] = person.id
-  end
-
-  def http_authenticate(login, password)
-    request.headers['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(login, password)
-  end
-
-  it 'should use session authentication for HTML requests' do
-    post :create, :task=>default_task
-    response.should redirect_to(session_url)
-  end
-
-  it 'should accept session authentication' do
-    session_authenticate @person
-    Task.should_receive(:create!)
-    post :create, :task=>default_task
-  end
+  controller_name :tasks
 
-  it 'should use HTTP Basic authentication for XML requests' do
-    post :create, :task=>default_task, :format=>'xml'
-    response.should be_unauthorized
-  end
-
-  it 'should use HTTP Basic authentication for JSON requests' do
-    post :create, :task=>default_task, :format=>'json'
-    response.should be_unauthorized
-  end
-
-  it 'should use HTTP Basic authentication if authentication header provider' do
-    http_authenticate 'assaf', 'wrong'
-    post :create, :task=>default_task
-    response.should be_unauthorized
-  end
 
-  it 'should accept HTTP Basic authentication' do
-    http_authenticate 'assaf', 'secret'
-    Task.should_receive(:create!)
-    post :create, :task=>default_task
-  end
+  describe 'POST /tasks' do
+    before :each do
+      authenticate person('assaf')
+    end
 
-  it 'should redirect to login page with return to self' do
-    post :create, :task=>default_task
-    response.should redirect_to(session_url)
-    flash[:return_to].should match(/^http:\/\/test.host\/tasks/)
-  end
+    it 'should map to /tasks/' do
+      route_for(:controller=>'tasks', :action=>'create').should eql('/tasks')
+    end
 
-end
+    it 'should create empty task if no input provided' do
+      post :create, :format=>'json'
+      response.should be_see_other
+      task = Task.find(:first)
+      task.should be_reserved
+      response.headers['Location'].should eql(task_url(task))
+    end
 
+    it 'should create task from supplied inputs' do
+      post :create, :task=>defaults, :format=>'json'
+      response.should be_created
+      task = Task.find(:first)
+      task.should be_active
+      response.headers['Location'].should eql(task_url(task))
+      defaults.each { |key, val| task.send(key).should eql(val) }
+    end
 
-describe TasksController, 'POST /tasks' do
+    it 'should infer XML as outcome MIME type from accepted content type' do
+      request.headers['CONTENT_TYPE'] = Mime::XML.to_s
+      post :create, :task=>defaults
+      Task.find(:first).outcome_type.should eql(Mime::XML.to_s)
+    end
 
-  include Specs::Tasks
+    it 'should infer JSON as outcome MIME type from accepted content type' do
+      request.headers['CONTENT_TYPE'] = Mime::JSON.to_s
+      post :create, :task=>defaults
+      Task.find(:first).outcome_type.should eql(Mime::JSON.to_s)
+    end
 
-  before :each do
-    authenticate person('assaf')
-  end
+    it 'should default to XML as outcome MIME type for all other content types' do
+      post :create, :task=>defaults
+      Task.find(:first).outcome_type.should eql(Mime::XML.to_s)
+    end
 
-  it 'should map to /tasks/' do
-    route_for(:controller=>'tasks', :action=>'create').should eql('/tasks')
-  end
+    it 'should ignore outcome MIME type in request' do
+      request.headers['CONTENT_TYPE'] = Mime::JSON.to_s
+      post :create, :task=>defaults(:outcome_type=>'application/xml')
+      Task.find(:first).outcome_type.should eql(Mime::JSON.to_s)
+    end
 
-  it 'should create empty task if no input provided' do
-    post :create, :format=>'json'
-    response.should be_see_other
-    task = Task.find(:first)
-    task.should be_reserved
-    response.headers['Location'].should eql(task_url(task))
-  end
+    it 'should add authenticated user as task admin' do
+      Task.should_receive(:create!) do |params|
+        admins = params[:admins]
+        admins.size.should eql(1)
+        admins.should include(person('assaf'))
+      end
+      post :create, :task=>defaults
+    end
 
-  it 'should create task from supplied inputs' do
-    post :create, :task=>default_task, :format=>'json'
-    response.should be_created
-    task = Task.find(:first)
-    task.should be_active
-    response.headers['Location'].should eql(task_url(task))
-    default_task.each { |key, val| task.send(key).should eql(val) }
-  end
+    it 'should set authenticated user as task admin' do
+      Task.should_receive(:create!) do |params|
+        admins = params[:admins]
+        admins.size.should eql(2)
+        admins.should include(person('assaf'), 'alex')
+      end
+      post :create, :task=>defaults(:admins=>['alex'])
+    end
 
-  it 'should infer XML as outcome MIME type from accepted content type' do
-    request.headers['CONTENT_TYPE'] = Mime::XML.to_s
-    post :create, :task=>default_task
-    Task.find(:first).outcome_type.should eql(Mime::XML.to_s)
   end
 
-  it 'should infer JSON as outcome MIME type from accepted content type' do
-    request.headers['CONTENT_TYPE'] = Mime::JSON.to_s
-    post :create, :task=>default_task
-    Task.find(:first).outcome_type.should eql(Mime::JSON.to_s)
-  end
 
-  it 'should default to XML as outcome MIME type for all other content types' do
-    post :create, :task=>default_task
-    Task.find(:first).outcome_type.should eql(Mime::XML.to_s)
-  end
+  describe 'GET /tasks/{id}' do
+    before :each do
+      @task = Task.create(defaults(@roles = all_roles))
+      authenticate person(@roles[:admins].first)
+    end
 
-  it 'should ignore outcome MIME type in request' do
-    request.headers['CONTENT_TYPE'] = Mime::JSON.to_s
-    post :create, :task=>default_task.merge(:outcome_type=>'application/xml')
-    Task.find(:first).outcome_type.should eql(Mime::JSON.to_s)
-  end
+    it 'should map to /tasks/{id}' do
+      route_for(:controller=>'tasks', :action=>'show', :id=>1).should eql('/tasks/1')
+      lambda { route_for(:controller=>'tasks', :action=>'show') }.should raise_error(ActionController::RoutingError)
+    end
 
-  it 'should add authenticated user as task admin' do
-    Task.should_receive(:create!) do |params|
-      admins = params[:admins]
-      admins.size.should eql(1)
-      admins.should include(person('assaf'))
+    it 'should 404 if task not found' do
+      lambda { get :show, :id=>0 }.should raise_error(ActiveRecord::RecordNotFound)
     end
-    post :create, :task=>default_task
-  end
 
-  it 'should set authenticated user as task admin' do
-    Task.should_receive(:create!) do |params|
-      admins = params[:admins]
-      admins.size.should eql(2)
-      admins.should include(person('assaf'), 'alex')
+    it 'should 404 if task not yet active' do
+      task = Task.reserve!(authenticated)
+      lambda { get :show, :id=>task.id }.should raise_error(ActiveRecord::RecordNotFound)
     end
-    post :create, :task=>default_task.merge(:admins=>['alex'])
-  end
 
-end
+    it 'should 404 if task already cancelled' do
+      @task.status = :cancelled ; @task.save!
+      lambda { get :show, :id=>@task.id }.should raise_error(ActiveRecord::RecordNotFound)
+    end
 
+    it 'should 404 unless allowed to view task' do
+      authenticate person('noone')
+      lambda { get :show, :id=>@task.id }.should raise_error(ActiveRecord::RecordNotFound)
+    end
 
-describe TasksController, 'GET /tasks/{id}' do
-  include Specs::Tasks
+    it 'should not be visible to admin' do
+      lambda { get :show, :id=>@task.id }.should_not raise_error
+    end
 
-  before :each do
-    @task = Task.create(default_task.merge(@roles = all_roles))
-    authenticate person(@roles[:admins].first)
-  end
+    it 'should not be visible to owner' do
+      authenticate @roles[:owner]
+      lambda { get :show, :id=>@task.id }.should_not raise_error
+    end
 
-  it 'should map to /tasks/{id}' do
-    route_for(:controller=>'tasks', :action=>'show', :id=>1).should eql('/tasks/1')
-    lambda { route_for(:controller=>'tasks', :action=>'show') }.should raise_error(ActionController::RoutingError)
-  end
+    it 'should not be visible to potential owner' do
+      authenticate @roles[:potential_owners].first
+      lambda { get :show, :id=>@task.id }.should_not raise_error
+    end
 
-  it 'should 404 if task not found' do
-    lambda { get :show, :id=>0 }.should raise_error(ActiveRecord::RecordNotFound)
-  end
+    it 'should not be visible to excluded owners' do
+      authenticate @task.potential_owners[1]
+      @task.update_attributes! :excluded_owners=>[authenticated]
+      lambda { get :show, :id=>@task.id }.should raise_error(ActiveRecord::RecordNotFound)
+    end
 
-  it 'should 404 if task not yet active' do
-    task = Task.reserve!(authenticated)
-    lambda { get :show, :id=>task.id }.should raise_error(ActiveRecord::RecordNotFound)
   end
 
-  it 'should 404 if task already cancelled' do
-    @task.status = :cancelled ; @task.save!
-    lambda { get :show, :id=>@task.id }.should raise_error(ActiveRecord::RecordNotFound)
-  end
 
-  it 'should 404 unless allowed to view task' do
-    authenticate person('noone')
-    lambda { get :show, :id=>@task.id }.should raise_error(ActiveRecord::RecordNotFound)
-  end
+end
 
-  it 'should not be visible to admin' do
-    lambda { get :show, :id=>@task.id }.should_not raise_error
-  end
 
-  it 'should not be visible to owner' do
-    authenticate @roles[:owner]
-    lambda { get :show, :id=>@task.id }.should_not raise_error
-  end
 
-  it 'should not be visible to potential owner' do
-    authenticate @roles[:potential_owners].first
-    lambda { get :show, :id=>@task.id }.should_not raise_error
-  end
 
-  it 'should not be visible to excluded owners' do
-    authenticate @task.potential_owners[1]
-    @task.update_attributes! :excluded_owners=>[authenticated]
-    lambda { get :show, :id=>@task.id }.should raise_error(ActiveRecord::RecordNotFound)
-  end
 
-end
 
 
 
 describe TasksController, 'PUT task', :shared=>true do
-  include Specs::Tasks
-
   before :all do
     @admin, @owner = people('admin', 'owner')
     @observer, @excluded = people('observer', 'excluded')
@@ -202,7 +145,7 @@
   end
 
   before :each do
-    @task = Task.create!(default_task.merge(:admins=>@admin, :potential_owners=>@potential,
+    @task = Task.create!(defaults(:admins=>@admin, :potential_owners=>@potential,
       :excluded_owners=>@excluded, :observers=>@observer))
     controller.use_rails_error_handling!
   end
@@ -215,8 +158,6 @@
 end
 
 describe TasksController, 'PUT reserved task' do
-  include Specs::Tasks
-
   before :each do
     authenticate person('admin')
     @task = Task.reserve!(authenticated)
@@ -231,59 +172,59 @@
 
   it 'should 404 if not associated with task' do
     authenticate person('unknown')
-    put :update, :id=>@task.id, :task=>default_task
+    put :update, :id=>@task.id, :task=>defaults
     response.should be_not_found
     @task.reload.should be_reserved
   end
 
   it 'should 200 and redirect back if task updated' do
-    put :update, :id=>@task.id, :task=>default_task
+    put :update, :id=>@task.id, :task=>defaults
     response.should redirect_to(task_url)
   end
 
   it 'should update task' do
-    put :update, :id=>@task.id, :task=>default_task
+    put :update, :id=>@task.id, :task=>defaults
     @task.reload
-    default_task.each do |key, value|
+    defaults.each do |key, value|
       @task.send(key).should eql(value)
     end
   end
 
   it 'should change task status to active' do
-    put :update, :id=>@task.id, :task=>default_task
+    put :update, :id=>@task.id, :task=>defaults
     @task.reload.should be_active
   end
 
   it 'should retain task administrator if no admins specified' do
-    put :update, :id=>@task.id, :task=>default_task.except(:admins)
+    put :update, :id=>@task.id, :task=>defaults.except(:admins)
     @task.reload.admins.should eql([authenticated])
   end
 
   it 'should retain authenticated admin when other admins specified' do
     admins = people('foo', 'bar')
-    put :update, :id=>@task.id, :task=>default_task.merge(:admins=>admins)
+    put :update, :id=>@task.id, :task=>defaults(:admins=>admins)
     @task.reload.admins.sort_by(&:id).should eql([authenticated] + admins)
   end
 
   it 'should 422 if task does not validate' do
-    put :update, :id=>@task.id, :task=>default_task.except(:title)
+    put :update, :id=>@task.id, :task=>defaults.except(:title)
     response.should be_unprocessable_entity
   end
 
   it 'should determine outcome type from content type if XML' do
     request.headers['CONTENT_TYPE'] = 'application/xml'
-    put :update, :id=>@task.id, :task=>default_task
+    put :update, :id=>@task.id, :task=>defaults
     @task.reload.outcome_type.should eql('application/xml')
   end
 
   it 'should determine outcome type from content type if JSON' do
     request.headers['CONTENT_TYPE'] = 'application/json'
-    put :update, :id=>@task.id, :task=>default_task
+    put :update, :id=>@task.id, :task=>defaults
     @task.reload.outcome_type.should eql('application/json')
   end
 
   it 'should allow changing of outcome type' do
-    put :update, :id=>@task.id, :task=>default_task.merge(:outcome_type=>'application/json')
+    put :update, :id=>@task.id, :task=>defaults(:outcome_type=>'application/json')
     @task.reload.outcome_type.should eql('application/json')
   end
  
@@ -300,7 +241,7 @@
 
   it 'should 404 if not associated with task' do
     authenticate person('unknown')
-    put :update, :id=>@task.id, :task=>default_task
+    put :update, :id=>@task.id, :task=>defaults
     response.should be_not_found
   end
 
@@ -408,7 +349,7 @@
   it 'should allow owner to change task data' do
     authenticate @owner
     put :update, :id=>@task.id, :task=>{ :title=>'changed', :data=>{ 'foo'=>'bar'  } }
-    @task.reload.title.should eql(default_task[:title])
+    @task.reload.title.should eql(defaults[:title])
     @task.data.should == { 'foo'=>'bar' }
   end
 
@@ -492,21 +433,21 @@
 
   it 'should 404 if not associated with task' do
     authenticate person('unknown')
-    put :update, :id=>@task.id, :task=>default_task
+    put :update, :id=>@task.id, :task=>defaults
     response.should be_not_found
     @task.reload.should be_completed
   end
 
   it 'should 409 if associated with task' do
     authenticate @admin
-    put :update, :id=>@task.id, :task=>default_task
+    put :update, :id=>@task.id, :task=>defaults
     response.should be_conflict
     @task.reload.should be_completed
   end
 
   it 'should not change task' do
     authenticate @admin
-    put :update, :id=>@task.id, :task=>default_task.merge(:title=>'changed')
+    put :update, :id=>@task.id, :task=>defaults(:title=>'changed')
     @task.reload.title.should_not eql('changed')
   end
 
@@ -519,14 +460,14 @@
 
   it 'should 404 if not associated with task' do
     authenticate person('unknown')
-    put :update, :id=>@task.id, :task=>default_task
+    put :update, :id=>@task.id, :task=>defaults
     response.should be_not_found
     @task.reload.should be_cancelled
   end
 
   it 'should 404 if associated with task' do
     authenticate @admin
-    put :update, :id=>@task.id, :task=>default_task
+    put :update, :id=>@task.id, :task=>defaults
     response.should be_not_found
     @task.reload.should be_cancelled
   end
@@ -535,11 +476,9 @@
 
 
 describe TasksController, 'DELETE task', :shared=>true do
-  include Specs::Tasks
-
   before :each do
     @admin, @owner = people('admin', 'owner')
-    @task = Task.create!(default_task.merge(:admins=>@admin, :owner=>@owner))
+    @task = Task.create!(defaults(:admins=>@admin, :owner=>@owner))
     controller.use_rails_error_handling!
   end
   
@@ -551,8 +490,6 @@
 end
 
 describe TasksController, 'DELETE reserved task' do
-  include Specs::Tasks
-
   before :each do
     @admin = person('admin')
     @task = Task.reserve!(@admin)
@@ -690,11 +627,9 @@
 
 
 describe TasksController, 'POST task', :shared=>true do
-  include Specs::Tasks
-
   before :each do
     @admin, @owner = people('admin', 'owner')
-    @task = Task.create!(default_task.merge(:admins=>@admin, :owner=>@owner))
+    @task = Task.create!(defaults(:admins=>@admin, :owner=>@owner))
     controller.use_rails_error_handling!
   end
   
@@ -710,8 +645,6 @@
 end
 
 describe TasksController, 'POST reserved task' do
-  include Specs::Tasks
-
   before :each do
     @admin = person('admin')
     @task = Task.reserve!(@admin)
@@ -828,11 +761,9 @@
 
 
 describe TasksController, 'token authentication' do
-  include Specs::Tasks
-
   before :each do
-    @task = Task.create(default_task.merge(:owner=>person('owner'), :potential_owners=>person('excluded'),
-                                           :excluded_owners=>person('excluded')))
+    @task = Task.create(defaults(:owner=>person('owner'), :potential_owners=>person('excluded'),
+                                                         :excluded_owners=>person('excluded')))
   end
 
   def authenticate(person)

Modified: ode/sandbox/singleshot/spec/people.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/spec/people.rb?rev=686426&r1=686425&r2=686426&view=diff
==============================================================================
--- ode/sandbox/singleshot/spec/people.rb (original)
+++ ode/sandbox/singleshot/spec/people.rb Fri Aug 15 17:46:52 2008
@@ -28,23 +28,13 @@
     #
     # Without arguments, authenticates as 'person'.
     def authenticate(person = person('person'))
-      #credentials = [person.identity, 'secret']
-      #request.headers['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(*credentials)
+      previous, session[:person_id] = session[:person_id], person.id
       if block_given?
         begin
-          previous, session[:person_id] = session[:person_id], person.id
-          credentials = [person.identity, 'secret']
-          request.headers['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(*credentials)
-          p 'here'
           yield
         ensure
           session[:person_id] = previous
-          request.headers.delete('HTTP_AUTHORIZATION')
         end
-      else
-        session[:person_id] = person.is
-        credentials = [person.identity, 'secret']
-        request.headers['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(*credentials)
       end
     end
 
@@ -63,7 +53,7 @@
 
 
 Spec::Runner.configure do |config|
-  config.include SpecHelpers::People, :type=>:model
-  config.include SpecHelpers::People, :type=>:controller
+  config.include SpecHelpers::People
+  config.include SpecHelpers::People
   config.include SpecHelpers::Authentication, :type=>:controller
-end
+end
\ No newline at end of file

Modified: ode/sandbox/singleshot/spec/tasks.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/spec/tasks.rb?rev=686426&r1=686425&r2=686426&view=diff
==============================================================================
--- ode/sandbox/singleshot/spec/tasks.rb (original)
+++ ode/sandbox/singleshot/spec/tasks.rb Fri Aug 15 17:46:52 2008
@@ -48,6 +48,5 @@
 end
 
 Spec::Runner.configure do |config|
-  config.include SpecHelpers::Tasks, :type=>:model
-  config.include SpecHelpers::Tasks, :type=>:controller
+  config.include SpecHelpers::Tasks
 end