cuukie 0.1.0 → 0.1.1
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/README.markdown +1 -1
- data/Rakefile +15 -25
- data/VERSION +1 -1
- data/cuukie.gemspec +74 -0
- data/lib/cuukie/formatter/cuukie.rb +8 -0
- data/lib/cuukie/public/{scenarios.js → cuukie.js} +6 -2
- data/lib/cuukie/server.rb +31 -7
- data/lib/cuukie/views/index.erb +5 -7
- data/pomodoro.txt +7 -0
- data/spec/cuukie_spec.rb +80 -47
- data/spec/test_project/features/step_definitions/example_steps.rb +3 -0
- metadata +14 -14
- data/smoke_test.sh +0 -1
    
        data/README.markdown
    CHANGED
    
    | @@ -2,4 +2,4 @@ Cuukie shows your Cucumber results in a web page as they run. | |
| 2 2 |  | 
| 3 3 | 
             
            [](http://travis-ci.org/nusco/cuukie.png)
         | 
| 4 4 |  | 
| 5 | 
            -
             | 
| 5 | 
            +
            There is a gem out, but it's still an early version. I'll update this README when Cuukie is a tad more solid.
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -1,23 +1,24 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            require 'rspec/core/rake_task'
         | 
| 1 | 
            +
            require 'bundler/setup'
         | 
| 3 2 |  | 
| 4 | 
            -
             | 
| 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
         | 
| 3 | 
            +
            task :default => 'test:specs'
         | 
| 12 4 |  | 
| 13 | 
            -
             | 
| 5 | 
            +
            namespace :test do
         | 
| 6 | 
            +
              require 'rspec/core/rake_task'
         | 
| 7 | 
            +
              desc "Run all specs"
         | 
| 8 | 
            +
              RSpec::Core::RakeTask.new(:specs)
         | 
| 14 9 |  | 
| 15 | 
            -
            desc "Run  | 
| 16 | 
            -
             | 
| 10 | 
            +
              desc "Run Cuukie on the test project (needs a cuukie_server on localhost, default port)"
         | 
| 11 | 
            +
              task :smoke do
         | 
| 12 | 
            +
                system "cucumber spec/test_project/features \
         | 
| 13 | 
            +
                        --require spec/test_project/features/step_definitions/ \
         | 
| 14 | 
            +
                        --require lib/cuukie/formatter \
         | 
| 15 | 
            +
                        --format Cuukie \
         | 
| 16 | 
            +
                        --guess"
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
| 17 19 |  | 
| 18 20 | 
             
            require 'jeweler'
         | 
| 19 21 | 
             
            Jeweler::Tasks.new do |gem|
         | 
| 20 | 
            -
              # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
         | 
| 21 22 | 
             
              gem.name = "cuukie"
         | 
| 22 23 | 
             
              gem.homepage = "http://github.com/nusco/cuukie"
         | 
| 23 24 | 
             
              gem.license = "MIT"
         | 
| @@ -25,16 +26,5 @@ Jeweler::Tasks.new do |gem| | |
| 25 26 | 
             
              gem.description = %Q{Cuukie shows the result of running Cucumber feature on a remote server.}
         | 
| 26 27 | 
             
              gem.email = "paolo.nusco.perrotta@gmail.com"
         | 
| 27 28 | 
             
              gem.authors = ['Paolo "Nusco" Perrotta']
         | 
| 28 | 
            -
              # dependencies defined in Gemfile
         | 
| 29 29 | 
             
            end
         | 
| 30 30 | 
             
            Jeweler::RubygemsDotOrgTasks.new
         | 
| 31 | 
            -
             | 
| 32 | 
            -
            require 'rake/rdoctask'
         | 
| 33 | 
            -
            Rake::RDocTask.new do |rdoc|
         | 
| 34 | 
            -
              version = File.exist?('VERSION') ? File.read('VERSION') : ""
         | 
| 35 | 
            -
             | 
| 36 | 
            -
              rdoc.rdoc_dir = 'rdoc'
         | 
| 37 | 
            -
              rdoc.title = "cuukie #{version}"
         | 
| 38 | 
            -
              rdoc.rdoc_files.include('README*')
         | 
| 39 | 
            -
              rdoc.rdoc_files.include('lib/**/*.rb')
         | 
| 40 | 
            -
            end
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.1. | 
| 1 | 
            +
            0.1.1
         | 
    
        data/cuukie.gemspec
    ADDED
    
    | @@ -0,0 +1,74 @@ | |
| 1 | 
            +
            # Generated by jeweler
         | 
| 2 | 
            +
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 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 = "cuukie"
         | 
| 8 | 
            +
              s.version = "0.1.1"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            +
              s.authors = ["Paolo \"Nusco\" Perrotta"]
         | 
| 12 | 
            +
              s.date = "2011-12-04"
         | 
| 13 | 
            +
              s.description = "Cuukie shows the result of running Cucumber feature on a remote server."
         | 
| 14 | 
            +
              s.email = "paolo.nusco.perrotta@gmail.com"
         | 
| 15 | 
            +
              s.executables = ["cuukie_server"]
         | 
| 16 | 
            +
              s.extra_rdoc_files = [
         | 
| 17 | 
            +
                "LICENSE.txt",
         | 
| 18 | 
            +
                "README.markdown"
         | 
| 19 | 
            +
              ]
         | 
| 20 | 
            +
              s.files = [
         | 
| 21 | 
            +
                ".autotest",
         | 
| 22 | 
            +
                ".rspec",
         | 
| 23 | 
            +
                ".travis.yml",
         | 
| 24 | 
            +
                "Gemfile",
         | 
| 25 | 
            +
                "LICENSE.txt",
         | 
| 26 | 
            +
                "README.markdown",
         | 
| 27 | 
            +
                "Rakefile",
         | 
| 28 | 
            +
                "VERSION",
         | 
| 29 | 
            +
                "bin/cuukie_server",
         | 
| 30 | 
            +
                "cuukie.gemspec",
         | 
| 31 | 
            +
                "lib/cuukie/formatter/cuukie.rb",
         | 
| 32 | 
            +
                "lib/cuukie/public/cucumber.css",
         | 
| 33 | 
            +
                "lib/cuukie/public/cuukie.js",
         | 
| 34 | 
            +
                "lib/cuukie/public/jquery-1.7.min.js",
         | 
| 35 | 
            +
                "lib/cuukie/server.rb",
         | 
| 36 | 
            +
                "lib/cuukie/views/index.erb",
         | 
| 37 | 
            +
                "pomodoro.txt",
         | 
| 38 | 
            +
                "spec/commands_spec.rb",
         | 
| 39 | 
            +
                "spec/cuukie_spec.rb",
         | 
| 40 | 
            +
                "spec/test_project/features/create_user.feature",
         | 
| 41 | 
            +
                "spec/test_project/features/delete_user.feature",
         | 
| 42 | 
            +
                "spec/test_project/features/step_definitions/example_steps.rb"
         | 
| 43 | 
            +
              ]
         | 
| 44 | 
            +
              s.homepage = "http://github.com/nusco/cuukie"
         | 
| 45 | 
            +
              s.licenses = ["MIT"]
         | 
| 46 | 
            +
              s.require_paths = ["lib"]
         | 
| 47 | 
            +
              s.rubygems_version = "1.8.10"
         | 
| 48 | 
            +
              s.summary = "A continuous view on Cucumber features"
         | 
| 49 | 
            +
             | 
| 50 | 
            +
              if s.respond_to? :specification_version then
         | 
| 51 | 
            +
                s.specification_version = 3
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 54 | 
            +
                  s.add_runtime_dependency(%q<sinatra>, [">= 0"])
         | 
| 55 | 
            +
                  s.add_runtime_dependency(%q<rest-client>, [">= 0"])
         | 
| 56 | 
            +
                  s.add_runtime_dependency(%q<cucumber>, [">= 0"])
         | 
| 57 | 
            +
                  s.add_development_dependency(%q<rake>, [">= 0"])
         | 
| 58 | 
            +
                  s.add_development_dependency(%q<jeweler>, [">= 0"])
         | 
| 59 | 
            +
                else
         | 
| 60 | 
            +
                  s.add_dependency(%q<sinatra>, [">= 0"])
         | 
| 61 | 
            +
                  s.add_dependency(%q<rest-client>, [">= 0"])
         | 
| 62 | 
            +
                  s.add_dependency(%q<cucumber>, [">= 0"])
         | 
| 63 | 
            +
                  s.add_dependency(%q<rake>, [">= 0"])
         | 
| 64 | 
            +
                  s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 65 | 
            +
                end
         | 
| 66 | 
            +
              else
         | 
| 67 | 
            +
                s.add_dependency(%q<sinatra>, [">= 0"])
         | 
| 68 | 
            +
                s.add_dependency(%q<rest-client>, [">= 0"])
         | 
| 69 | 
            +
                s.add_dependency(%q<cucumber>, [">= 0"])
         | 
| 70 | 
            +
                s.add_dependency(%q<rake>, [">= 0"])
         | 
| 71 | 
            +
                s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 72 | 
            +
              end
         | 
| 73 | 
            +
            end
         | 
| 74 | 
            +
             | 
| @@ -20,11 +20,15 @@ $(document).ready(function() { | |
| 20 20 | 
             
            function moveProgressBar(percentDone) {
         | 
| 21 21 | 
             
              $("cucumber-header").css('width', percentDone +"%");
         | 
| 22 22 | 
             
            }
         | 
| 23 | 
            -
            function  | 
| 23 | 
            +
            function failedColors(element_id) {
         | 
| 24 24 | 
             
              $('#'+element_id).css('background', '#C40D0D');
         | 
| 25 25 | 
             
              $('#'+element_id).css('color', '#FFFFFF');
         | 
| 26 26 | 
             
            }
         | 
| 27 | 
            -
            function  | 
| 27 | 
            +
            function pendingColors(element_id) {
         | 
| 28 28 | 
             
              $('#'+element_id).css('background', '#FAF834');
         | 
| 29 29 | 
             
              $('#'+element_id).css('color', '#000000');
         | 
| 30 30 | 
             
            }
         | 
| 31 | 
            +
            function passedColors(element_id) {
         | 
| 32 | 
            +
              $('#'+element_id).css('background', '#65c400');
         | 
| 33 | 
            +
              $('#'+element_id).css('color', '#000000');
         | 
| 34 | 
            +
            }
         | 
    
        data/lib/cuukie/server.rb
    CHANGED
    
    | @@ -1,24 +1,25 @@ | |
| 1 1 | 
             
            require 'sinatra/base'
         | 
| 2 2 | 
             
            require 'json'
         | 
| 3 3 |  | 
| 4 | 
            -
            require 'sinatra/base'
         | 
| 5 | 
            -
             | 
| 6 4 | 
             
            module Cuukie
         | 
| 7 5 | 
             
              class Server < Sinatra::Base
         | 
| 8 6 | 
             
                set :port, 4569
         | 
| 9 7 | 
             
                set :features, []
         | 
| 10 | 
            -
             | 
| 8 | 
            +
                set :build_status, nil
         | 
| 9 | 
            +
                
         | 
| 11 10 | 
             
                get '/' do
         | 
| 12 11 | 
             
                  @features = settings.features
         | 
| 12 | 
            +
                  @build_status = settings.build_status
         | 
| 13 13 | 
             
                  erb :index
         | 
| 14 14 | 
             
                end
         | 
| 15 15 |  | 
| 16 16 | 
             
                post '/before_features' do
         | 
| 17 17 | 
             
                  settings.features.clear
         | 
| 18 | 
            +
                  settings.build_status = nil
         | 
| 18 19 | 
             
                end
         | 
| 19 20 |  | 
| 20 21 | 
             
                post '/before_feature' do
         | 
| 21 | 
            -
                  feature =  | 
| 22 | 
            +
                  feature = read_from_request
         | 
| 22 23 | 
             
                  feature['description'] = feature['description'].split("\n")
         | 
| 23 24 | 
             
                  feature['scenarios'] = []
         | 
| 24 25 | 
             
                  feature['id'] = settings.features.size + 1
         | 
| @@ -27,7 +28,7 @@ module Cuukie | |
| 27 28 | 
             
                end
         | 
| 28 29 |  | 
| 29 30 | 
             
                post '/scenario_name' do
         | 
| 30 | 
            -
                  scenario =  | 
| 31 | 
            +
                  scenario = read_from_request
         | 
| 31 32 | 
             
                  scenario['steps'] = []
         | 
| 32 33 | 
             
                  scenario['id'] = "scenario_#{current_feature['id']}_#{current_scenarios.size + 1}"
         | 
| 33 34 | 
             
                  current_scenarios << scenario
         | 
| @@ -35,15 +36,31 @@ module Cuukie | |
| 35 36 | 
             
                end
         | 
| 36 37 |  | 
| 37 38 | 
             
                post '/before_step_result' do
         | 
| 38 | 
            -
                  current_scenario['steps'] <<  | 
| 39 | 
            +
                  current_scenario['steps'] << read_from_request
         | 
| 39 40 | 
             
                  'OK'
         | 
| 40 41 | 
             
                end
         | 
| 41 42 |  | 
| 42 43 | 
             
                post '/after_step_result' do
         | 
| 43 | 
            -
                  current_step.merge!  | 
| 44 | 
            +
                  current_step.merge! read_from_request
         | 
| 45 | 
            +
                  if current_step['status'] == 'failed'
         | 
| 46 | 
            +
                    current_scenario['status'] = settings.build_status = 'failed' 
         | 
| 47 | 
            +
                  elsif current_step['status'] == 'pending'
         | 
| 48 | 
            +
                    current_scenario['status'] = 'pending'
         | 
| 49 | 
            +
                    settings.build_status ||= 'pending' 
         | 
| 50 | 
            +
                  end
         | 
| 44 51 | 
             
                  'OK'
         | 
| 45 52 | 
             
                end
         | 
| 46 53 |  | 
| 54 | 
            +
                post '/after_steps' do
         | 
| 55 | 
            +
                  current_scenario['status'] ||= 'passed'
         | 
| 56 | 
            +
                  'OK'
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                post '/after_features' do
         | 
| 60 | 
            +
                  settings.build_status ||= 'passed'
         | 
| 61 | 
            +
                  'OK'
         | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
                
         | 
| 47 64 | 
             
                get('/ping') { 'pong!' }
         | 
| 48 65 | 
             
                delete('/') { exit! }
         | 
| 49 66 |  | 
| @@ -62,5 +79,12 @@ module Cuukie | |
| 62 79 | 
             
                def current_step
         | 
| 63 80 | 
             
                  current_scenario['steps'].last
         | 
| 64 81 | 
             
                end
         | 
| 82 | 
            +
                
         | 
| 83 | 
            +
                include Rack::Utils
         | 
| 84 | 
            +
                
         | 
| 85 | 
            +
                def read_from_request
         | 
| 86 | 
            +
                  result = JSON.parse(request.body.read)
         | 
| 87 | 
            +
                  result.each {|k, v| result[k] = escape_html v }
         | 
| 88 | 
            +
                end
         | 
| 65 89 | 
             
              end
         | 
| 66 90 | 
             
            end
         | 
    
        data/lib/cuukie/views/index.erb
    CHANGED
    
    | @@ -3,7 +3,7 @@ | |
| 3 3 | 
             
                <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
         | 
| 4 4 | 
             
                <link rel="stylesheet" type="text/css" href="cucumber.css">
         | 
| 5 5 | 
             
                <script type="text/javascript" src="jquery-1.7.min.js"></script>
         | 
| 6 | 
            -
                <script type="text/javascript" src=" | 
| 6 | 
            +
                <script type="text/javascript" src="cuukie.js"></script>
         | 
| 7 7 | 
             
                <title>Cuukie</title>
         | 
| 8 8 | 
             
              </head>
         | 
| 9 9 |  | 
| @@ -13,6 +13,8 @@ | |
| 13 13 | 
             
                    <div id="expand-collapse"><p id="expander">Expand All</p><p id="collapser">Collapse All</p></div>
         | 
| 14 14 | 
             
                  </div>
         | 
| 15 15 | 
             
                </div>
         | 
| 16 | 
            +
                
         | 
| 17 | 
            +
                <script><%= @build_status %>Colors('cucumber-header')</script>
         | 
| 16 18 |  | 
| 17 19 | 
             
                <% @features.each do |feature| %>
         | 
| 18 20 | 
             
                  <div class="feature">
         | 
| @@ -25,13 +27,9 @@ | |
| 25 27 | 
             
                        <h3 style="cursor: pointer;" id="<%= scenario['id'] %>">
         | 
| 26 28 | 
             
                          <span class="keyword">Scenario: </span><span class="val"><%= scenario['name'] %></span>
         | 
| 27 29 | 
             
                        </h3>
         | 
| 30 | 
            +
                        <script><%= scenario['status'] %>Colors('<%= scenario['id'] %>');</script>
         | 
| 28 31 | 
             
                        <ol style="display: block;">
         | 
| 29 | 
            -
             | 
| 30 | 
            -
                          <% if step['status'] == 'failed' %>
         | 
| 31 | 
            -
                            <script>makeRed('cucumber-header');makeRed('<%= scenario['id'] %>');</script>
         | 
| 32 | 
            -
                          <% elsif step['status'] == 'pending' %>
         | 
| 33 | 
            -
                            <script>makeRed('cucumber-header');makeYellow('<%= scenario['id'] %>');</script>
         | 
| 34 | 
            -
                          <% end %>
         | 
| 32 | 
            +
                        <% scenario['steps'].each do |step| %>
         | 
| 35 33 | 
             
                          <li id="features_" class="step <%= step['status'] %>">
         | 
| 36 34 | 
             
                            <div class="step_name">
         | 
| 37 35 | 
             
                              <span class="keyword"><%= step['keyword'] %></span><span class="step val"><%= step['name'] %></span>
         | 
    
        data/pomodoro.txt
    CHANGED
    
    | @@ -1,6 +1,13 @@ | |
| 1 1 | 
             
            I use this file to track my own work on the project. Each line is a pomodoro (a 25' slot).
         | 
| 2 2 | 
             
            Latest pomodoro comes first:
         | 
| 3 3 |  | 
| 4 | 
            +
            - refactor build status
         | 
| 5 | 
            +
            - status for entire suite
         | 
| 6 | 
            +
            - better scenario status
         | 
| 7 | 
            +
            - HTML escaping
         | 
| 8 | 
            +
            - HTML escaping (in progress)
         | 
| 9 | 
            +
            - cleanup
         | 
| 10 | 
            +
            - jewelized and released first version of gem
         | 
| 4 11 | 
             
            - scenario status, cuukie_server binary
         | 
| 5 12 | 
             
            - struggle to show scenario status (broken tests)
         | 
| 6 13 | 
             
            - mark step status (finally done)
         | 
    
        data/spec/cuukie_spec.rb
    CHANGED
    
    | @@ -1,18 +1,44 @@ | |
| 1 | 
            -
            describe 'Cuukie' do
         | 
| 1 | 
            +
            describe 'The Cuukie header' do
         | 
| 2 2 | 
             
              before(:all) do
         | 
| 3 | 
            -
                 | 
| 4 | 
            -
                run_cucumber
         | 
| 3 | 
            +
                start_server
         | 
| 5 4 | 
             
              end
         | 
| 6 5 |  | 
| 7 6 | 
             
              after(:all) do
         | 
| 8 | 
            -
                 | 
| 7 | 
            +
                stop_server
         | 
| 9 8 | 
             
              end
         | 
| 10 | 
            -
             | 
| 11 | 
            -
              it " | 
| 9 | 
            +
              
         | 
| 10 | 
            +
              it "contains essential information" do
         | 
| 11 | 
            +
                run_cucumber
         | 
| 12 12 | 
             
                html.should match '<h1>Cucumber Features</h1>'
         | 
| 13 13 | 
             
                html.should match '<title>Cuukie</title>'
         | 
| 14 14 | 
             
              end
         | 
| 15 15 |  | 
| 16 | 
            +
              it "is red if any steps failed" do
         | 
| 17 | 
            +
                run_cucumber 'spec/test_project/features/create_user.feature'
         | 
| 18 | 
            +
                html.should match /failedColors\('cucumber-header'\)/
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              it "is yellow if no steps failed but some are pending" do
         | 
| 22 | 
            +
                run_cucumber 'spec/test_project/features/create_user.feature:17'
         | 
| 23 | 
            +
                html.should match /pendingColors\('cucumber-header'\)/
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              it "is green if all steps passed" do
         | 
| 27 | 
            +
                run_cucumber 'spec/test_project/features/create_user.feature:6'
         | 
| 28 | 
            +
                html.should match /passedColors\('cucumber-header'\)/
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
            end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            describe 'The Cuukie content panel' do
         | 
| 33 | 
            +
              before(:all) do
         | 
| 34 | 
            +
                start_server
         | 
| 35 | 
            +
                run_cucumber
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
              
         | 
| 38 | 
            +
              after(:all) do
         | 
| 39 | 
            +
                stop_server
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
             | 
| 16 42 | 
             
              it "cleans up previous data at the beginning of a run" do
         | 
| 17 43 | 
             
                run_cucumber
         | 
| 18 44 | 
             
                html.scan('Feature: Create User').size.should == 1
         | 
| @@ -33,7 +59,19 @@ describe 'Cuukie' do | |
| 33 59 | 
             
              end
         | 
| 34 60 |  | 
| 35 61 | 
             
              it "shows the scenario source position" do
         | 
| 36 | 
            -
                html.should match '>spec | 
| 62 | 
            +
                html.should match '>spec/test_project/features/create_user.feature:6<'
         | 
| 63 | 
            +
              end
         | 
| 64 | 
            +
              
         | 
| 65 | 
            +
              it "shows the passed scenarios in green" do
         | 
| 66 | 
            +
                html.should match /passedColors\('scenario_1_1'\)/
         | 
| 67 | 
            +
              end
         | 
| 68 | 
            +
              
         | 
| 69 | 
            +
              it "shows the failed scenarios in red" do
         | 
| 70 | 
            +
                html.should match /failedColors\('scenario_1_2'\)/
         | 
| 71 | 
            +
              end
         | 
| 72 | 
            +
              
         | 
| 73 | 
            +
              it "shows the pending scenarios in yellow" do
         | 
| 74 | 
            +
                html.should match /pendingColors\('scenario_1_3'\)/
         | 
| 37 75 | 
             
              end
         | 
| 38 76 |  | 
| 39 77 | 
             
              it "assigns a sequential id to scenarios" do
         | 
| @@ -42,62 +80,57 @@ describe 'Cuukie' do | |
| 42 80 |  | 
| 43 81 | 
             
              it "shows the step names" do
         | 
| 44 82 | 
             
                html.should match '>Given </span><span class="step val">I am on the Admin page</span>'
         | 
| 45 | 
            -
                html.should match '> | 
| 46 | 
            -
              end
         | 
| 47 | 
            -
             | 
| 48 | 
            -
              it "shows the step source position" do
         | 
| 49 | 
            -
                html.should match '>spec/test_project/features/step_definitions/example_steps.rb:5<'
         | 
| 50 | 
            -
              end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
              it "shows the test result" do
         | 
| 53 | 
            -
                 html.should match /makeRed\('cucumber-header'\)/
         | 
| 83 | 
            +
                html.should match '>When </span><span class="step val">I create a new User</span>'
         | 
| 54 84 | 
             
              end
         | 
| 55 85 |  | 
| 56 | 
            -
              it "shows the  | 
| 57 | 
            -
                html.should match  | 
| 58 | 
            -
                html.should match /makeYellow\('scenario_1_3'\)/
         | 
| 86 | 
            +
              it "shows the step source position" do
         | 
| 87 | 
            +
                html.should match '>spec/test_project/features/step_definitions/example_steps.rb:4<'
         | 
| 59 88 | 
             
              end
         | 
| 60 89 |  | 
| 61 90 | 
             
              it "shows the step status" do
         | 
| 62 91 | 
             
                html.should match 'class="step passed"'
         | 
| 63 92 | 
             
                html.should match 'class="step pending"'
         | 
| 64 93 | 
             
              end
         | 
| 94 | 
            +
              
         | 
| 95 | 
            +
              it "escapes step names" do
         | 
| 96 | 
            +
                html.should match 'I press "Delete"'
         | 
| 97 | 
            +
              end
         | 
| 65 98 | 
             
            end
         | 
| 66 99 |  | 
| 67 100 | 
             
            require 'rest-client'
         | 
| 68 101 |  | 
| 69 | 
            -
             | 
| 70 | 
            -
               | 
| 71 | 
            -
                 | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
                  # wait until it's up
         | 
| 75 | 
            -
                  loop do
         | 
| 76 | 
            -
                    begin
         | 
| 77 | 
            -
                      GET '/ping'
         | 
| 78 | 
            -
                      return
         | 
| 79 | 
            -
                    rescue; end
         | 
| 80 | 
            -
                  end
         | 
| 81 | 
            -
                end
         | 
| 82 | 
            -
             | 
| 83 | 
            -
                def stop
         | 
| 84 | 
            -
                  # the server dies without replying, so we expect an error here
         | 
| 85 | 
            -
                  DELETE '/'
         | 
| 86 | 
            -
                rescue
         | 
| 87 | 
            -
                end
         | 
| 88 | 
            -
             | 
| 89 | 
            -
                def method_missing(name, *args)
         | 
| 90 | 
            -
                  super unless [:GET, :POST, :PUT, :DELETE].include? name.to_sym
         | 
| 91 | 
            -
                  args[0] = "http://localhost:4569#{args[0]}"
         | 
| 92 | 
            -
                  RestClient.send name.downcase, *args
         | 
| 93 | 
            -
                end
         | 
| 102 | 
            +
            [:GET, :POST, :PUT, :DELETE].each do |method|
         | 
| 103 | 
            +
              Kernel.send :define_method, method do |*args|
         | 
| 104 | 
            +
                args[0] = "http://localhost:4569#{args[0]}"
         | 
| 105 | 
            +
                RestClient.send method.downcase, *args
         | 
| 94 106 | 
             
              end
         | 
| 95 107 | 
             
            end
         | 
| 96 108 |  | 
| 109 | 
            +
            def start_server
         | 
| 110 | 
            +
              Process.detach fork { exec "ruby bin/cuukie_server >/dev/null 2>&1" }
         | 
| 111 | 
            +
             | 
| 112 | 
            +
              # wait until it's up
         | 
| 113 | 
            +
              loop do
         | 
| 114 | 
            +
                begin
         | 
| 115 | 
            +
                  GET '/ping'
         | 
| 116 | 
            +
                  return
         | 
| 117 | 
            +
                rescue; end
         | 
| 118 | 
            +
              end
         | 
| 119 | 
            +
            end
         | 
| 120 | 
            +
             | 
| 121 | 
            +
            def stop_server
         | 
| 122 | 
            +
              # the server dies without replying, so we expect an error here
         | 
| 123 | 
            +
              DELETE '/'
         | 
| 124 | 
            +
            rescue
         | 
| 125 | 
            +
            end
         | 
| 126 | 
            +
             | 
| 97 127 | 
             
            def html
         | 
| 98 | 
            -
               | 
| 128 | 
            +
              GET('/').body
         | 
| 99 129 | 
             
            end
         | 
| 100 130 |  | 
| 101 | 
            -
            def run_cucumber
         | 
| 102 | 
            -
              system  | 
| 131 | 
            +
            def run_cucumber(features = 'spec/test_project/features')
         | 
| 132 | 
            +
              system "cucumber #{features} \
         | 
| 133 | 
            +
                      --require spec/test_project/features/step_definitions/ \
         | 
| 134 | 
            +
                      --require lib/cuukie/formatter --format Cuukie \
         | 
| 135 | 
            +
                      --guess"
         | 
| 103 136 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cuukie
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.1
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -13,7 +13,7 @@ date: 2011-12-04 00:00:00.000000000 Z | |
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: sinatra
         | 
| 16 | 
            -
              requirement: & | 
| 16 | 
            +
              requirement: &70139875173140 !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                none: false
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 19 | 
             
                - - ! '>='
         | 
| @@ -21,10 +21,10 @@ dependencies: | |
| 21 21 | 
             
                    version: '0'
         | 
| 22 22 | 
             
              type: :runtime
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 | 
            -
              version_requirements: * | 
| 24 | 
            +
              version_requirements: *70139875173140
         | 
| 25 25 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 26 26 | 
             
              name: rest-client
         | 
| 27 | 
            -
              requirement: & | 
| 27 | 
            +
              requirement: &70139875172540 !ruby/object:Gem::Requirement
         | 
| 28 28 | 
             
                none: false
         | 
| 29 29 | 
             
                requirements:
         | 
| 30 30 | 
             
                - - ! '>='
         | 
| @@ -32,10 +32,10 @@ dependencies: | |
| 32 32 | 
             
                    version: '0'
         | 
| 33 33 | 
             
              type: :runtime
         | 
| 34 34 | 
             
              prerelease: false
         | 
| 35 | 
            -
              version_requirements: * | 
| 35 | 
            +
              version_requirements: *70139875172540
         | 
| 36 36 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 37 37 | 
             
              name: cucumber
         | 
| 38 | 
            -
              requirement: & | 
| 38 | 
            +
              requirement: &70139875171960 !ruby/object:Gem::Requirement
         | 
| 39 39 | 
             
                none: false
         | 
| 40 40 | 
             
                requirements:
         | 
| 41 41 | 
             
                - - ! '>='
         | 
| @@ -43,10 +43,10 @@ dependencies: | |
| 43 43 | 
             
                    version: '0'
         | 
| 44 44 | 
             
              type: :runtime
         | 
| 45 45 | 
             
              prerelease: false
         | 
| 46 | 
            -
              version_requirements: * | 
| 46 | 
            +
              version_requirements: *70139875171960
         | 
| 47 47 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 48 48 | 
             
              name: rake
         | 
| 49 | 
            -
              requirement: & | 
| 49 | 
            +
              requirement: &70139875171300 !ruby/object:Gem::Requirement
         | 
| 50 50 | 
             
                none: false
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 52 | 
             
                - - ! '>='
         | 
| @@ -54,10 +54,10 @@ dependencies: | |
| 54 54 | 
             
                    version: '0'
         | 
| 55 55 | 
             
              type: :development
         | 
| 56 56 | 
             
              prerelease: false
         | 
| 57 | 
            -
              version_requirements: * | 
| 57 | 
            +
              version_requirements: *70139875171300
         | 
| 58 58 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 59 59 | 
             
              name: jeweler
         | 
| 60 | 
            -
              requirement: & | 
| 60 | 
            +
              requirement: &70139875170740 !ruby/object:Gem::Requirement
         | 
| 61 61 | 
             
                none: false
         | 
| 62 62 | 
             
                requirements:
         | 
| 63 63 | 
             
                - - ! '>='
         | 
| @@ -65,7 +65,7 @@ dependencies: | |
| 65 65 | 
             
                    version: '0'
         | 
| 66 66 | 
             
              type: :development
         | 
| 67 67 | 
             
              prerelease: false
         | 
| 68 | 
            -
              version_requirements: * | 
| 68 | 
            +
              version_requirements: *70139875170740
         | 
| 69 69 | 
             
            description: Cuukie shows the result of running Cucumber feature on a remote server.
         | 
| 70 70 | 
             
            email: paolo.nusco.perrotta@gmail.com
         | 
| 71 71 | 
             
            executables:
         | 
| @@ -84,14 +84,14 @@ files: | |
| 84 84 | 
             
            - Rakefile
         | 
| 85 85 | 
             
            - VERSION
         | 
| 86 86 | 
             
            - bin/cuukie_server
         | 
| 87 | 
            +
            - cuukie.gemspec
         | 
| 87 88 | 
             
            - lib/cuukie/formatter/cuukie.rb
         | 
| 88 89 | 
             
            - lib/cuukie/public/cucumber.css
         | 
| 90 | 
            +
            - lib/cuukie/public/cuukie.js
         | 
| 89 91 | 
             
            - lib/cuukie/public/jquery-1.7.min.js
         | 
| 90 | 
            -
            - lib/cuukie/public/scenarios.js
         | 
| 91 92 | 
             
            - lib/cuukie/server.rb
         | 
| 92 93 | 
             
            - lib/cuukie/views/index.erb
         | 
| 93 94 | 
             
            - pomodoro.txt
         | 
| 94 | 
            -
            - smoke_test.sh
         | 
| 95 95 | 
             
            - spec/commands_spec.rb
         | 
| 96 96 | 
             
            - spec/cuukie_spec.rb
         | 
| 97 97 | 
             
            - spec/test_project/features/create_user.feature
         | 
| @@ -112,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 112 112 | 
             
                  version: '0'
         | 
| 113 113 | 
             
                  segments:
         | 
| 114 114 | 
             
                  - 0
         | 
| 115 | 
            -
                  hash: - | 
| 115 | 
            +
                  hash: -3260506594562917697
         | 
| 116 116 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 117 117 | 
             
              none: false
         | 
| 118 118 | 
             
              requirements:
         | 
    
        data/smoke_test.sh
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            cucumber spec/test_project/features --require spec/test_project/features/step_definitions/ --require lib/cuukie/formatter  --format Cuukie --guess
         |