method_match 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.watchr ADDED
@@ -0,0 +1,7 @@
1
+ watch("spec/.*/*_spec.rb") do |match|
2
+ system "bundle exec rspec spec"
3
+ end
4
+
5
+ watch("lib/(.*/.*).rb") do |match|
6
+ system "bundle exec rspec spec"
7
+ end
@@ -10,5 +10,8 @@ module MethodMatch
10
10
  def parse_file
11
11
  File.readlines('app/models/bid.rb')
12
12
  end
13
+
14
+ default_scope shoudlnt_match_this
13
15
  end
16
+
14
17
  end
@@ -19,7 +19,7 @@ module MethodMatch
19
19
  return nil if mode == SPEC_MODE
20
20
  @match = get_method_match
21
21
  return nil unless @match
22
- @match.match(/def (self\.(\w+)|\w+).*/)[1]
22
+ @match.match(/def\s(self\.(\w+)|\w+).*/)[1]
23
23
  end
24
24
 
25
25
  def spec?
@@ -46,7 +46,7 @@ module MethodMatch
46
46
  end
47
47
 
48
48
  def get_method_match
49
- File.readlines(name).first(line).reverse.grep(/ def/).first
49
+ File.readlines(name).first(line).reverse.grep(/\sdef\s/).first
50
50
  rescue LoadError
51
51
  return nil
52
52
  end
@@ -1,3 +1,3 @@
1
1
  module MethodMatch
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -0,0 +1,10 @@
1
+ require File.join(File.dirname(__FILE__), %w[.. spec_helper])
2
+ describe MethodMatch::Matcher do
3
+ let(:matcher){MethodMatch::Matcher.new 'data/test_data/matcher.rb', 11}
4
+ let(:command_runner){MethodMatch::CommandRunner.new matcher}
5
+
6
+ describe '#rspec_command' do
7
+ subject { command_runner.rspec_command }
8
+ it { should eq('rspec spec/test_data/matcher_spec.rb -e \'#parse_file\'')}
9
+ end
10
+ end
@@ -9,7 +9,7 @@ describe MethodMatch::Matcher do
9
9
  context 'sample_data' do
10
10
  it { should eq('spec/test_data/matcher_spec.rb')}
11
11
  end
12
-
12
+
13
13
  context 'rails model' do
14
14
  let(:matcher){MethodMatch::Matcher.new 'app/models/model.rb', 11}
15
15
  it { should eq('spec/models/model_spec.rb')}
@@ -28,13 +28,14 @@ describe MethodMatch::Matcher do
28
28
  it { should be_nil}
29
29
  end
30
30
 
31
+ context 'default scope below method name' do
32
+ let(:matcher){MethodMatch::Matcher.new 'data/test_data/matcher.rb', 16}
33
+ it { should eq('parse_file')}
34
+ end
35
+
31
36
  context 'test class' do
32
37
  it { should eq('parse_file')}
33
38
  end
34
39
  end
35
40
 
36
- describe '#rspec_command' do
37
- subject { matcher.rspec_command }
38
- it { should eq('rspec spec/test_data/matcher_spec.rb -e \'#parse_file\'')}
39
- end
40
41
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: method_match
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tomasz Tokarski
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-28 00:00:00.000000000 Z
12
+ date: 2012-12-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  type: :runtime
@@ -67,6 +67,7 @@ extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
69
  - .gitignore
70
+ - .watchr
70
71
  - Gemfile
71
72
  - LICENSE.txt
72
73
  - README.md
@@ -78,6 +79,7 @@ files:
78
79
  - lib/method_match/pry.rb
79
80
  - lib/method_match/version.rb
80
81
  - method_match.gemspec
82
+ - spec/method_match/command_runner_spec.rb
81
83
  - spec/method_match/matcher_spec.rb
82
84
  - spec/spec_helper.rb
83
85
  homepage: https://github.com/tiokksar/scrapzirra
@@ -105,6 +107,7 @@ signing_key:
105
107
  specification_version: 3
106
108
  summary: Method name matcher and test runner for given file and line
107
109
  test_files:
110
+ - spec/method_match/command_runner_spec.rb
108
111
  - spec/method_match/matcher_spec.rb
109
112
  - spec/spec_helper.rb
110
113
  has_rdoc: