cavalle-pickle 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,23 +13,20 @@ module Factories
13
13
  path
14
14
  end
15
15
 
16
- def create_rails_app
16
+ def create_rails_app(options = {})
17
17
  path = Dir.tmpdir + "rails_app_#{String.random}"
18
18
  FileUtils.rm_rf path
19
19
  `rails #{path}`
20
20
  File.open(path + "/config/environments/test.rb", "a") do |file|
21
21
  file.write "\nconfig.gem 'rspec-rails', :lib => false\n"
22
22
  end
23
- Dir.chdir path do
24
- `script/generate rspec`
25
- end
26
23
  FileUtils.cp_r File.dirname(__FILE__) + "/../../", path + "/vendor/plugins/pickle"
27
- FileUtils.mkdir_p path + "/spec/acceptance"
28
- File.open(path + "/spec/acceptance/acceptance_helper.rb", "w") do |file|
29
- file.write <<-EOF
30
- require File.dirname(__FILE__) + "/../spec_helper.rb"
31
- require 'pickle'
32
- EOF
24
+
25
+ unless options[:setup_pickle] == false
26
+ Dir.chdir path do
27
+ `script/generate rspec`
28
+ `script/generate pickle`
29
+ end
33
30
  end
34
31
 
35
32
  path
@@ -0,0 +1,45 @@
1
+ require File.dirname(__FILE__) + "/acceptance_helper.rb"
2
+
3
+ feature "Acceptance spec generator for rails", %q{
4
+ In order to quickly add a new acceptance spec
5
+ As a developer
6
+ I want to run a generator that creates it for me
7
+ } do
8
+
9
+ background do
10
+ @rails_app = create_rails_app
11
+ end
12
+
13
+ scenario "Adding new acceptance spec" do
14
+ Dir.chdir @rails_app do
15
+ `script/generate acceptance_spec document_creation`
16
+ end
17
+
18
+ File.exist?(@rails_app + "/spec/acceptance/document_creation_spec.rb").should be_true
19
+ end
20
+
21
+ scenario "Adding new acceptance spec (plural name)" do
22
+ Dir.chdir @rails_app do
23
+ `script/generate acceptance_spec creating_documents`
24
+ end
25
+
26
+ File.exist?(@rails_app + "/spec/acceptance/creating_documents_spec.rb").should be_true
27
+ end
28
+
29
+ scenario "Adding new acceptance spec (pascalized name)" do
30
+ Dir.chdir @rails_app do
31
+ `script/generate acceptance_spec DocumentCreation`
32
+ end
33
+
34
+ File.exist?(@rails_app + "/spec/acceptance/document_creation_spec.rb").should be_true
35
+ end
36
+
37
+ scenario "Adding new acceptance spec (name ending with _spec)" do
38
+ Dir.chdir @rails_app do
39
+ `script/generate acceptance_spec document_creation_spec`
40
+ end
41
+
42
+ File.exist?(@rails_app + "/spec/acceptance/document_creation_spec.rb").should be_true
43
+ end
44
+
45
+ end
@@ -0,0 +1,23 @@
1
+ require File.dirname(__FILE__) + "/acceptance_helper.rb"
2
+
3
+ feature "Pickle generator for rails", %q{
4
+ In order to quickly start to hack my rails project with pickle
5
+ As a developer
6
+ I want to run a generator that sets everything up for me
7
+ } do
8
+
9
+ scenario "Running generator in an empty project" do
10
+
11
+ rails_app = create_rails_app(:setup_pickle => false)
12
+
13
+ Dir.chdir rails_app do
14
+ `script/generate pickle`
15
+ end
16
+
17
+ File.exist?(rails_app + "/spec/acceptance/acceptance_helper.rb").should be_true
18
+ File.exist?(rails_app + "/spec/acceptance/support/helpers.rb").should be_true
19
+ File.exist?(rails_app + "/spec/acceptance/support/paths.rb").should be_true
20
+
21
+ end
22
+
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cavalle-pickle
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
  - "Luismi Cavall\xC3\xA9"
@@ -35,7 +35,6 @@ files:
35
35
  - lib/pickle.rb
36
36
  has_rdoc: false
37
37
  homepage: http://github.com/cavalle/pickle
38
- licenses:
39
38
  post_install_message:
40
39
  rdoc_options:
41
40
  - --charset=UTF-8
@@ -56,11 +55,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
55
  requirements: []
57
56
 
58
57
  rubyforge_project:
59
- rubygems_version: 1.3.5
58
+ rubygems_version: 1.2.0
60
59
  signing_key:
61
60
  specification_version: 3
62
61
  summary: A pickle is a cucumber fermented in vinegar or brine
63
62
  test_files:
64
63
  - spec/acceptance/acceptance_helper.rb
64
+ - spec/acceptance/acceptance_spec_generator_spec.rb
65
65
  - spec/acceptance/basic_spec.rb
66
+ - spec/acceptance/pickle_generator_spec.rb
66
67
  - spec/acceptance/rails_spec.rb