Skip to content

Commit

Permalink
use rspec for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Sep 4, 2011
1 parent 89e08b1 commit 447808d
Show file tree
Hide file tree
Showing 16 changed files with 199 additions and 194 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -2,3 +2,4 @@ source "http://rubygems.org"
gemspec

gem "appraisal"
gem "rspec-rails"
27 changes: 19 additions & 8 deletions Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
paul_revere (0.1.5)
paul_revere (0.1.6)
rails (~> 3.0)

GEM
Expand Down Expand Up @@ -41,9 +41,8 @@ GEM
rake
arel (2.2.1)
bcrypt-ruby (3.0.0)
bourne (1.0)
mocha (= 0.9.8)
builder (3.0.0)
diff-lcs (1.1.3)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
Expand All @@ -52,8 +51,7 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
mocha (0.9.8)
rake
mocha (0.9.12)
multi_json (1.0.3)
polyglot (0.3.2)
rack (1.3.2)
Expand Down Expand Up @@ -82,7 +80,19 @@ GEM
thor (~> 0.14.6)
rake (0.9.2)
rdoc (3.9.4)
shoulda (2.11.3)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.6.0)
sprockets (2.0.0)
hike (~> 1.2)
rack (~> 1.0)
Expand All @@ -100,7 +110,8 @@ PLATFORMS

DEPENDENCIES
appraisal
bourne
mocha
paul_revere!
shoulda
rspec
rspec-rails
sqlite3
56 changes: 13 additions & 43 deletions Rakefile
@@ -1,61 +1,31 @@
# encoding: UTF-8
require 'rubygems'
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end

require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require "rubygems/package_task"
require 'appraisal'

require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

desc "Default: run the unit tests."
task :default => [:all]

desc 'Test the plugin under all supported Rails versions.'
task :all => ["appraisal:install"] do |t|
exec('rake appraisal test')
end

desc 'Default: run unit tests.'
task :default => :test

desc 'Test the paul revere plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
exec('rake appraisal spec')
end

desc 'Generate documentation for the paul revere plugin.'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'PaulRevere'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end

spec = Gem::Specification.new do |s|
s.name = "paul_revere"
s.version = "0.1.5"
s.summary = "Simple announcement plugin to include 'one off' style announcements in Rails web apps."
s.author = "Thoughtbot"
s.email = "support@thoughtbot.com"
s.homepage = "https://github.com/thoughtbot/paul_revere"
s.has_rdoc = true
s.extra_rdoc_files = %w(README.textile)
s.rdoc_options = %w(--main README.textile)
s.files = %w(init.rb MIT-LICENSE Rakefile README.textile) +
Dir.glob("{test,lib/**/*,app/**/*}")
s.require_paths = ["lib"]

s.add_dependency("rails", "~> 3.0.0")
s.add_development_dependency("bourne")
s.add_development_dependency("shoulda")
s.add_development_dependency("redgreen")
end

desc "Build the gemspec file #{spec.name}.gemspec"
task :gemspec do
file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
File.open(file, "w") {|f| f << spec.to_ruby }
end

task :package => :gemspec
1 change: 1 addition & 0 deletions gemfiles/3.0.10.gemfile
Expand Up @@ -3,6 +3,7 @@
source "http://rubygems.org"

gem "appraisal"
gem "rspec-rails"
gem "rails", "3.0.10"

gemspec :path=>"../"
27 changes: 19 additions & 8 deletions gemfiles/3.0.10.gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: /Users/mjankowski/Development/paul_revere
specs:
paul_revere (0.1.5)
paul_revere (0.1.6)
rails (~> 3.0)

GEM
Expand Down Expand Up @@ -38,9 +38,8 @@ GEM
bundler
rake
arel (2.0.10)
bourne (1.0)
mocha (= 0.9.8)
builder (2.1.2)
diff-lcs (1.1.3)
erubis (2.6.6)
abstract (>= 1.0.0)
i18n (0.5.0)
Expand All @@ -50,8 +49,7 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
mocha (0.9.8)
rake
mocha (0.9.12)
polyglot (0.3.2)
rack (1.2.3)
rack-mount (0.6.14)
Expand All @@ -74,7 +72,19 @@ GEM
thor (~> 0.14.4)
rake (0.9.2)
rdoc (3.9.4)
shoulda (2.11.3)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.6.0)
sqlite3 (1.3.4)
thor (0.14.6)
treetop (1.4.10)
Expand All @@ -87,8 +97,9 @@ PLATFORMS

DEPENDENCIES
appraisal
bourne
mocha
paul_revere!
rails (= 3.0.10)
shoulda
rspec
rspec-rails
sqlite3
1 change: 1 addition & 0 deletions gemfiles/3.1.0.gemfile
Expand Up @@ -3,6 +3,7 @@
source "http://rubygems.org"

gem "appraisal"
gem "rspec-rails"
gem "rails", "3.1.0"
gem "sass-rails"
gem "coffee-script"
Expand Down
27 changes: 19 additions & 8 deletions gemfiles/3.1.0.gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: /Users/mjankowski/Development/paul_revere
specs:
paul_revere (0.1.5)
paul_revere (0.1.6)
rails (~> 3.0)

GEM
Expand Down Expand Up @@ -41,13 +41,12 @@ GEM
rake
arel (2.2.1)
bcrypt-ruby (3.0.0)
bourne (1.0)
mocha (= 0.9.8)
builder (3.0.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.1.2)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.2.4)
multi_json (~> 1.0)
Expand All @@ -61,8 +60,7 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
mocha (0.9.8)
rake
mocha (0.9.12)
multi_json (1.0.3)
polyglot (0.3.2)
rack (1.3.2)
Expand Down Expand Up @@ -91,12 +89,24 @@ GEM
thor (~> 0.14.6)
rake (0.9.2)
rdoc (3.9.4)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.6.0)
sass (3.1.7)
sass-rails (3.1.0)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass (>= 3.1.4)
shoulda (2.11.3)
sprockets (2.0.0)
hike (~> 1.2)
rack (~> 1.0)
Expand All @@ -117,12 +127,13 @@ PLATFORMS

DEPENDENCIES
appraisal
bourne
coffee-script
jquery-rails
mocha
paul_revere!
rails (= 3.1.0)
rspec
rspec-rails
sass-rails
shoulda
sqlite3
uglifier
50 changes: 13 additions & 37 deletions paul_revere.gemspec
@@ -1,39 +1,15 @@
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{paul_revere}
s.version = "0.1.5"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Thoughtbot"]
s.date = %q{2010-10-16}
s.email = %q{support@thoughtbot.com}
s.extra_rdoc_files = ["README.textile"]
s.files = ["init.rb", "MIT-LICENSE", "Rakefile", "README.textile", "test", "lib/generators", "lib/generators/paul_revere", "lib/generators/paul_revere/paul_revere_generator.rb", "lib/generators/paul_revere/templates", "lib/generators/paul_revere/templates/announcements.js", "lib/generators/paul_revere/templates/migration.rb", "lib/generators/paul_revere/USAGE", "lib/paul_revere.rb", "app/helpers", "app/helpers/announcements_helper.rb", "app/models", "app/models/announcement.rb", "app/views", "app/views/announcements", "app/views/announcements/_announcement.html.erb", "app/views/announcements/_announcement_for_all.html.erb", "app/views/announcements/_email_announcement.erb"]
s.homepage = %q{http://thoughtbot.com/community}
s.rdoc_options = ["--main", "README.textile"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
s.summary = %q{Simple announcement plugin to include 'one off' style announcements in Rails web apps.}

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<rails>, ["~> 3.0"])
s.add_development_dependency(%q<bourne>, [">= 0"])
s.add_development_dependency(%q<shoulda>, [">= 0"])
s.add_development_dependency(%q<sqlite3>, [">= 0"])
else
s.add_dependency(%q<rails>, ["~> 3.0"])
s.add_dependency(%q<bourne>, [">= 0"])
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<sqlite3>, [">= 0"])
end
else
s.add_dependency(%q<rails>, ["~> 3.0"])
s.add_dependency(%q<bourne>, [">= 0"])
s.add_dependency(%q<sqlite3>, [">= 0"])
end
s.name = "paul_revere"
s.version = "0.1.6"
s.date = %q{2011-09-04}
s.email = "support@thoughtbot.com"
s.homepage = "https://github.com/thoughtbot/paul_revere"
s.summary = "Simple announcement plugin to include 'one off' style announcements in Rails web apps."
s.description = "Paul Revere provides a model and helper methods to do one-off style announcements."
s.files = Dir["{app,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "Gemfile", "README.md", "init.rb"]
s.authors = ['Nick Quaranto', 'Matt Jankowski', 'Joe Ferris', 'Christopher Meiklejohn', 'Tammer Saleh', 'Jason Morrison', 'Gabe Berke-Williams']
s.add_dependency("rails", "~> 3.0")
s.add_development_dependency("rspec")
s.add_development_dependency("sqlite3")
s.add_development_dependency("mocha")
end
16 changes: 16 additions & 0 deletions spec/fake_app.rb
@@ -0,0 +1,16 @@
# Create a rails app
module PaulRevere
class Application < Rails::Application
end
end

# Run migrations
project_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
require File.join project_root, 'lib', 'generators', 'paul_revere', 'templates', 'migration'

ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => ":memory:"
)

CreateAnnouncements.suppress_messages { CreateAnnouncements.up }

0 comments on commit 447808d

Please sign in to comment.