Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use bundler for managing gems and rspec for testing

  • Loading branch information...
commit 574c75d1e59c794e8d9357f700cf024f0948fcaf 1 parent f929866
Gary Or authored
View
1  .rspec
@@ -0,0 +1 @@
+--color
View
10 Gemfile
@@ -0,0 +1,10 @@
+source "http://rubygems.org"
+gem "oauth"
+gem "hashie"
+gem "httparty"
+gem "rake"
+gem "rspec", "~> 2.0"
+gem "jeweler"
+gem "rb-fsevent"
+gem "guard-rspec"
+gem "growl_notify"
View
46 Gemfile.lock
@@ -0,0 +1,46 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ crack (0.1.8)
+ diff-lcs (1.1.2)
+ git (1.2.5)
+ growl_notify (0.0.1)
+ rb-appscript
+ guard (0.6.0)
+ thor (~> 0.14.6)
+ guard-rspec (0.4.1)
+ guard (>= 0.4.0)
+ hashie (1.1.0)
+ httparty (0.7.8)
+ crack (= 0.1.8)
+ jeweler (1.6.4)
+ bundler (~> 1.0)
+ git (>= 1.2.5)
+ rake
+ oauth (0.4.5)
+ rake (0.9.2)
+ rb-appscript (0.6.1)
+ rb-fsevent (0.4.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)
+ thor (0.14.6)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ growl_notify
+ guard-rspec
+ hashie
+ httparty
+ jeweler
+ oauth
+ rake
+ rb-fsevent
+ rspec (~> 2.0)
View
9 Guardfile
@@ -0,0 +1,9 @@
+# A sample Guardfile
+# More info at https://github.com/guard/guard#readme
+
+guard 'rspec', :version => 2 do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec/" }
+end
+
View
47 Rakefile
@@ -1,5 +1,18 @@
require 'rubygems'
+require 'bundler/setup'
require 'rake'
+require 'rspec/core/rake_task'
+
+desc 'Default: Run the specs'
+task :default => 'spec:unit'
+
+namespace :spec do
+ desc 'Run unit specs'
+ RSpec::Core::RakeTask.new('unit') do |t|
+ t.pattern = 'spec/{*_spec.rb,weibo/**/*_spec.rb}'
+ end
+end
+task :spec => 'spec:unit'
begin
require 'jeweler'
@@ -20,37 +33,3 @@ begin
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
-
-require 'rake/testtask'
-Rake::TestTask.new(:test) do |test|
- test.libs << 'lib' << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
-end
-
-begin
- require 'rcov/rcovtask'
- Rcov::RcovTask.new do |test|
- test.libs << 'test'
- test.pattern = 'test/**/test_*.rb'
- test.verbose = true
- end
-rescue LoadError
- task :rcov do
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
- end
-end
-
-task :test => :check_dependencies
-
-task :default => :test
-
-require 'rake/rdoctask'
-Rake::RDocTask.new do |rdoc|
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
-
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "weibo #{version}"
- rdoc.rdoc_files.include('README*')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
View
8 lib/weibo.rb
@@ -1,13 +1,7 @@
require 'forwardable'
require 'rubygems'
-
-gem 'oauth', '~> 0.4.1'
require 'oauth'
-
-gem 'hashie'
require 'hashie'
-
-gem 'httparty', '>= 0.5.2'
require 'httparty'
module Weibo
@@ -60,5 +54,5 @@ def rubyify_keys!
# code is an adaptation of the twitter gem by John Nunemaker
# http://github.com/jnunemaker/twitter
# Copyright (c) 2009 John Nunemaker
-#
+#
# made to work with china's leading twitter service, 新浪微博
View
2  spec/spec_helper.rb
@@ -0,0 +1,2 @@
+$LOAD_PATH << File.expand_path('../../lib', __FILE__)
+require 'weibo'
View
1  spec/weibo/base_spec.rb
@@ -0,0 +1 @@
+require 'spec_helper'
View
1  spec/weibo_spec.rb
@@ -0,0 +1 @@
+require 'spec_helper'
View
10 test/helper.rb
@@ -1,10 +0,0 @@
-require 'rubygems'
-require 'test/unit'
-require 'shoulda'
-
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-$LOAD_PATH.unshift(File.dirname(__FILE__))
-require 'weibo'
-
-class Test::Unit::TestCase
-end
View
7 test/test_weibo.rb
@@ -1,7 +0,0 @@
-require 'helper'
-
-class TestWeibo < Test::Unit::TestCase
- should "probably rename this file and start testing for real" do
- flunk "hey buddy, you should probably rename this file and start testing for real"
- end
-end

0 comments on commit 574c75d

Please sign in to comment.
Something went wrong with that request. Please try again.