Skip to content
This repository
Browse code

Remove whitespaces and replace double quotes with single quotes were …

…possible
  • Loading branch information...
commit 2ca42a757008c03e0af4845b361b3ed77c37b974 1 parent a37eee1
Luismi Cavallé authored April 24, 2011
21  README.md
Source Rendered
@@ -8,22 +8,22 @@ The delicious combination of RSpec and Capybara for Acceptance BDD
8 8
 
9 9
 Steak is a minimal extension of RSpec-Rails that adds several conveniences to do acceptance testing of Rails applications using Capybara. It's an alternative to Cucumber in plain Ruby. This is how and acceptance spec looks like in Steak:
10 10
 
11  
-    feature "Main page" do
  11
+    feature 'Main page' do
12 12
 
13 13
       background do
14  
-        create_user :login => "jdoe"
  14
+        create_user :login => 'jdoe'
15 15
       end
16 16
 
17  
-      scenario "should show existing quotes" do
18  
-        create_quote :text => "The language of friendship is not words, but meanings",
19  
-                     :author => "Henry David Thoreau"
  17
+      scenario 'should show existing quotes' do
  18
+        create_quote :text => 'The language of friendship is not words, but meanings',
  19
+                     :author => 'Henry David Thoreau'
20 20
 
21  
-        login_as "jdoe"
22  
-        visit "/"
  21
+        login_as 'jdoe'
  22
+        visit '/'
23 23
 
24  
-        within(".quote") do
25  
-          page.should have_content("The language of friendship is not words, but meanings")
26  
-          page.should have_content("Henry David Thoreau")
  24
+        within('.quote') do
  25
+          page.should have_content('The language of friendship is not words, but meanings')
  26
+          page.should have_content('Henry David Thoreau')
27 27
         end
28 28
       end
29 29
       
@@ -104,4 +104,3 @@ Steak was created by [Luismi Cavallé](http://lmcavalle.com) and improved thanks
104 104
 * Joao Carlos
105 105
 
106 106
 Copyright © 2009 - 2011 Luismi Cavallé, released under the MIT license
107  
-
4  lib/generators/steak/install_generator.rb
@@ -2,11 +2,11 @@ module Steak
2 2
   module Generators
3 3
     class InstallGenerator < Rails::Generators::Base
4 4
       source_root File.join(File.dirname(__FILE__), 'templates')
5  
-      
  5
+
6 6
       def main
7 7
         generate    'rspec:install'
8 8
         directory   'spec/acceptance/support'
9 9
       end
10 10
     end
11 11
   end
12  
-end
  12
+end
2  lib/generators/steak/spec_generator.rb
@@ -8,4 +8,4 @@ def main
8 8
       end
9 9
     end
10 10
   end
11  
-end
  11
+end
6  lib/generators/steak/templates/acceptance_spec.rb
@@ -5,9 +5,9 @@
5 5
   As a ...
6 6
   I want ...
7 7
 } do
8  
-  
  8
+
9 9
   scenario 'first scenario' do
10 10
     true.should == true
11 11
   end
12  
-  
13  
-end
  12
+
  13
+end
4  lib/steak.rb
@@ -4,7 +4,7 @@
4 4
 module Steak
5 5
   class Railtie < ::Rails::Railtie
6 6
     rake_tasks do
7  
-      load "tasks/steak_tasks.rake"
  7
+      load 'tasks/steak_tasks.rake'
8 8
     end
9 9
   end
10  
-end
  10
+end
2  lib/steak/version.rb
... ...
@@ -1,3 +1,3 @@
1 1
 module Steak
2  
-  VERSION = "2.0.0.a0"
  2
+  VERSION = '2.0.0.a0'
3 3
 end
6  lib/tasks/steak_tasks.rake
... ...
@@ -1,6 +1,6 @@
1 1
 namespace :spec do
2  
-  desc "Run the acceptance specs in spec/acceptance"
3  
-  RSpec::Core::RakeTask.new(:acceptance => "db:test:prepare") do |t|
4  
-    t.pattern = "spec/acceptance/**/*_spec.rb"
  2
+  desc 'Run the acceptance specs in spec/acceptance'
  3
+  RSpec::Core::RakeTask.new(:acceptance => 'db:test:prepare') do |t|
  4
+    t.pattern = 'spec/acceptance/**/*_spec.rb'
5 5
   end
6 6
 end
16  spec/acceptance/creating_specs_spec.rb
@@ -5,20 +5,20 @@
5 5
   As a lazy Rails developer
6 6
   I want empty new specs to be generated for me
7 7
 } do
8  
-  
  8
+
9 9
   scenario 'using the spec generator' do
10 10
     new_project_from :rails_project_with_steak
11  
-    
  11
+
12 12
     run 'rails g steak:spec my_first_feature'
13  
-    
  13
+
14 14
     path('spec/acceptance/my_first_feature_spec.rb').should exist
15 15
     content_of('spec/acceptance/my_first_feature_spec.rb').should include("feature 'My first feature'")
16  
-    
  16
+
17 17
     run 'rspec spec/acceptance/my_first_feature_spec.rb'
18  
-    
  18
+
19 19
     output.should =~ /1 example, 0 failures/
20 20
   end
21  
-  
  21
+
22 22
   scenario 'under a subdirectory' do
23 23
     new_project_from :rails_project_with_steak
24 24
 
@@ -30,5 +30,5 @@
30 30
 
31 31
     output.should =~ /1 example, 0 failures/
32 32
   end
33  
-  
34  
-end
  33
+
  34
+end
12  spec/acceptance/getting_started_spec.rb
@@ -5,27 +5,27 @@
5 5
   As a Rails developer
6 6
   I want set up my project for Acceptance BDD
7 7
 } do
8  
-  
  8
+
9 9
   scenario 'from an empty Rails project' do
10 10
     new_project_from :rails_project
11  
-    
  11
+
12 12
     append_to 'Gemfile', <<-GEMS
13 13
       group :test, :development do
14 14
         gem 'steak', :path => '#{root_path}'
15 15
         gem 'capybara', :path => '#{Bundler.load.specs['capybara'].first.full_gem_path}' # Totally temporal. It should be a steak dependency
16 16
       end
17 17
     GEMS
18  
-    
  18
+
19 19
     run 'bundle --local'
20 20
     run 'rails g steak:install'
21  
-    
  21
+
22 22
     # rspec-rails should be present
23 23
     path('spec').should exist
24 24
     path('spec/spec_helper.rb').should exist
25  
-    
  25
+
26 26
     # steak should be present
27 27
     path('spec/acceptance').should exist
28 28
     path('spec/acceptance/support').should exist
29 29
   end
30 30
 
31  
-end
  31
+end
12  spec/acceptance/rake_support_spec.rb
@@ -5,12 +5,12 @@
5 5
   As a Rails developer
6 6
   I want rake support in Steak
7 7
 } do
8  
-  
  8
+
9 9
   background do
10 10
     new_project_from :rails_project_with_steak
11 11
     create_file 'spec/unit_spec.rb', <<-RSPEC
12 12
       require 'spec_helper'
13  
-      
  13
+
14 14
       describe Object do
15 15
         it { should respond_to :to_s }
16 16
       end
@@ -18,11 +18,11 @@
18 18
     run 'rails g steak:spec my_spec'
19 19
     run 'rake db:migrate'
20 20
   end
21  
-  
  21
+
22 22
   scenario 'to run acceptance specs as part of the test suite' do
23 23
     run 'rake spec'
24 24
     output.should =~ /2 examples, 0 failures/
25  
-    
  25
+
26 26
     run 'rake'
27 27
     output.should =~ /2 examples, 0 failures/
28 28
   end
@@ -31,5 +31,5 @@
31 31
     run 'rake spec:acceptance'
32 32
     output.should =~ /1 example, 0 failures/
33 33
   end
34  
-  
35  
-end
  34
+
  35
+end
2  spec/spec_helper.rb
@@ -4,4 +4,4 @@
4 4
 require 'rails'
5 5
 require 'steak'
6 6
 
7  
-require 'support/helpers'
  7
+require 'support/helpers'
30  spec/support/helpers.rb
... ...
@@ -1,7 +1,7 @@
1 1
 require 'tempfile'
2 2
 
3 3
 module Helpers
4  
-  
  4
+
5 5
   def new_project_from(fixture_name)
6 6
     rm_rf rails_project_path
7 7
     cp_r fixture_path(fixture_name), rails_project_path
@@ -11,53 +11,53 @@ def new_project_from(fixture_name)
11 11
   def append_to(path, content)
12 12
     rails_project_path.join(path).open('a') { |f| f.write content }
13 13
   end
14  
-  
  14
+
15 15
   def create_file(path, content)
16 16
     rails_project_path.join(path).open('w') { |f| f.write content }
17 17
   end
18  
-  
  18
+
19 19
   attr_accessor :output
20  
-  
  20
+
21 21
   def run(command)
22 22
     self.output = Bundler.with_clean_env { `#{command} 2>&1` }
23  
-    
  23
+
24 24
     log "$ #{command}"
25 25
     log self.output
26 26
     raise "`#{command}` failed with:\n#{output}" unless $?.success?
27 27
   end
28  
-  
  28
+
29 29
   def path(path)
30 30
     rails_project_path.join(path)
31 31
   end
32  
-  
  32
+
33 33
   def content_of(path)
34 34
     File.read path(path)
35 35
   end
36  
-  
  36
+
37 37
   def cd(*args)
38 38
     silence_warnings { Dir.chdir(*args) }
39 39
   end
40  
-  
  40
+
41 41
   def rm_rf(*args)
42 42
     FileUtils.rm_rf *args
43 43
   end
44  
-  
  44
+
45 45
   def cp_r(*args)
46 46
     FileUtils.cp_r *args
47 47
   end
48  
-  
  48
+
49 49
   def root_path
50 50
     Bundler.root
51 51
   end
52  
-  
  52
+
53 53
   def rails_project_path
54 54
     Pathname.new(Dir.tmpdir).join('rails_project')
55 55
   end
56  
-  
57  
-  def fixture_path(name = ".")
  56
+
  57
+  def fixture_path(name = '.')
58 58
     root_path.join('spec', 'fixtures', name.to_s)
59 59
   end
60  
-  
  60
+
61 61
   def log(text)
62 62
     puts text if ENV['TRACE']
63 63
   end
12  spec/support/refresh_fixtures_task.rb
... ...
@@ -1,10 +1,10 @@
1  
-desc "Regenerates the fixture projects in spec/fixtures"
  1
+desc 'Regenerates the fixture projects in spec/fixtures'
2 2
 task :refresh_fixtures do
3 3
   Bundler.setup
4 4
   require 'rails'
5 5
   require File.dirname(__FILE__) + '/helpers'
6 6
   include Helpers
7  
-  
  7
+
8 8
   rm_rf fixture_path(:rails_project)
9 9
   rm_rf fixture_path(:rails_project_with_steak)
10 10
   rm_rf rails_project_path
@@ -15,16 +15,16 @@
15 15
   cd rails_project_path
16 16
 
17 17
   append_to 'Gemfile', <<-RUBY
18  
-    group :test, :development do 
  18
+    group :test, :development do
19 19
       gem 'steak', :path => '#{root_path}'
20 20
       gem 'capybara', :path => '#{Bundler.load.specs['capybara'].first.full_gem_path}' # Totally temporal. It should be a steak dependency
21 21
     end
22 22
   RUBY
23  
-  
  23
+
24 24
   run 'bundle --local'
25 25
   run 'rails g steak:install'
26 26
 
27 27
   cp_r rails_project_path, fixture_path(:rails_project_with_steak)
28  
-  
  28
+
29 29
   cd root_path
30  
-end
  30
+end

0 notes on commit 2ca42a7

Please sign in to comment.
Something went wrong with that request. Please try again.