cucumber-slices 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2d88a947fb01c1b1e19dbb8dfecca01eb1a0dedf
4
+ data.tar.gz: 5643d09f34ac57981e805f53436aaa565e082125
5
+ SHA512:
6
+ metadata.gz: 9bd364eb8c6bcf34d672669e5d47ea21e6a7aa463d161346acdc35bee586bbd4950e62ed6ff3f92d8e36a8140b071cdfbbabb8e48596edbc089b65d2b31fe2ba
7
+ data.tar.gz: 9ae9421d61e8704e405c6815c7c8087ec1e1b49dad19e95fd3bd5173456f6d783c3dd641e77b936c0f4be8faab1fc31fd12b64406ebd8837f442e0c38c357bbe
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.8.0"
10
+ gem "rdoc", "~> 3.12"
11
+ gem "cucumber", ">= 0"
12
+ gem "bundler", "~> 1.0"
13
+ gem "jeweler", "~> 2.0.1"
14
+ gem "simplecov", ">= 0"
15
+ end
16
+ group :test do
17
+ gem "debugger", ">= 1.6.6"
18
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 psytau
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = cucumber-slices
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to cucumber-slices
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2014 psytau. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,54 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "cucumber-slices"
18
+ gem.homepage = "http://github.com/psytau/cucumber-slices"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{view steps along with your cukes}
21
+ gem.description = %Q{view steps along with your cukes}
22
+ gem.email = "rmanninoFoo@gmail.com"
23
+ gem.authors = ["psytau"]
24
+ gem.executables = ['cucumber-slices']
25
+ # dependencies defined in Gemfile
26
+ end
27
+ Jeweler::RubygemsDotOrgTasks.new
28
+
29
+ require 'rspec/core'
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec) do |spec|
32
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
+ end
34
+
35
+ desc "Code coverage detail"
36
+ task :simplecov do
37
+ ENV['COVERAGE'] = "true"
38
+ Rake::Task['spec'].execute
39
+ end
40
+
41
+ #require 'cucumber/rake/task'
42
+ #Cucumber::Rake::Task.new(:features)
43
+
44
+ task :default => :spec
45
+
46
+ require 'rdoc/task'
47
+ Rake::RDocTask.new do |rdoc|
48
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+
50
+ rdoc.rdoc_dir = 'rdoc'
51
+ rdoc.title = "cucumber-slices #{version}"
52
+ rdoc.rdoc_files.include('README*')
53
+ rdoc.rdoc_files.include('lib/**/*.rb')
54
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'cucumber-slices'
4
+
5
+ feature_name = ARGV[0]
6
+
7
+ cs = CucumberSlices.new
8
+
9
+ feature_file = "./features/#{feature_name}.feature"
10
+ step_file = "./features/step_definitions/#{feature_name}_steps.rb"
11
+
12
+ open(step_file) do |file|
13
+ cs.extract_steps file
14
+ end
15
+
16
+ splice = []
17
+ open(feature_file) do |file|
18
+ splice = cs.splice_features file
19
+ end
20
+
21
+ puts splice
@@ -0,0 +1,9 @@
1
+ Feature: something something
2
+ In order to something something
3
+ A user something something
4
+ something something something
5
+
6
+ Scenario: something something
7
+ Given inspiration
8
+ When I create a sweet new gem
9
+ Then everyone should see how awesome I am
@@ -0,0 +1,29 @@
1
+ require 'simplecov'
2
+
3
+ module SimpleCov::Configuration
4
+ def clean_filters
5
+ @filters = []
6
+ end
7
+ end
8
+
9
+ SimpleCov.configure do
10
+ clean_filters
11
+ load_adapter 'test_frameworks'
12
+ end
13
+
14
+ ENV["COVERAGE"] && SimpleCov.start do
15
+ add_filter "/.rvm/"
16
+ end
17
+ require 'bundler'
18
+ begin
19
+ Bundler.setup(:default, :development)
20
+ rescue Bundler::BundlerError => e
21
+ $stderr.puts e.message
22
+ $stderr.puts "Run `bundle install` to install missing gems"
23
+ exit e.status_code
24
+ end
25
+
26
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
27
+ require 'cucumber-slices'
28
+
29
+ require 'rspec/expectations'
@@ -0,0 +1,60 @@
1
+
2
+ class CucumberSlices
3
+
4
+ Command = Struct.new :command, :regex, :code
5
+ def extract_regex line
6
+ if line =~ /^(Then|Given|When|And)[ (]\/(.+)\/[^\/]+$/
7
+ return [$1, $2]
8
+ else
9
+ return nil
10
+ end
11
+ end
12
+
13
+ def extract_steps file
14
+ in_cmd_block = false
15
+ cmd = nil
16
+ code = []
17
+ @steps = []
18
+ #open('features/step_definitions/tic-tac-toe-steps.rb') do |file|
19
+ # open(file_name) do |file|
20
+ file.each do |line|
21
+ if line =~ /^end/
22
+ in_cmd_block = false
23
+ command = Command.new
24
+ command.command, command.regex = extract_regex cmd
25
+ command.code = code
26
+ @steps << command
27
+ code = []
28
+ elsif line =~ /^(Given|When|Then|And)/
29
+ in_cmd_block = true
30
+ cmd = line
31
+ else
32
+ code << line if in_cmd_block
33
+ end
34
+ end
35
+ # end
36
+ end
37
+
38
+ def splice_features feature_file
39
+ # open ('features/tic-tac-toe.feature') do |file|
40
+ splice = []
41
+ count = 0
42
+ feature_file.each do |line|
43
+ count = count + 1
44
+ splice << "#{count.to_s} #{line}"
45
+ if line =~ /^([ \t]+)(Given|When|Then|And) (.+)/
46
+ indent = $1
47
+ cmd = $2
48
+ code = $3
49
+ @steps.each do |step|
50
+ if code =~ Regexp.new(step.regex)
51
+ step.code.each do |l|
52
+ splice << "#{indent}#{l}"
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ splice
59
+ end
60
+ end
@@ -0,0 +1,53 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ require 'ruby-debug'
4
+ require './lib/cucumber-slices'
5
+
6
+ cuke = <<CUKE
7
+ Given I have a started Tic-Tac-Toe game
8
+ And it is the computer's turn
9
+ And the computer is playing X
10
+ Then the computer randomly chooses an open position for its move
11
+ And the board should have an X on it
12
+ CUKE
13
+ cuke_lines = cuke.split("\n")
14
+ steps = <<STEP
15
+ Given /^I have a started Tic\-Tac\-Toe game$/ do
16
+ @game = TicTacToe.new(:player)
17
+ @game.player = "Renee"
18
+ end
19
+
20
+ Given /^it is the computer's turn$/ do
21
+ @game = TicTacToe.new(:computer, :O)
22
+ @game.current_player.should eq "Computer"
23
+ end
24
+
25
+ Given /^the computer is playing X$/ do
26
+ @game.computer_symbol.should eq :X
27
+ end
28
+
29
+ Then /^the computer randomly chooses an open position for its move$/ do
30
+ open_spots = @game.open_spots
31
+ @com_move = @game.computer_move
32
+ open_spots.should include(@com_move)
33
+ end
34
+
35
+ Then /^the board should have an X on it$/ do
36
+ @game.current_state.should include 'X'
37
+ end
38
+ STEP
39
+ step_lines = steps.split("\n")
40
+
41
+ describe "CucumberSlices" do
42
+ it "can extract the regexp from a line of a step file" do
43
+ pending
44
+ end
45
+ it "can compine the output" do
46
+ cs = CucumberSlices.new
47
+ cs.extract_steps step_lines
48
+ splice = cs.splice_features cuke_lines
49
+ puts splice
50
+ splice[0].should == "1 #{cuke_lines[0]}"
51
+ splice[1].should == "\t#{step_lines[1]}"
52
+ end
53
+ end
@@ -0,0 +1,29 @@
1
+ require 'simplecov'
2
+
3
+ module SimpleCov::Configuration
4
+ def clean_filters
5
+ @filters = []
6
+ end
7
+ end
8
+
9
+ SimpleCov.configure do
10
+ clean_filters
11
+ load_adapter 'test_frameworks'
12
+ end
13
+
14
+ ENV["COVERAGE"] && SimpleCov.start do
15
+ add_filter "/.rvm/"
16
+ end
17
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
18
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
19
+
20
+ require 'rspec'
21
+ require 'cucumber-slices'
22
+
23
+ # Requires supporting files with custom matchers and macros, etc,
24
+ # in ./support/ and its subdirectories.
25
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
26
+
27
+ RSpec.configure do |config|
28
+
29
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cucumber-slices
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - psytau
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 2.8.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 2.8.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '3.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '3.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: cucumber
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: jeweler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.0.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 2.0.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
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
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: view steps along with your cukes
98
+ email: rmanninoFoo@gmail.com
99
+ executables:
100
+ - cucumber-slices
101
+ extensions: []
102
+ extra_rdoc_files:
103
+ - LICENSE.txt
104
+ - README.rdoc
105
+ files:
106
+ - .document
107
+ - .rspec
108
+ - Gemfile
109
+ - LICENSE.txt
110
+ - README.rdoc
111
+ - Rakefile
112
+ - VERSION
113
+ - bin/cucumber-slices
114
+ - features/cucumber-slices.feature
115
+ - features/step_definitions/cucumber-slices_steps.rb
116
+ - features/support/env.rb
117
+ - lib/cucumber-slices.rb
118
+ - spec/cucumber-slices_spec.rb
119
+ - spec/spec_helper.rb
120
+ homepage: http://github.com/psytau/cucumber-slices
121
+ licenses:
122
+ - MIT
123
+ metadata: {}
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - '>='
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 2.2.2
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: view steps along with your cukes
144
+ test_files: []