Skip to content

Commit

Permalink
rspec2
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Beer committed Dec 12, 2011
1 parent 0583c8c commit 660aba7
Show file tree
Hide file tree
Showing 47 changed files with 74 additions and 84 deletions.
12 changes: 10 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ GEM
ffi (~> 1.0.6)
columnize (0.3.4)
daemons (1.1.4)
diff-lcs (1.1.3)
equivalent-xml (0.2.8)
nokogiri (>= 1.4.3)
facets (2.9.2)
Expand Down Expand Up @@ -81,7 +82,14 @@ GEM
mime-types (>= 1.16)
rsolr (1.0.2)
builder (>= 2.1.2)
rspec (1.3.2)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.7.0)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
Expand Down Expand Up @@ -133,7 +141,7 @@ DEPENDENCIES
mocha (>= 0.9.8)
rake
rcov
rspec (< 2.0.0)
rspec (~> 2.0)
ruby-debug
solrizer-fedora (>= 1.1.3)
yard
7 changes: 4 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ require 'rubygems'
require 'bundler'
require "bundler/setup"


$: << 'lib'

Bundler::GemHelper.install_tasks

# load rake tasks defined in lib/tasks
Dir["lib/tasks/**/*.rake"].each { |ext| load ext } if defined?(Rake)

CLEAN.include %w[**/.DS_Store tmp *.log *.orig *.tmp **/*~]

task :spec => ['active_fedora:rspec']
task :rcov => ['active_fedora:rcov']


task :default => [:spec]
2 changes: 1 addition & 1 deletion active-fedora.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Gem::Specification.new do |s|
s.add_development_dependency("rcov")
s.add_development_dependency("solrizer-fedora", ">=1.1.3") # used by the fixtures rake tasks
s.add_development_dependency("jettywrapper", ">=1.1.0")
s.add_development_dependency("rspec", "<2.0.0")
s.add_development_dependency("rspec", "~> 2.0")
s.add_development_dependency("mocha", ">= 0.9.8")
s.add_development_dependency("ruby-debug")

Expand Down
8 changes: 5 additions & 3 deletions config/jetty.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
jetty_port: 8983
java_opts:
- "-Xmx256m -XX:MaxPermSize=128m"
default:
jetty_port: 8983
java_opts:
- "-Xmx256m"
- "-XX:MaxPermSize=128m"
41 changes: 11 additions & 30 deletions lib/tasks/active_fedora_dev.rake
Original file line number Diff line number Diff line change
@@ -1,32 +1,9 @@
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

APP_ROOT = File.expand_path("#{File.dirname(__FILE__)}/../../")
require 'jettywrapper'

$: << 'lib'

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

desc "Hudson build"
task :hudson do

ENV['environment'] = "test"
Rake::Task["active_fedora:doc"].invoke
Rake::Task["active_fedora:configure_jetty"].invoke
Expand All @@ -46,7 +23,7 @@ namespace :active_fedora do
begin
require 'yard'
require 'yard/rake/yardoc_task'
project_root = File.expand_path("#{File.dirname(__FILE__)}/../../")
project_root = APP_ROOT
doc_destination = File.join(project_root, 'doc')

YARD::Rake::YardocTask.new(:doc) do |yt|
Expand All @@ -61,12 +38,16 @@ namespace :active_fedora do
end
end

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:rspec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
spec.pattern += FileList['spec/*_spec.rb']
end

Spec::Rake::SpecTask.new(:rspec) do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.rcov = true
t.rcov_opts << ['--exclude', 'gems']
t.rcov_opts << ['--exclude', 'spec']
RSpec::Core::RakeTask.new(:rcov) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
spec.pattern += FileList['spec/*_spec.rb']
spec.rcov = true
end

task :clean_jetty do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/base_file_management_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

describe ActiveFedora::Base do

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/base_find_by_fields_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "..", "spec_helper" )
require 'spec_helper'

class MockAFBaseQuerySolr < ActiveFedora::Base
has_metadata :name => "properties", :type => ActiveFedora::MetadataDatastream do |m|
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/base_loader_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "..", "spec_helper" )
require 'spec_helper'
require 'active_fedora'
require 'active_fedora/base'
require 'active_fedora/metadata_datastream'
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/base_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

class MockAFBaseRelationship < ActiveFedora::Base
has_relationship "testing", :has_part, :type=>MockAFBaseRelationship
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/bug_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "..", "spec_helper" )
require 'spec_helper'

require 'active_fedora'
require 'active_fedora/model'
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/datastream_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require "rexml/document"
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/full_featured_model_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'
require 'rexml/document'
require "active_fedora/samples"

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/metadata_datastream_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active-fedora'
require "rexml/document"
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/model_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "..", "spec_helper" )
require 'spec_helper'

require 'active_fedora'
require 'active_fedora/model'
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/mods_article_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'
require "active_fedora/samples"

describe ActiveFedora::Base do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/nokogiri_datastream_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'
require "active_fedora/samples"
require "solrizer"

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/rels_ext_datastream_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require "rexml/document"
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/semantic_node_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/solr_service_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'

Expand Down
2 changes: 1 addition & 1 deletion spec/rails3_test_app/spec/unit/rails_3_init.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), '../spec_helper')
require 'spec_helper'

describe "initializing active-fedora in a rails 3 app" do
it "should include ActiveFedora::Railtie" do
Expand Down
6 changes: 2 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
ENV["environment"] ||= 'test'
require "bundler/setup"
require 'active-fedora'
require 'spec'
require 'rspec'
require 'equivalent-xml/rspec_matchers'

require 'support/mock_fedora'


logger.level = Logger::WARN if logger.respond_to? :level ###MediaShelf StubLogger doesn't have a level= method

$:.unshift(File.dirname(__FILE__) + '/../lib')
$VERBOSE=nil

# This loads the Fedora and Solr config info from /config/fedora.yml
# You can load it from a different location by passing a file path as an argument.
ActiveFedora.init(:fedora_config_path=>File.join(File.dirname(__FILE__), "..", "config", "fedora.yml"))

Spec::Runner.configure do |config|
RSpec.configure do |config|
config.mock_with :mocha
end

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/active_fedora_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

# For testing Module-level methods like ActiveFedora.init

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/base_active_model_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

describe ActiveFedora::Base do

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/base_cma_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

describe ActiveFedora::Base do

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/base_datastream_management_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

describe ActiveFedora::Base do

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/base_delegate_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

describe ActiveFedora::Base do

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/base_extra_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'
require 'active_fedora'
require 'active_fedora/base'
require 'active_fedora/metadata_datastream'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/base_file_management_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'spec_helper'

# Some tentative extensions to ActiveFedora::Base

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/base_named_datastream_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'spec_helper'
require "active_fedora"

# Some tentative extensions to ActiveFedora::Base
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/base_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require 'active_fedora/base'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/content_model_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require 'mocha'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/datastream_concurrency_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require "rexml/document"
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/datastream_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require "nokogiri"
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/inheritance_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require 'active_fedora/base'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/metadata_datastream_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require 'active_fedora/metadata_datastream'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/model_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require 'active_fedora/model'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/nokogiri_datastream_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'
require "active_fedora/samples"
describe ActiveFedora::NokogiriDatastream do

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/property_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require 'active_fedora/model'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/qualified_dublin_core_datastream_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require 'xmlsimple'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/rdf_xml_writer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'
require File.join( File.dirname(__FILE__), "../../lib/active_fedora/rdf_xml_writer" )

describe ActiveFedora::RDFXMLWriter do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/relationship_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require "rexml/document"
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/relationships_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'active_fedora'
require 'xmlsimple'
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/rels_ext_datastream_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

describe ActiveFedora::RelsExtDatastream do
describe "short_predicate" do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/rubydora_connection_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'
require 'active_fedora/rubydora_connection'

describe ActiveFedora::RubydoraConnection do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/semantic_node_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'

require 'xmlsimple'

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/solr_config_options_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join( File.dirname(__FILE__), "../spec_helper" )
require 'spec_helper'


#include ActiveFedora
Expand Down
Loading

0 comments on commit 660aba7

Please sign in to comment.