rspec-web 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/Gemfile.lock +45 -0
- data/VERSION +1 -0
- data/bin/rspec-web +5 -0
- data/lib/rspec_web/formatter.rb +136 -0
- data/lib/rspec_web/web_application/public/css/bootstrap.bottombar.css +48 -0
- data/lib/rspec_web/web_application/public/css/bootstrap.css +610 -0
- data/lib/rspec_web/web_application/public/css/bootstrap.responsive.css +3 -0
- data/lib/rspec_web/web_application/public/img/bootstrap.png +0 -0
- data/lib/rspec_web/web_application/public/img/glyphicons-halflings-white.png +0 -0
- data/lib/rspec_web/web_application/public/img/glyphicons-halflings.png +0 -0
- data/lib/rspec_web/web_application/public/img/rails.png +0 -0
- data/lib/rspec_web/web_application/public/img/traffic.png +0 -0
- data/lib/rspec_web/web_application/public/js/bootstrap.js +1 -0
- data/lib/rspec_web/web_application/public/js/date.js +104 -0
- data/lib/rspec_web/web_application/public/js/jquery.cookie.js +47 -0
- data/lib/rspec_web/web_application/public/js/jquery.gracefulWebSocket.js +165 -0
- data/lib/rspec_web/web_application/public/js/jquery.js +4 -0
- data/lib/rspec_web/web_application/public/js/jquery.json.js +22 -0
- data/lib/rspec_web/web_application/public/js/script.js +258 -0
- data/lib/rspec_web/web_application/public/js/tmpl.js +35 -0
- data/lib/rspec_web/web_application/views/index.haml +161 -0
- data/lib/rspec_web/web_application/views/style.scss +155 -0
- data/lib/rspec_web/web_application.rb +24 -0
- data/lib/rspec_web/web_socket_server.rb +53 -0
- data/lib/rspec_web.rb +17 -0
- metadata +137 -0
    
        data/Gemfile.lock
    ADDED
    
    | @@ -0,0 +1,45 @@ | |
| 1 | 
            +
            PATH
         | 
| 2 | 
            +
              remote: .
         | 
| 3 | 
            +
              specs:
         | 
| 4 | 
            +
                rspec-web (0.1.1)
         | 
| 5 | 
            +
                  em-websocket (~> 0.3.6)
         | 
| 6 | 
            +
                  haml (~> 3.1.4)
         | 
| 7 | 
            +
                  rspec (~> 2.8.0)
         | 
| 8 | 
            +
                  sass (~> 3.1.14)
         | 
| 9 | 
            +
                  sinatra (~> 1.3.2)
         | 
| 10 | 
            +
                  web-socket-ruby (~> 0.1.0)
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            GEM
         | 
| 13 | 
            +
              remote: http://rubygems.org/
         | 
| 14 | 
            +
              specs:
         | 
| 15 | 
            +
                addressable (2.2.7)
         | 
| 16 | 
            +
                diff-lcs (1.1.3)
         | 
| 17 | 
            +
                em-websocket (0.3.6)
         | 
| 18 | 
            +
                  addressable (>= 2.1.1)
         | 
| 19 | 
            +
                  eventmachine (>= 0.12.9)
         | 
| 20 | 
            +
                eventmachine (0.12.10)
         | 
| 21 | 
            +
                haml (3.1.4)
         | 
| 22 | 
            +
                rack (1.4.1)
         | 
| 23 | 
            +
                rack-protection (1.2.0)
         | 
| 24 | 
            +
                  rack
         | 
| 25 | 
            +
                rspec (2.8.0)
         | 
| 26 | 
            +
                  rspec-core (~> 2.8.0)
         | 
| 27 | 
            +
                  rspec-expectations (~> 2.8.0)
         | 
| 28 | 
            +
                  rspec-mocks (~> 2.8.0)
         | 
| 29 | 
            +
                rspec-core (2.8.0)
         | 
| 30 | 
            +
                rspec-expectations (2.8.0)
         | 
| 31 | 
            +
                  diff-lcs (~> 1.1.2)
         | 
| 32 | 
            +
                rspec-mocks (2.8.0)
         | 
| 33 | 
            +
                sass (3.1.15)
         | 
| 34 | 
            +
                sinatra (1.3.2)
         | 
| 35 | 
            +
                  rack (~> 1.3, >= 1.3.6)
         | 
| 36 | 
            +
                  rack-protection (~> 1.2)
         | 
| 37 | 
            +
                  tilt (~> 1.3, >= 1.3.3)
         | 
| 38 | 
            +
                tilt (1.3.3)
         | 
| 39 | 
            +
                web-socket-ruby (0.1.0)
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            PLATFORMS
         | 
| 42 | 
            +
              ruby
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            DEPENDENCIES
         | 
| 45 | 
            +
              rspec-web!
         | 
    
        data/VERSION
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            0.1.1
         | 
    
        data/bin/rspec-web
    ADDED
    
    
| @@ -0,0 +1,136 @@ | |
| 1 | 
            +
            require 'bundler/setup'
         | 
| 2 | 
            +
            require 'json'
         | 
| 3 | 
            +
            require 'timeout'
         | 
| 4 | 
            +
            require 'rspec/core/formatters/base_formatter'
         | 
| 5 | 
            +
            require 'web_socket'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            module RspecWeb
         | 
| 8 | 
            +
              class Formatter < RSpec::Core::Formatters::BaseFormatter
         | 
| 9 | 
            +
                def start(example_count)
         | 
| 10 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 11 | 
            +
                  # puts "example_count => #{example_count.inspect}"
         | 
| 12 | 
            +
                  puts "Starting specs.. "
         | 
| 13 | 
            +
                  puts "View at http://0.0.0.0:4567"
         | 
| 14 | 
            +
                  
         | 
| 15 | 
            +
                  @timestamp = Time.now.to_i
         | 
| 16 | 
            +
                  
         | 
| 17 | 
            +
                  @socket = WebSocket.new("ws://localhost:10081")
         | 
| 18 | 
            +
                  
         | 
| 19 | 
            +
                  message = { receiver: "server", method: "identify", arguments: ["rspec"] }
         | 
| 20 | 
            +
                  @socket.send(message.to_json)
         | 
| 21 | 
            +
                  
         | 
| 22 | 
            +
                  message = { receiver: "web", method: "startNewIteration", arguments: [@timestamp, example_count] }
         | 
| 23 | 
            +
                  @socket.send(message.to_json)
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
                
         | 
| 26 | 
            +
                def example_group_started(example_group)
         | 
| 27 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
                
         | 
| 30 | 
            +
                def example_group_finished(example_group)
         | 
| 31 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 32 | 
            +
                  # # puts "example_group => #{example_group.inspect}"
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
                
         | 
| 35 | 
            +
                def example_started(example)
         | 
| 36 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 37 | 
            +
                  # # puts "example => #{example.inspect}"
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
                
         | 
| 40 | 
            +
                def example_passed(example)
         | 
| 41 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 42 | 
            +
                  
         | 
| 43 | 
            +
                  data = {
         | 
| 44 | 
            +
                    :started_at => example.metadata[:execution_result][:started_at].to_i,
         | 
| 45 | 
            +
                    :finished_at => example.metadata[:execution_result][:started_at].to_i,
         | 
| 46 | 
            +
                    :run_time => example.metadata[:execution_result][:run_time],
         | 
| 47 | 
            +
                    :file_path => example.metadata[:file_path],
         | 
| 48 | 
            +
                    :line_number => example.metadata[:line_number],
         | 
| 49 | 
            +
                    :description => example.metadata[:full_description]
         | 
| 50 | 
            +
                  }
         | 
| 51 | 
            +
                  
         | 
| 52 | 
            +
                  message = { receiver: "web", method: "addToPassing", arguments: [@timestamp, data] }
         | 
| 53 | 
            +
                  @socket.send(message.to_json)
         | 
| 54 | 
            +
                end
         | 
| 55 | 
            +
                
         | 
| 56 | 
            +
                def example_pending(example)
         | 
| 57 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 58 | 
            +
                  
         | 
| 59 | 
            +
                  data = {
         | 
| 60 | 
            +
                    :started_at => example.metadata[:execution_result][:started_at].to_i,
         | 
| 61 | 
            +
                    :finished_at => example.metadata[:execution_result][:started_at].to_i,
         | 
| 62 | 
            +
                    :run_time => example.metadata[:execution_result][:run_time],
         | 
| 63 | 
            +
                    :file_path => example.metadata[:file_path],
         | 
| 64 | 
            +
                    :line_number => example.metadata[:line_number],
         | 
| 65 | 
            +
                    :description => example.metadata[:full_description]
         | 
| 66 | 
            +
                  }
         | 
| 67 | 
            +
                  
         | 
| 68 | 
            +
                  message = { receiver: "web", method: "addToPending", arguments: [@timestamp, data] }
         | 
| 69 | 
            +
                  @socket.send(message.to_json)
         | 
| 70 | 
            +
                end
         | 
| 71 | 
            +
                
         | 
| 72 | 
            +
                def example_failed(example)
         | 
| 73 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 74 | 
            +
                  
         | 
| 75 | 
            +
                  data = {
         | 
| 76 | 
            +
                    :started_at => example.metadata[:execution_result][:started_at].to_i,
         | 
| 77 | 
            +
                    :finished_at => example.metadata[:execution_result][:started_at].to_i,
         | 
| 78 | 
            +
                    :run_time => example.metadata[:execution_result][:run_time],
         | 
| 79 | 
            +
                    :file_path => example.metadata[:file_path],
         | 
| 80 | 
            +
                    :line_number => example.metadata[:line_number],
         | 
| 81 | 
            +
                    :description => example.metadata[:full_description]
         | 
| 82 | 
            +
                  }
         | 
| 83 | 
            +
                  
         | 
| 84 | 
            +
                  message = { receiver: "web", method: "addToFailing", arguments: [@timestamp, data] }
         | 
| 85 | 
            +
                  @socket.send(message.to_json)
         | 
| 86 | 
            +
                end
         | 
| 87 | 
            +
                
         | 
| 88 | 
            +
                def start_dump
         | 
| 89 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 90 | 
            +
                end
         | 
| 91 | 
            +
                
         | 
| 92 | 
            +
                def dump_failed(example)
         | 
| 93 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 94 | 
            +
                  # puts "example => #{example.inspect}"
         | 
| 95 | 
            +
                end
         | 
| 96 | 
            +
                
         | 
| 97 | 
            +
                def dump_summary(duration, example_count, failure_count, pending_count)
         | 
| 98 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 99 | 
            +
                  # puts "duration => #{duration.inspect}"
         | 
| 100 | 
            +
                  # puts "example_count => #{example_count.inspect}"
         | 
| 101 | 
            +
                  # puts "failure_count => #{failure_count.inspect}"
         | 
| 102 | 
            +
                  # puts "pending_count => #{pending_count.inspect}"
         | 
| 103 | 
            +
                end
         | 
| 104 | 
            +
                
         | 
| 105 | 
            +
                def message(message)
         | 
| 106 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 107 | 
            +
                  # puts "message => #{message.inspect}"
         | 
| 108 | 
            +
                end
         | 
| 109 | 
            +
                
         | 
| 110 | 
            +
                def dump_failures
         | 
| 111 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 112 | 
            +
                end
         | 
| 113 | 
            +
                
         | 
| 114 | 
            +
                def dump_pending
         | 
| 115 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 116 | 
            +
                end
         | 
| 117 | 
            +
                
         | 
| 118 | 
            +
                def format_backtrace(backtrace, example)
         | 
| 119 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 120 | 
            +
                  # puts "backtrace => #{backtrace.inspect}"
         | 
| 121 | 
            +
                  # # puts "example => #{example.inspect}"
         | 
| 122 | 
            +
                end
         | 
| 123 | 
            +
                
         | 
| 124 | 
            +
                def close
         | 
| 125 | 
            +
                  # puts "#{__method__} -----------------------"
         | 
| 126 | 
            +
                  
         | 
| 127 | 
            +
                  puts "Specs finished!.. "
         | 
| 128 | 
            +
                  
         | 
| 129 | 
            +
                  message = { receiver: "server", method: "disconnect", arguments: ["rspec"] }
         | 
| 130 | 
            +
                  
         | 
| 131 | 
            +
                  @socket.send(message.to_json)
         | 
| 132 | 
            +
                  
         | 
| 133 | 
            +
                  @socket.close
         | 
| 134 | 
            +
                end
         | 
| 135 | 
            +
              end
         | 
| 136 | 
            +
            end
         | 
| @@ -0,0 +1,48 @@ | |
| 1 | 
            +
            /*!
         | 
| 2 | 
            +
            * Bootstrap v1.2.0
         | 
| 3 | 
            +
            *
         | 
| 4 | 
            +
            * Copyright 2011 Twitter,Inc
         | 
| 5 | 
            +
            * Licensed under the Apache License v2.0
         | 
| 6 | 
            +
            * http://www.apache.org/licenses/LICENSE-2.0
         | 
| 7 | 
            +
            *
         | 
| 8 | 
            +
            * Designed and built with all the love in the world @twitter by @mdo and @fat.
         | 
| 9 | 
            +
            * Date:Fri Sep 9 20:48:32 PDT 2011
         | 
| 10 | 
            +
            */
         | 
| 11 | 
            +
            /* Reset.less
         | 
| 12 | 
            +
            * Props to Eric Meyer (meyerweb.com) for his CSS reset file. We're using an adapted version here that cuts out some of the reset HTML elements we will never need here (i.e.,dfn,samp,etc).
         | 
| 13 | 
            +
            * ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
         | 
| 14 | 
            +
            .bottombar{height:40px;position:fixed;bottom:0;left:0;right:0;z-index:10000;overflow:visible;}
         | 
| 15 | 
            +
            .bottombar .fill{background:#222;background-color:#222222;background-repeat:repeat-x;background-image:-khtml-gradient(linear,left top,left bottom,from(#333333),to(#222222));background-image:-moz-linear-gradient(top,#333333,#222222);background-image:-ms-linear-gradient(top,#333333,#222222);background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#333333),color-stop(100%,#222222));background-image:-webkit-linear-gradient(top,#333333,#222222);background-image:-o-linear-gradient(top,#333333,#222222);background-image:linear-gradient(top,#333333,#222222);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1);box-shadow:0 1px 3px rgba(0,0,0,0.25),inset 0 -1px 0 rgba(0,0,0,0.1);}
         | 
| 16 | 
            +
            .bottombar a{color:#bfbfbf;text-shadow:0 -1px 0 rgba(0,0,0,0.25);}
         | 
| 17 | 
            +
            .bottombar a:hover,.bottombar ul li.active a{background-color:#333;background-color:rgba(255,255,255,0.05);color:#ffffff;text-decoration:none;}
         | 
| 18 | 
            +
            .bottombar h3{position:relative;}
         | 
| 19 | 
            +
            .bottombar h3 a{float:left;display:block;padding:8px 20px 12px;margin-left:-20px;color:#ffffff;font-size:20px;font-weight:200;line-height:1;}
         | 
| 20 | 
            +
            .bottombar form{float:left;margin:5px 0 0 0;position:relative;filter:alpha(opacity=100);-khtml-opacity:1;-moz-opacity:1;opacity:1;}
         | 
| 21 | 
            +
            .bottombar form input{background-color:#444;background-color:rgba(255,255,255,0.3);font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:normal;font-weight:13px;line-height:1;width:220px;padding:4px 9px;color:#fff;color:rgba(255,255,255,0.75);border:1px solid #111;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0px rgba(255,255,255,0.25);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0px rgba(255,255,255,0.25);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0px rgba(255,255,255,0.25);-webkit-transition:none;-moz-transition:none;transition:none;}
         | 
| 22 | 
            +
            .bottombar form input:-moz-placeholder{color:#e6e6e6;}
         | 
| 23 | 
            +
            .bottombar form input::-webkit-input-placeholder{color:#e6e6e6;}
         | 
| 24 | 
            +
            .bottombar form input:hover{background-color:#bfbfbf;background-color:rgba(255,255,255,0.5);color:#fff;}
         | 
| 25 | 
            +
            .bottombar form input:focus,.bottombar form input.focused{outline:none;background-color:#fff;color:#404040;text-shadow:0 1px 0 #fff;border:0;padding:5px 10px;-webkit-box-shadow:0 0 3px rgba(0,0,0,0.15);-moz-box-shadow:0 0 3px rgba(0,0,0,0.15);box-shadow:0 0 3px rgba(0,0,0,0.15);}
         | 
| 26 | 
            +
            .bottombar ul{display:block;float:left;margin:0 10px 0 0;position:relative;}
         | 
| 27 | 
            +
            .bottombar ul.secondary-nav{float:right;margin-left:10px;margin-right:0;}
         | 
| 28 | 
            +
            .bottombar ul li{display:block;float:left;font-size:13px;}
         | 
| 29 | 
            +
            .bottombar ul li a{display:block;float:none;padding:10px 10px 11px;line-height:19px;text-decoration:none;}
         | 
| 30 | 
            +
            .bottombar ul li a:hover{color:#fff;text-decoration:none;}
         | 
| 31 | 
            +
            .bottombar ul li.active a{background-color:#222;background-color:rgba(0,0,0,0.5);}
         | 
| 32 | 
            +
            .bottombar ul.primary-nav li ul{left:0;}
         | 
| 33 | 
            +
            .bottombar ul.secondary-nav li ul{right:0;}
         | 
| 34 | 
            +
            .bottombar ul li.menu{position:relative;}
         | 
| 35 | 
            +
            .bottombar ul li.menu a.menu:after{width:0px;height:0px;display:inline-block;content:"↑";text-indent:-99999px;vertical-align:top;margin-top:8px;margin-left:4px;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #fff;filter:alpha(opacity=50);-khtml-opacity:0.5;-moz-opacity:0.5;opacity:0.5;}
         | 
| 36 | 
            +
            .bottombar ul li.menu.open a.menu,.bottombar ul li.menu.open a:hover{background-color:#444;background-color:rgba(255,255,255,0.1);*background-color:#444;/* IE6-7 */
         | 
| 37 | 
            +
            color:#fff;}
         | 
| 38 | 
            +
            .bottombar ul li.menu.open ul{display:block;}
         | 
| 39 | 
            +
            .bottombar ul li.menu.open ul li a{background-color:transparent;font-weight:normal;}
         | 
| 40 | 
            +
            .bottombar ul li.menu.open ul li a:hover{background-color:rgba(255,255,255,0.1);*background-color:#444;/* IE6-7 */
         | 
| 41 | 
            +
            color:#fff;}
         | 
| 42 | 
            +
            .bottombar ul li.menu.open ul li.active a{background-color:rgba(255,255,255,0.1);font-weight:bold;}
         | 
| 43 | 
            +
            .bottombar ul li ul{background-color:#333;float:left;display:none;position:absolute;bottom:40px;min-width:160px;max-width:220px;_width:160px;margin-left:0;margin-right:0;padding:0;text-align:left;border:0;zoom:1;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0;-webkit-box-shadow:0 -1px 2px rgba(0,0,0,0.6);-moz-box-shadow:0 -1px 2px rgba(0,0,0,0.6);box-shadow:0 -1px 2px rgba(0,0,0,0.6);}
         | 
| 44 | 
            +
            .bottombar ul li ul li{float:none;clear:both;display:block;background:none;font-size:12px;}
         | 
| 45 | 
            +
            .bottombar ul li ul li a{display:block;padding:6px 15px;clear:both;font-weight:normal;line-height:19px;color:#bbb;}
         | 
| 46 | 
            +
            .bottombar ul li ul li a:hover{background-color:#333;background-color:rgba(255,255,255,0.25);color:#fff;}
         | 
| 47 | 
            +
            .bottombar ul li ul li.divider{height:1px;overflow:hidden;background:#222;background:rgba(0,0,0,0.2);border-bottom:1px solid rgba(255,255,255,0.1);margin:5px 0;}
         | 
| 48 | 
            +
            .bottombar ul li ul li span{clear:both;display:block;background:rgba(0,0,0,0.2);padding:6px 15px;cursor:default;color:#808080;border-top:1px solid rgba(0,0,0,0.2);}
         |