Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Hoist the specs into a per-binary spec structure

  • Loading branch information...
commit 670a1a6e62817d2b4493e3e4a139a0fe1262b9c4 1 parent 6aa18e1
Kevin Ballard kballard authored
13 Manifest
View
@@ -9,10 +9,11 @@ lib/github.rb
LICENSE
Manifest
README
-spec/command_spec.rb
-spec/extensions_spec.rb
-spec/github_spec.rb
-spec/helper_spec.rb
+spec/github/helper_spec.rb
+spec/github/spec_helper.rb
+spec/github/ui_spec.rb
+spec/shared/command_spec.rb
+spec/shared/extensions_spec.rb
+spec/shared/github_spec.rb
+spec/shared/windoze_spec.rb
spec/spec_helper.rb
-spec/ui_spec.rb
-spec/windoze_spec.rb
42 Rakefile
View
@@ -23,15 +23,39 @@ end
begin
require 'spec/rake/spectask'
- Spec::Rake::SpecTask.new("spec") do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = ['--color']
+ def spec_task(cmd=nil, rcov=nil)
+ name = "spec"
+ name << ":rcov" if rcov
+ root_name = name.dup
+ cmd ||= "shared"
+ name << ":#{cmd}"
+ Spec::Rake::SpecTask.new(name) do |t|
+ t.spec_files = FileList["spec#{"/#{cmd}" if cmd}/*_spec.rb"]
+ t.spec_opts = ['--color']
+ if rcov
+ t.rcov = true
+ t.rcov_opts = ['--exclude', '^spec,/gems/']
+ end
+ end
+ task root_name => name
end
- Spec::Rake::SpecTask.new("rcov_spec") do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = ['--color']
- t.rcov = true
- t.rcov_opts = ['--exclude', '^spec,/gems/']
- end
+ desc 'Run specs'
+ task :spec
+ desc 'Run specs using RCov'
+ task :'spec:shared'
+
+ # spec_task
+ desc ''
+ spec_task
+
+ desc ''
+ spec_task(nil, true)
+ task 'spec:rcov' => ['spec:rcov:github']
+
+ desc ''
+ spec_task('github')
+
+ desc ''
+ spec_task('github', true)
end
0  spec/helper_spec.rb → spec/github/helper_spec.rb
View
File renamed without changes
11 spec/github/spec_helper.rb
View
@@ -0,0 +1,11 @@
+require File.dirname(__FILE__) + "/../spec_helper"
+
+Spec::Runner.configure do |configuration|
+ configuration.append_before(:all) do
+ GitHub.command_name = 'github'
+ module GitHub
+ load 'helpers.rb'
+ load 'commands.rb'
+ end
+ end
+end
0  spec/ui_spec.rb → spec/github/ui_spec.rb
View
File renamed without changes
2  spec/command_spec.rb → spec/shared/command_spec.rb
View
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + '/../spec_helper'
describe GitHub::Command do
before(:each) do
2  spec/extensions_spec.rb → spec/shared/extensions_spec.rb
View
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + "/spec_helper"
+require File.dirname(__FILE__) + "/../spec_helper"
describe "When calling #try" do
specify "objects should return themselves" do
2  spec/github_spec.rb → spec/shared/github_spec.rb
View
@@ -1,4 +1,4 @@
-require File.dirname(__FILE__) + '/spec_helper'
+require File.dirname(__FILE__) + '/../spec_helper'
describe "GitHub.parse_options" do
it "should parse --bare options" do
2  spec/windoze_spec.rb → spec/shared/windoze_spec.rb
View
@@ -17,7 +17,7 @@
end
before(:each) do
- @filename = File.dirname(__FILE__) + "/../lib/github/command.rb"
+ @filename = File.dirname(__FILE__) + "/../../lib/github/command.rb"
@data = File.read(@filename)
end
8 spec/spec_helper.rb
View
@@ -92,14 +92,6 @@ def unguard_all
# prevent the use of `` in tests
Spec::Runner.configure do |configuration|
- # load this here so it's covered by the `` guard
- configuration.prepend_before(:all) do
- module GitHub
- load 'helpers.rb'
- load 'commands.rb'
- end
- end
-
configuration.prepend_after(:each) do
GitHub.instance_variable_set :'@options', nil
GitHub.instance_variable_set :'@debug', nil
Please sign in to comment.
Something went wrong with that request. Please try again.