sarah-clippie 0.0.0 → 0.1.0

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.1.0
@@ -0,0 +1,60 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{clippie}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["sarah", "coreyhaines"]
12
+ s.date = %q{2009-08-29}
13
+ s.description = %q{helpful assistant to generate plumbing code}
14
+ s.email = %q{sarahg.gray@gmail.com;coreyhaines@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "clippie.gemspec",
27
+ "features/generate_cucumber_steps.feature",
28
+ "features/step_definitions/cucumber_step_generation_steps.rb",
29
+ "features/support/env.rb",
30
+ "lib/clippie/cucumber.rb",
31
+ "spec/clippie_spec.rb",
32
+ "spec/spec_helper.rb"
33
+ ]
34
+ s.has_rdoc = true
35
+ s.homepage = %q{http://github.com/sarah/clippie}
36
+ s.rdoc_options = ["--charset=UTF-8"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = %q{1.3.1}
39
+ s.summary = %q{helpful assistant to generate plumbing code}
40
+ s.test_files = [
41
+ "spec/clippie_spec.rb",
42
+ "spec/spec_helper.rb"
43
+ ]
44
+
45
+ if s.respond_to? :specification_version then
46
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
+ s.specification_version = 2
48
+
49
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
+ s.add_development_dependency(%q<rspec>, [">= 0"])
51
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
52
+ else
53
+ s.add_dependency(%q<rspec>, [">= 0"])
54
+ s.add_dependency(%q<cucumber>, [">= 0"])
55
+ end
56
+ else
57
+ s.add_dependency(%q<rspec>, [">= 0"])
58
+ s.add_dependency(%q<cucumber>, [">= 0"])
59
+ end
60
+ end
@@ -0,0 +1,25 @@
1
+ Feature: Inserting cucumber steps into file
2
+ In order to keep from having to copy and paste from the console
3
+ As a user of cucumber
4
+ I would like the undefined steps to be auto-inserted into a steps file
5
+
6
+ Scenario: Creating the auto_defined_steps file
7
+ Given the following undefined step
8
+ """
9
+ Given /^something has been initialized$/ do
10
+ pending
11
+ end
12
+ """
13
+ When I create the undefined steps
14
+ Then the file "clippie_steps.rb" should exist in example app
15
+
16
+ Scenario: Adding the steps to the auto_defined_steps file
17
+ Given the following undefined step
18
+ """
19
+ Given /^something has been initialized$/ do
20
+ pending
21
+ end
22
+ """
23
+ When I create the undefined steps
24
+ Then the file "clippie_steps.rb" should contain the undefined step
25
+
@@ -0,0 +1,21 @@
1
+ Given /^the following undefined step$/ do |string|
2
+ @undefined_step = string
3
+ end
4
+
5
+ When /^I create the undefined steps$/ do
6
+ Clippie::Cucumber.define_steps @undefined_step
7
+ end
8
+
9
+ Then /^the file "([^\"]*)" should exist in example app$/ do |filename|
10
+ File.exists?(File.join(Clippie::Cucumber::STEP_DEFINITIONS_ROOT, filename)).should be_true
11
+ end
12
+
13
+ Then /^the file "([^\"]*)" should contain the undefined step$/ do |filename|
14
+ file = File.open(File.join(Clippie::Cucumber::STEP_DEFINITIONS_ROOT, filename), "r")
15
+ contents = ""
16
+ while line = file.gets
17
+ contents += line
18
+ end
19
+ contents.should include(@undefined_step)
20
+
21
+ end
@@ -1,4 +1,16 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
- require 'clippie'
2
+ require 'clippie/cucumber'
3
3
 
4
4
  require 'spec/expectations'
5
+
6
+ EXAMPLE_APP_ROOT = File.join(File.dirname(__FILE__), '..', '..', 'example_app', 'features','step_definitions')
7
+ Clippie::Cucumber::STEP_DEFINITIONS_ROOT = EXAMPLE_APP_ROOT
8
+ CREATED_STEP_FILE = File.join(EXAMPLE_APP_ROOT, "clippie_steps.rb")
9
+
10
+ Before do
11
+ File.delete(CREATED_STEP_FILE) if File.exists? CREATED_STEP_FILE
12
+ end
13
+
14
+ After do
15
+ File.delete(CREATED_STEP_FILE) if File.exists? CREATED_STEP_FILE
16
+ end
@@ -0,0 +1,10 @@
1
+ module Clippie
2
+ class Cucumber
3
+ STEP_DEFINITIONS_ROOT = "."
4
+ def self.define_steps(steps)
5
+ file = File.open(File.join(STEP_DEFINITIONS_ROOT, "clippie_steps.rb"), "a+")
6
+ file.write(steps + "\n\n" )
7
+ file.close
8
+ end
9
+ end
10
+ end
@@ -1,7 +1,26 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
- describe "Clippie" do
4
- it "passes" do
5
- 1.should == 2
3
+ describe Clippie::Cucumber do
4
+ context ".define_steps" do
5
+ before(:each) do
6
+ File.stub!(:exists?).and_return false
7
+ @file = mock("file")
8
+ File.stub!(:open).and_return @file
9
+ @file.stub!(:write)
10
+ @file.stub!(:close)
11
+ end
12
+ it "generates file" do
13
+ File.should_receive(:open).with(File.join(EXAMPLE_APP_ROOT, "clippie_steps.rb"), "a+")
14
+ Clippie::Cucumber.define_steps "dkdk"
15
+ end
16
+ it "writes the steps to the file" do
17
+ step_definitions = "IAmAnUndefinedStep"
18
+ @file.should_receive(:write).with(step_definitions + "\n\n")
19
+ Clippie::Cucumber.define_steps step_definitions
20
+ end
21
+ it "closes the file" do
22
+ @file.should_receive :close
23
+ Clippie::Cucumber.define_steps ""
24
+ end
6
25
  end
7
26
  end
@@ -1,8 +1,10 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
- require 'clippie'
4
3
  require 'spec'
5
4
  require 'spec/autorun'
5
+ require 'clippie/cucumber'
6
+ EXAMPLE_APP_ROOT = File.join(File.dirname(__FILE__), '..', 'example_app', 'features','step_definitions')
7
+ Clippie::Cucumber::APP_ROOT = EXAMPLE_APP_ROOT
6
8
 
7
9
  Spec::Runner.configure do |config|
8
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sarah-clippie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sarah
@@ -49,10 +49,11 @@ files:
49
49
  - README.rdoc
50
50
  - Rakefile
51
51
  - VERSION
52
- - features/clippie.feature
53
- - features/step_definitions/clippie_steps.rb
52
+ - clippie.gemspec
53
+ - features/generate_cucumber_steps.feature
54
+ - features/step_definitions/cucumber_step_generation_steps.rb
54
55
  - features/support/env.rb
55
- - lib/clippie.rb
56
+ - lib/clippie/cucumber.rb
56
57
  - spec/clippie_spec.rb
57
58
  - spec/spec_helper.rb
58
59
  has_rdoc: true
@@ -1,9 +0,0 @@
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
File without changes