method_match 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,24 @@
1
1
  # MethodMatch [![Build Status](https://secure.travis-ci.org/tiokksar/method_match.png)](http://travis-ci.org/tiokksar/method_match)
2
2
 
3
- Tiny gem for runnig specs for given file and line
3
+ Tiny gem for running specs for given file and line.
4
+ It runs specs for given file based on line number and file name.
5
+
6
+ [TDD workflow using Tmux, Pry, nviennot's irb-config, and method_match gem.](http://ascii.io/a/1801)
7
+
8
+ ##Convensions
9
+
10
+ Gem is based on convention that spec for:
11
+
12
+ class YourClass
13
+ def your_method
14
+ end
15
+ end
16
+
17
+ should be in your_class.rb in:
18
+
19
+ describe '#your_method' do
20
+ #(...)
21
+ end
4
22
 
5
23
  ## Installation
6
24
 
@@ -18,7 +36,7 @@ Or install it yourself as:
18
36
 
19
37
  ## Usage
20
38
 
21
- TODO: Write usage instructions here
39
+ Watch demo [screencast](http://ascii.io/a/1801) for suggested workfolow.
22
40
 
23
41
  ## Contributing
24
42
 
@@ -1,7 +1,9 @@
1
+ #doesn't do anything - for specs
1
2
  module MethodMatch
2
3
  class Matcher
3
4
  attr_accessor :name, :line
4
5
 
6
+ #some comment
5
7
  def initialize name, line
6
8
  @name = name
7
9
  @line = line
@@ -12,6 +14,10 @@ module MethodMatch
12
14
  end
13
15
 
14
16
  default_scope shoudlnt_match_this
17
+
18
+ def self.some_class_method
19
+
20
+ end
15
21
  end
16
22
 
17
23
  end
@@ -16,9 +16,14 @@ module MethodMatch
16
16
 
17
17
  def rspec_command
18
18
  command = "rspec #{@matcher.spec_name}"
19
- command += " -e '##{@matcher.method_name}'" if @matcher.method_name
19
+ command += " -e '#{rspec_method}'" if @matcher.method_name
20
20
  command += ":#{@matcher.line}" if @matcher.spec?
21
21
  command
22
22
  end
23
+
24
+ def rspec_method
25
+ return @matcher.method_name.sub('self.', '.') if @matcher.method_name[0..4] == 'self.'
26
+ "##{@matcher.method_name}"
27
+ end
23
28
  end
24
29
  end
@@ -1,3 +1,3 @@
1
1
  module MethodMatch
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/method_match.gemspec CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |gem|
8
8
  gem.version = MethodMatch::VERSION
9
9
  gem.authors = ["Tomasz Tokarski"]
10
10
  gem.email = ["tomasz@tomasztokarski.com"]
11
- gem.description = %q{Method name matcher and test runner for given file and line}
12
- gem.summary = %q{Method name matcher and test runner for given file and line}
13
- gem.homepage = "https://github.com/tiokksar/scrapzirra"
11
+ gem.description = %q{Method name matcher and spec runner for given file and line}
12
+ gem.summary = %q{It runs specs for given file based on line number and file name. Supposed to be used with pry, tmux, and vim}
13
+ gem.homepage = "http://tomasztokarski.com/method_match"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -1,10 +1,14 @@
1
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}
2
+ describe MethodMatch::CommandRunner do
3
+ let(:matcher){MethodMatch::Matcher.new 'data/test_data/matcher.rb', 13}
4
4
  let(:command_runner){MethodMatch::CommandRunner.new matcher}
5
5
 
6
6
  describe '#rspec_command' do
7
7
  subject { command_runner.rspec_command }
8
8
  it { should eq('rspec spec/test_data/matcher_spec.rb -e \'#parse_file\'')}
9
+ context "class method" do
10
+ let(:matcher){MethodMatch::Matcher.new 'data/test_data/matcher.rb', 19}
11
+ it { should eq('rspec spec/test_data/matcher_spec.rb -e \'.some_class_method\'')}
12
+ end
9
13
  end
10
14
  end
@@ -1,6 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), %w[.. spec_helper])
2
2
  describe MethodMatch::Matcher do
3
- let(:matcher){MethodMatch::Matcher.new 'data/test_data/matcher.rb', 11}
3
+ let(:matcher){MethodMatch::Matcher.new 'data/test_data/matcher.rb', 13}
4
4
  subject {matcher}
5
5
  its(:name){ should eq('data/test_data/matcher.rb')}
6
6
 
@@ -11,12 +11,12 @@ describe MethodMatch::Matcher do
11
11
  end
12
12
 
13
13
  context 'rails model' do
14
- let(:matcher){MethodMatch::Matcher.new 'app/models/model.rb', 11}
14
+ let(:matcher){MethodMatch::Matcher.new 'app/models/model.rb', 13}
15
15
  it { should eq('spec/models/model_spec.rb')}
16
16
  end
17
17
 
18
18
  context 'spec' do
19
- let(:matcher){MethodMatch::Matcher.new 'spec/some_spec.rb', 11}
19
+ let(:matcher){MethodMatch::Matcher.new 'spec/some_spec.rb', 13}
20
20
  it { should eq('spec/some_spec.rb')}
21
21
  end
22
22
  end
@@ -24,7 +24,7 @@ describe MethodMatch::Matcher do
24
24
  describe '#method_name' do
25
25
  subject { matcher.method_name }
26
26
  context 'spec' do
27
- let(:matcher){MethodMatch::Matcher.new 'spec/some_spec.rb', 11}
27
+ let(:matcher){MethodMatch::Matcher.new 'spec/some_spec.rb', 13}
28
28
  it { should be_nil}
29
29
  end
30
30
 
@@ -36,6 +36,11 @@ describe MethodMatch::Matcher do
36
36
  context 'test class' do
37
37
  it { should eq('parse_file')}
38
38
  end
39
+
40
+ context 'class method' do
41
+ let(:matcher){MethodMatch::Matcher.new 'data/test_data/matcher.rb', 19}
42
+ it { should eq('self.some_class_method')}
43
+ end
39
44
  end
40
45
 
41
46
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: method_match
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.5
5
+ version: 0.0.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tomasz Tokarski
@@ -59,7 +59,7 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  name: rake
62
- description: Method name matcher and test runner for given file and line
62
+ description: Method name matcher and spec runner for given file and line
63
63
  email:
64
64
  - tomasz@tomasztokarski.com
65
65
  executables: []
@@ -82,7 +82,7 @@ files:
82
82
  - spec/method_match/command_runner_spec.rb
83
83
  - spec/method_match/matcher_spec.rb
84
84
  - spec/spec_helper.rb
85
- homepage: https://github.com/tiokksar/scrapzirra
85
+ homepage: http://tomasztokarski.com/method_match
86
86
  licenses: []
87
87
  post_install_message:
88
88
  rdoc_options: []
@@ -105,7 +105,8 @@ rubyforge_project:
105
105
  rubygems_version: 1.8.24
106
106
  signing_key:
107
107
  specification_version: 3
108
- summary: Method name matcher and test runner for given file and line
108
+ summary: It runs specs for given file based on line number and file name. Supposed
109
+ to be used with pry, tmux, and vim
109
110
  test_files:
110
111
  - spec/method_match/command_runner_spec.rb
111
112
  - spec/method_match/matcher_spec.rb