table_beet 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3d5731f9ef1f5bc07618506a4fdd5325a94f4700
4
+ data.tar.gz: d8574609a60716ddf2866f755c2a0dfe7dde53a3
5
+ SHA512:
6
+ metadata.gz: d6ee48022ace5895d735ec1f0f30e02e4276dd19c4f5adcaa176958a3f24e0c8a34a4e72d327121168bddd1fbd0c6e1eba8d7d4619d1d945b717b66279bf3aa3
7
+ data.tar.gz: 1f4f1546e7d38b84b849634863c9a368dafebd3f633d60ac98db1648a198527ee401d70935e811cab7c08766f00321425f260a3c200cdcf0a211a4aadb6f71c9
data/.gitignore CHANGED
@@ -17,3 +17,5 @@ test/version_tmp
17
17
  tmp
18
18
  vendor
19
19
  .DS_Store
20
+ spec/stepdoc
21
+
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format documentation
3
+ --order random
4
+ --tag ~before_load
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ script: bundle exec rake spec && bundle exec rspec --tag before_load spec
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/table_beet/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
data/README.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  TableBeet is reference generator for [turnip](https://github.com/jnicklas/turnip) steps of existing.
4
4
 
5
+ [![Build Status](https://travis-ci.org/gongo/table_beet.png?branch=master)](https://travis-ci.org/gongo/table_beet)
6
+ [![Code Climate](https://codeclimate.com/github/gongo/table_beet.png)](https://codeclimate.com/github/gongo/table_beet)
7
+
8
+ # Requirements
9
+
10
+ - Ruby
11
+ - 1.9.3
12
+ - 2.0.0
13
+
5
14
  ## Installation
6
15
 
7
16
  ### RubyGems
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -12,7 +12,7 @@ module TableBeet
12
12
  #
13
13
  def load
14
14
  # https://github.com/jnicklas/turnip#where-to-place-steps
15
- paths.each { |f| Kernel.load f, true }
15
+ paths.each { |f| require f }
16
16
  paths.length
17
17
  end
18
18
 
@@ -1,3 +1,3 @@
1
1
  module TableBeet
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,7 @@
1
+ step "Are you talking about :name !!!!!" do |name|
2
+ expect(name).to eq('Kuririn')
3
+ end
4
+
5
+ step "When you give up, that's when the game is over." do
6
+ expect(true).to be_true
7
+ end
@@ -0,0 +1,22 @@
1
+ steps_for :test do
2
+ REQUIRE_TEST = %w(cola pizza)
3
+
4
+ #
5
+ # When to run the test:
6
+ # | cola |
7
+ # | pizza |
8
+ #
9
+ step 'To run the test:' do |table|
10
+ @tests << table.to_a.flatten
11
+ end
12
+
13
+ #
14
+ # When to run the test:
15
+ # | cola |
16
+ # | report |
17
+ # Then The test is insufficient
18
+ #
19
+ step 'the test is insufficient' do
20
+ expect(@tests).not_to include(*REQUIRE_TEST)
21
+ end
22
+ end
@@ -0,0 +1,46 @@
1
+ require 'spec_helper'
2
+ require 'erb'
3
+
4
+ describe TableBeet::Formatters::HTMLFormatter do
5
+ before do
6
+ mock_load
7
+ scopes = TableBeet::World.scopes
8
+ directory = OUTPUT_PATH
9
+ formatter = TableBeet::Formatters::HTMLFormatter.new(scopes, directory)
10
+ formatter.flush
11
+ end
12
+
13
+ let(:file) do
14
+ File.readlines(OUTPUT_PATH + '/index.html').join
15
+ end
16
+
17
+ context 'not loaded steps', :before_load => true do
18
+ let(:mock_load) { nil }
19
+
20
+ describe '.flush' do
21
+ it 'should make html that has no scopes and steps' do
22
+ expect(file).not_to include('<a href="' + ERB::Util.h('#turnip') + '">' + ERB::Util.h('turnip') + '</a>')
23
+ expect(file).not_to include('<a href="' + ERB::Util.h('#test') + '">' + ERB::Util.h('test') + '</a>')
24
+ expect(file).not_to include(ERB::Util.h("Are you talking about :name !!!!!"))
25
+ expect(file).not_to include(ERB::Util.h("the test is insufficient"))
26
+ expect(file).not_to include(ERB::Util.h("To run the test:"))
27
+ expect(file).not_to include(ERB::Util.h("When you give up, that's when the game is over."))
28
+ end
29
+ end
30
+ end
31
+
32
+ context 'not loaded steps' do
33
+ let(:mock_load) { TableBeet::Loader.new(path: FIXTURES_PATH).load }
34
+
35
+ describe '.flush' do
36
+ it 'should make html that has scopes and steps' do
37
+ expect(file).to include('<a href="' + ERB::Util.h('#turnip') + '">' + ERB::Util.h('turnip') + '</a>')
38
+ expect(file).to include('<a href="' + ERB::Util.h('#test') + '">' + ERB::Util.h('test') + '</a>')
39
+ expect(file).to include('<th class="step_name">' + ERB::Util.h("Are you talking about :name !!!!!") + '</th>')
40
+ expect(file).to include('<th class="step_name">' + ERB::Util.h("the test is insufficient") + '</th>')
41
+ expect(file).to include('<th class="step_name">' + ERB::Util.h("To run the test:") + '</th>')
42
+ expect(file).to include('<th class="step_name">' + ERB::Util.h("When you give up, that's when the game is over.") + '</th>')
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+ require 'pathname'
3
+
4
+ describe TableBeet::Loader do
5
+ context 'when not specify in the constructor argument', :before_load => true do
6
+ let(:loader) do
7
+ TableBeet::Loader.new
8
+ end
9
+
10
+ describe '#display_pattern' do
11
+ it 'should return default glob pattern' do
12
+ expect(loader.display_pattern).to eq('./spec/**/*_steps.rb')
13
+ end
14
+ end
15
+ end
16
+
17
+ context 'when specify pattern that does not exist', :before_load => true do
18
+ let(:loader) do
19
+ TableBeet::Loader.new(suffix: '__hoge.rb', path: '/tmp')
20
+ end
21
+
22
+ describe '#display_pattern' do
23
+ it 'should return glob pattern' do
24
+ expect(loader.display_pattern).to eq('/tmp/**/*__hoge.rb')
25
+ end
26
+ end
27
+
28
+ describe '#paths' do
29
+ it 'should return empty array' do
30
+ expect(loader.paths).to be_empty
31
+ end
32
+ end
33
+
34
+ describe '#load' do
35
+ it 'should return zero' do
36
+ expect(loader.load).to be_zero
37
+ end
38
+ end
39
+ end
40
+
41
+ context 'when specify exist pattern' do
42
+ let(:loader) do
43
+ TableBeet::Loader.new(path: FIXTURES_PATH)
44
+ end
45
+
46
+ describe '#paths' do
47
+ it 'should return load files' do
48
+ files = Pathname.glob(FIXTURES_PATH + '/*_steps.rb')
49
+ expect(loader.paths).to eq(files)
50
+ end
51
+ end
52
+
53
+ describe '#load' do
54
+ it 'should return number of steps file' do
55
+ count = Pathname.glob(FIXTURES_PATH + '/*_steps.rb').size
56
+ expect(loader.load).to eq(count)
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,4 @@
1
+ require 'table_beet'
2
+
3
+ FIXTURES_PATH = File.dirname(__FILE__) + '/fixtures/steps'
4
+ OUTPUT_PATH = File.dirname(__FILE__) + '/stepdoc'
data/spec/step_spec.rb ADDED
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+ require 'pathname'
3
+
4
+ describe TableBeet::Step do
5
+ let(:step) do
6
+ TableBeet::Loader.new(path: FIXTURES_PATH).load
7
+ TableBeet::World.scopes[:turnip].first
8
+ end
9
+
10
+ describe '#id' do
11
+ it 'should return method id' do
12
+ expect(step.id).to be_instance_of(Fixnum)
13
+ end
14
+ end
15
+
16
+ describe '#source' do
17
+ it 'should return step source' do
18
+ expect(step.source).to include("expect(name).to eq('Kuririn')")
19
+ end
20
+ end
21
+
22
+ describe '#location' do
23
+ it 'should return location of source' do
24
+ expect(step.location).to include("global_steps.rb:1")
25
+ expect(step.location).to include(FIXTURES_PATH)
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+ require 'pathname'
3
+
4
+ describe TableBeet::World do
5
+ let(:scopes) do
6
+ mock_loader
7
+ TableBeet::World.scopes
8
+ end
9
+
10
+ context 'before load steps', :before_load => true do
11
+ let(:mock_loader) { nil }
12
+
13
+ describe '.scopes' do
14
+ it 'should return empty hash' do
15
+ expect(scopes).to be_empty
16
+ end
17
+ end
18
+ end
19
+
20
+ context 'after load steps' do
21
+ let(:mock_loader) { TableBeet::Loader.new(path: FIXTURES_PATH).load }
22
+
23
+ describe '.scopes' do
24
+ it 'should return hash of steps' do
25
+ expect(scopes.keys.sort).to eq([:test, :turnip].sort)
26
+ end
27
+ end
28
+ end
29
+ end
data/table_beet.gemspec CHANGED
@@ -20,5 +20,7 @@ Gem::Specification.new do |gem|
20
20
  gem.add_dependency 'turnip'
21
21
  gem.add_dependency 'slop'
22
22
  gem.add_dependency 'method_source'
23
- gem.add_development_dependency 'debugger'
23
+ gem.add_development_dependency 'guard-rspec'
24
+ gem.add_development_dependency 'bundler'
25
+ gem.add_development_dependency 'rake'
24
26
  end
metadata CHANGED
@@ -1,78 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_beet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Wataru MIYAGUNI
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-25 00:00:00.000000000 Z
11
+ date: 2013-03-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: turnip
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: slop
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: method_source
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
- name: debugger
56
+ name: guard-rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
76
95
  - !ruby/object:Gem::Version
77
96
  version: '0'
78
97
  description: Reference generator for Turnip steps of exists
@@ -84,7 +103,10 @@ extensions: []
84
103
  extra_rdoc_files: []
85
104
  files:
86
105
  - .gitignore
106
+ - .rspec
107
+ - .travis.yml
87
108
  - Gemfile
109
+ - Guardfile
88
110
  - LICENSE.txt
89
111
  - README.md
90
112
  - Rakefile
@@ -389,35 +411,42 @@ files:
389
411
  - lib/table_beet/step.rb
390
412
  - lib/table_beet/version.rb
391
413
  - lib/table_beet/world.rb
414
+ - spec/fixtures/steps/global_steps.rb
415
+ - spec/fixtures/steps/test_steps.rb
416
+ - spec/formatters/html_formatter_spec.rb
417
+ - spec/loader_spec.rb
418
+ - spec/spec_helper.rb
419
+ - spec/step_spec.rb
420
+ - spec/world_spec.rb
392
421
  - table_beet.gemspec
393
422
  homepage: https://github.com/gongo/table_beet
394
423
  licenses: []
424
+ metadata: {}
395
425
  post_install_message:
396
426
  rdoc_options: []
397
427
  require_paths:
398
428
  - lib
399
429
  required_ruby_version: !ruby/object:Gem::Requirement
400
- none: false
401
430
  requirements:
402
- - - ! '>='
431
+ - - '>='
403
432
  - !ruby/object:Gem::Version
404
433
  version: '0'
405
- segments:
406
- - 0
407
- hash: 3448460025646917409
408
434
  required_rubygems_version: !ruby/object:Gem::Requirement
409
- none: false
410
435
  requirements:
411
- - - ! '>='
436
+ - - '>='
412
437
  - !ruby/object:Gem::Version
413
438
  version: '0'
414
- segments:
415
- - 0
416
- hash: 3448460025646917409
417
439
  requirements: []
418
440
  rubyforge_project:
419
- rubygems_version: 1.8.23
441
+ rubygems_version: 2.0.0
420
442
  signing_key:
421
- specification_version: 3
443
+ specification_version: 4
422
444
  summary: Reference generator for Turnip steps of exists
423
- test_files: []
445
+ test_files:
446
+ - spec/fixtures/steps/global_steps.rb
447
+ - spec/fixtures/steps/test_steps.rb
448
+ - spec/formatters/html_formatter_spec.rb
449
+ - spec/loader_spec.rb
450
+ - spec/spec_helper.rb
451
+ - spec/step_spec.rb
452
+ - spec/world_spec.rb