Skip to content

Commit

Permalink
HYDRA-455: removing unused spec tasks, cleaning up execution of rake …
Browse files Browse the repository at this point in the history
…tasks, updating README, addressing bug reported by molly in comments on HYDRA-455
  • Loading branch information
flyingzumwalt committed May 19, 2011
1 parent 4059443 commit 4709ebc
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 43 deletions.
34 changes: 23 additions & 11 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ h2. Getting Started

The "ActiveFedora Console Tour":https://github.com/mediashelf/active_fedora/blob/master/CONSOLE_GETTING_STARTED.textile gives you a brief tour through ActiveFedora's features on the command line.

h2. Testing
h2. Installation

In order to run the RSpec tests, you need to have a copy of the ActiveFedora source code, and then run bundle install in the source directory.

Expand All @@ -28,7 +28,19 @@ cd /wherever/active_fedora/is
bundle install
</pre>

You also need to have a copy of hydra-jetty running. To do this, download a working copy of "hydra-jetty":https://github.com/projecthydra/hydra-jetty, cd into its root and run
h2. Testing with Hudson Rake Task

The hudson rake task will spin up jetty, import the fixtures, and run the tests for you.

<pre>
rake hudson
</pre>

h2. Testing Manually

If you want to run the tests manually, follow these instructions.

You need to have a copy of hydra-jetty running. To do this, download a working copy of "hydra-jetty":https://github.com/projecthydra/hydra-jetty, cd into its root and run

<pre>
java -jar start.jar
Expand All @@ -37,22 +49,22 @@ java -jar start.jar
Then open a new terminal, go to your ActiveFedora source directory, and import fedora's demo objects.

<pre>
cd /wherever/active_fedora/is
export FEDORA_HOME=/path/to/hydra/jetty/fedora/default
$FEDORA_HOME/client/bin/fedora-ingest-demos.sh localhost 8983 fedoraAdmin fedoraAdmin http
rake active_fedora:load_fixtures RAILS_ENV=test
</pre>
You must ingest one fixture using the import_fixture rake task provided by the hydra project.

This does the equivalent of:

<pre>
rake fedora:import_fixture pid=hydrangea_fixture_mods_article1
cd /wherever/active_fedora/is
export FEDORA_HOME=/path/to/hydra/jetty/fedora/default
$FEDORA_HOME/client/bin/fedora-ingest-demos.sh localhost 8983 fedoraAdmin fedoraAdmin http
rake af:import_fixture pid=hydrangea:fixture_mods_article1 RAILS_ENV=test
</pre>

Now you're ready to run
Now you're ready to run the tests. In the directory where active_fedora is installed, run

<pre>
cd /wherever/active_fedora/is
rake spec
rake spec
</pre>

h2. Acknowledgements
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'rake/clean'
require 'rubygems'
load 'lib/tasks/rspec.rake'

$: << 'lib'

Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/active_fedora.rake
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace :af do
file = File.new(filename, "r")
result = foxml = Fedora::Repository.instance.ingest(file.read)
if result
puts "The fixture has been ingested as #{result}"
puts "The fixture has been ingested as #{result.body}"
if !pid.nil?
solrizer = Solrizer::Fedora::Solrizer.new
solrizer.solrize(pid)
Expand Down
23 changes: 22 additions & 1 deletion lib/tasks/active_fedora_dev.rake
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
begin
require 'spec'
rescue LoadError
require 'rubygems'
require 'spec'
end
begin
require 'spec/rake/spectask'
rescue LoadError
puts <<-EOS
To use rspec for testing you must install rspec gem:
gem install rspec
EOS
exit(0)
end

$: << 'lib'

desc "Run active-fedora rspec tests"
task :spec do
Rake::Task["active_fedora:rspec"].invoke
end

desc "Hudson build"
task :hudson do
require 'jettywrapper'
Expand Down Expand Up @@ -29,7 +50,6 @@ task :hudson do
end
end


namespace :active_fedora do
require 'lib/active-fedora'

Expand Down Expand Up @@ -115,6 +135,7 @@ desc 'Set up ActiveFedora environment. !! Only for use while working within a w
task :environment do
puts "Initializing ActiveFedora Rake environment. This should only be called when working within a workign copy of the active-fedora code."
require 'spec/samples/models/hydrangea_article'
require 'active_fedora/samples'
# $:.unshift(File.dirname(__FILE__) + '/../lib')
# Dir[File.join(File.dirname(__FILE__)+'/../lib/')+'**/*.rb'].each{|x| require x}
end
29 changes: 0 additions & 29 deletions lib/tasks/rspec.rake

This file was deleted.

0 comments on commit 4709ebc

Please sign in to comment.