respec 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.2.0 2012-10-31
2
+
3
+ * Support rspec options that require an argument.
4
+ * Write failures to current directory, not home directory.
5
+
1
6
  == 0.1.1 2012-09-27
2
7
 
3
8
  * Handle file name arguments with line number suffixes.
@@ -1,3 +1,5 @@
1
+ require 'set'
2
+
1
3
  module Respec
2
4
  class App
3
5
  def initialize(*args)
@@ -40,7 +42,7 @@ module Respec
40
42
  class << self
41
43
  attr_accessor :failures_path
42
44
  end
43
- self.failures_path = ENV['RESPEC_FAILURES'] || File.expand_path("~/.respec_failures")
45
+ self.failures_path = ENV['RESPEC_FAILURES'] || File.expand_path(".respec_failures")
44
46
 
45
47
  def help_only?
46
48
  @help_only
@@ -73,8 +75,15 @@ module Respec
73
75
  def process_args
74
76
  args = []
75
77
  files = []
78
+ pass_next_arg = false
76
79
  @args.each do |arg|
77
- if File.exist?(arg.sub(/:\d+\z/, ''))
80
+ if pass_next_arg
81
+ args << arg
82
+ pass_next_arg = false
83
+ elsif rspec_option_that_requires_an_argument?(arg)
84
+ args << arg
85
+ pass_next_arg = true
86
+ elsif File.exist?(arg.sub(/:\d+\z/, ''))
78
87
  files << arg
79
88
  elsif arg =~ /\A(--)?help\z/
80
89
  @help_only = true
@@ -126,5 +135,26 @@ module Respec
126
135
  []
127
136
  end
128
137
  end
138
+
139
+ def rspec_option_that_requires_an_argument?(arg)
140
+ RSPEC_OPTIONS_THAT_REQUIRE_AN_ARGUMENT.include?(arg)
141
+ end
142
+
143
+ RSPEC_OPTIONS_THAT_REQUIRE_AN_ARGUMENT = %w[
144
+ -I
145
+ -r --require
146
+ -O --options
147
+ --order
148
+ --seed
149
+ --failure-exit-code
150
+ --drb-port
151
+ -f --format
152
+ -o --out
153
+ -P --pattern
154
+ -e --example
155
+ -l --line_number
156
+ -t --tag
157
+ --default_path
158
+ ].to_set
129
159
  end
130
160
  end
@@ -1,5 +1,5 @@
1
1
  module Respec
2
- VERSION = [0, 1, 1]
2
+ VERSION = [0, 2, 0]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
@@ -81,6 +81,10 @@ describe Respec::App do
81
81
  app.generated_args.should == ['-a', '-b', '-c']
82
82
  end
83
83
 
84
+ it "should pass arguments for rspec options that need them" do
85
+ Respec::App.new('-I', 'lib', '-t', 'mytag').generated_args.should == ['-I', 'lib', '-t', 'mytag']
86
+ end
87
+
84
88
  it "should run all failures if 'f' is given" do
85
89
  make_failures_file 'a.rb:1', 'b.rb:2'
86
90
  app = Respec::App.new('f')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: respec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-27 00:00:00.000000000 Z
12
+ date: 2012-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -98,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  segments:
100
100
  - 0
101
- hash: 1462009004299331695
101
+ hash: -2391065629602365369
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  none: false
104
104
  requirements:
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  segments:
109
109
  - 0
110
- hash: 1462009004299331695
110
+ hash: -2391065629602365369
111
111
  requirements: []
112
112
  rubyforge_project:
113
113
  rubygems_version: 1.8.24