wally 0.0.29 → 0.0.30
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/bin/wally +7 -1
 - data/lib/wally.rb +0 -1
 - data/lib/wally/application.rb +16 -15
 - data/lib/wally/counts_tags.rb +5 -5
 - data/lib/wally/feature.rb +8 -0
 - data/lib/wally/parses_features.rb +8 -1
 - data/lib/wally/search_features.rb +10 -10
 - data/lib/wally/version.rb +1 -1
 - data/lib/wally/views/feature.haml +10 -11
 - data/lib/wally/views/feature_link.haml +4 -4
 - data/lib/wally/views/layout.haml +2 -8
 - data/lib/wally/views/scenario.haml +1 -1
 - data/spec/wally/counts_tags_spec.rb +3 -8
 - data/spec/wally/feature_spec.rb +6 -0
 - data/spec/wally/parses_features_spec.rb +11 -0
 - data/spec/wally/search_features_spec.rb +8 -12
 - metadata +23 -26
 - data/lib/wally/lists_features.rb +0 -24
 - data/spec/wally/lists_features_spec.rb +0 -28
 
    
        data/bin/wally
    CHANGED
    
    | 
         @@ -10,7 +10,13 @@ elsif ARGV[0] == "push" 
     | 
|
| 
       10 
10 
     | 
    
         
             
              require "wally"
         
     | 
| 
       11 
11 
     | 
    
         
             
              features = []
         
     | 
| 
       12 
12 
     | 
    
         
             
              Dir.glob(File.join("#{ARGV[2]}", "**/*.feature")).each do |feature_path|
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                begin
         
     | 
| 
      
 14 
     | 
    
         
            +
                  gherkin = Wally::ParsesFeatures.new.parse(File.read(feature_path))
         
     | 
| 
      
 15 
     | 
    
         
            +
                rescue
         
     | 
| 
      
 16 
     | 
    
         
            +
                  puts "Couldn't parse '#{feature_path}'"
         
     | 
| 
      
 17 
     | 
    
         
            +
                  puts "Contents:"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  puts File.read(feature_path)
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
       14 
20 
     | 
    
         
             
                features << {:path => feature_path, :gherkin => gherkin}
         
     | 
| 
       15 
21 
     | 
    
         
             
              end
         
     | 
| 
       16 
22 
     | 
    
         
             
              RestClient.put "#{ARGV[1]}/features/?authentication_code=#{File.read(".wally")}", features.to_json, {:content_type => :json, :accept => :json}
         
     | 
    
        data/lib/wally.rb
    CHANGED
    
    
    
        data/lib/wally/application.rb
    CHANGED
    
    | 
         @@ -18,12 +18,8 @@ else 
     | 
|
| 
       18 
18 
     | 
    
         
             
              MongoMapper.database = "wally"
         
     | 
| 
       19 
19 
     | 
    
         
             
            end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
            def lists_features
         
     | 
| 
       22 
     | 
    
         
            -
              Wally::ListsFeatures.new
         
     | 
| 
       23 
     | 
    
         
            -
            end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
21 
     | 
    
         
             
            def tag_count
         
     | 
| 
       26 
     | 
    
         
            -
              Wally::CountsTags.new( 
     | 
| 
      
 22 
     | 
    
         
            +
              Wally::CountsTags.new(Wally::Feature).count_tags
         
     | 
| 
       27 
23 
     | 
    
         
             
            end
         
     | 
| 
       28 
24 
     | 
    
         | 
| 
       29 
25 
     | 
    
         
             
            def excessive_wip_tags
         
     | 
| 
         @@ -31,7 +27,12 @@ def excessive_wip_tags 
     | 
|
| 
       31 
27 
     | 
    
         
             
            end
         
     | 
| 
       32 
28 
     | 
    
         | 
| 
       33 
29 
     | 
    
         
             
            def scenario_count
         
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
      
 30 
     | 
    
         
            +
              Feature.all.inject(0) do |count, feature|
         
     | 
| 
      
 31 
     | 
    
         
            +
                if feature.gherkin["elements"]
         
     | 
| 
      
 32 
     | 
    
         
            +
                  count += feature.gherkin["elements"].select { |e| e["type"] == "scenario" }
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
                count
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
       35 
36 
     | 
    
         
             
            end
         
     | 
| 
       36 
37 
     | 
    
         | 
| 
       37 
38 
     | 
    
         
             
            def highlighted_search_result_blurb search_result
         
     | 
| 
         @@ -68,9 +69,9 @@ get '/?' do 
     | 
|
| 
       68 
69 
     | 
    
         
             
              haml :index
         
     | 
| 
       69 
70 
     | 
    
         
             
            end
         
     | 
| 
       70 
71 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
            get '/features/:feature/?' do | 
     | 
| 
       72 
     | 
    
         
            -
               
     | 
| 
       73 
     | 
    
         
            -
                @feature =  
     | 
| 
      
 72 
     | 
    
         
            +
            get '/features/:feature/?' do |id|
         
     | 
| 
      
 73 
     | 
    
         
            +
              Wally::Feature.all.each do |feature|
         
     | 
| 
      
 74 
     | 
    
         
            +
                @feature = feature if feature.gherkin["id"] == id
         
     | 
| 
       74 
75 
     | 
    
         
             
              end
         
     | 
| 
       75 
76 
     | 
    
         
             
              haml :feature
         
     | 
| 
       76 
77 
     | 
    
         
             
            end
         
     | 
| 
         @@ -81,16 +82,16 @@ end 
     | 
|
| 
       81 
82 
     | 
    
         | 
| 
       82 
83 
     | 
    
         
             
            get '/search/?' do
         
     | 
| 
       83 
84 
     | 
    
         
             
              if params[:q]
         
     | 
| 
       84 
     | 
    
         
            -
                @search_results = Wally::SearchFeatures.new( 
     | 
| 
      
 85 
     | 
    
         
            +
                @search_results = Wally::SearchFeatures.new(Wally::Feature).find(:query => params[:q])
         
     | 
| 
       85 
86 
     | 
    
         
             
              end
         
     | 
| 
       86 
87 
     | 
    
         
             
              haml :search
         
     | 
| 
       87 
88 
     | 
    
         
             
            end
         
     | 
| 
       88 
89 
     | 
    
         | 
| 
       89 
90 
     | 
    
         
             
            get '/features/:feature/scenario/:scenario/?'  do  |feature_id, scenario_id|
         
     | 
| 
       90 
     | 
    
         
            -
               
     | 
| 
       91 
     | 
    
         
            -
                if feature["id"] == feature_id
         
     | 
| 
      
 91 
     | 
    
         
            +
              Wally::Feature.all.each do |feature|
         
     | 
| 
      
 92 
     | 
    
         
            +
                if feature.gherkin["id"] == feature_id
         
     | 
| 
       92 
93 
     | 
    
         
             
                  @feature = feature
         
     | 
| 
       93 
     | 
    
         
            -
                  feature["elements"].each do |element|
         
     | 
| 
      
 94 
     | 
    
         
            +
                  feature.gherkin["elements"].each do |element|
         
     | 
| 
       94 
95 
     | 
    
         
             
                    if element["type"] == "background"
         
     | 
| 
       95 
96 
     | 
    
         
             
                      @background = element
         
     | 
| 
       96 
97 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -110,8 +111,8 @@ end 
     | 
|
| 
       110 
111 
     | 
    
         
             
            def get_sorted_scenarios(feature)
         
     | 
| 
       111 
112 
     | 
    
         
             
              scenarios = []
         
     | 
| 
       112 
113 
     | 
    
         | 
| 
       113 
     | 
    
         
            -
              if feature["elements"]
         
     | 
| 
       114 
     | 
    
         
            -
                feature["elements"].each do |element|
         
     | 
| 
      
 114 
     | 
    
         
            +
              if feature.gherkin["elements"]
         
     | 
| 
      
 115 
     | 
    
         
            +
                feature.gherkin["elements"].each do |element|
         
     | 
| 
       115 
116 
     | 
    
         
             
                  if element["type"] == "scenario" || element["type"] == "scenario_outline"
         
     | 
| 
       116 
117 
     | 
    
         
             
                    scenarios << element
         
     | 
| 
       117 
118 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/wally/counts_tags.rb
    CHANGED
    
    | 
         @@ -5,14 +5,14 @@ module Wally 
     | 
|
| 
       5 
5 
     | 
    
         
             
                end
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
                def count_tags
         
     | 
| 
       8 
     | 
    
         
            -
                  @lists_features. 
     | 
| 
       9 
     | 
    
         
            -
                    if feature["tags"]
         
     | 
| 
       10 
     | 
    
         
            -
                      feature["tags"].each do |tag|
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @lists_features.all.inject(Hash.new(0)) do |tag_count, feature|
         
     | 
| 
      
 9 
     | 
    
         
            +
                    if feature.gherkin["tags"]
         
     | 
| 
      
 10 
     | 
    
         
            +
                      feature.gherkin["tags"].each do |tag|
         
     | 
| 
       11 
11 
     | 
    
         
             
                        tag_count[tag["name"].downcase] += 1
         
     | 
| 
       12 
12 
     | 
    
         
             
                      end
         
     | 
| 
       13 
13 
     | 
    
         
             
                    end
         
     | 
| 
       14 
     | 
    
         
            -
                    if feature["elements"]
         
     | 
| 
       15 
     | 
    
         
            -
                      feature["elements"].each do |element|
         
     | 
| 
      
 14 
     | 
    
         
            +
                    if feature.gherkin["elements"]
         
     | 
| 
      
 15 
     | 
    
         
            +
                      feature.gherkin["elements"].each do |element|
         
     | 
| 
       16 
16 
     | 
    
         
             
                        if element["tags"]
         
     | 
| 
       17 
17 
     | 
    
         
             
                          element["tags"].each do |tag|
         
     | 
| 
       18 
18 
     | 
    
         
             
                            tag_count[tag["name"].downcase] += 1
         
     | 
    
        data/lib/wally/feature.rb
    CHANGED
    
    
| 
         @@ -15,9 +15,16 @@ module Wally 
     | 
|
| 
       15 
15 
     | 
    
         
             
                  io = StringIO.new
         
     | 
| 
       16 
16 
     | 
    
         
             
                  formatter = Gherkin::Formatter::JSONFormatter.new(io)
         
     | 
| 
       17 
17 
     | 
    
         
             
                  parser = Gherkin::Parser::Parser.new(formatter, false, 'root')
         
     | 
| 
       18 
     | 
    
         
            -
                   
     | 
| 
      
 18 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 19 
     | 
    
         
            +
                    parser.parse(text, nil, 0)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  rescue Exception => e
         
     | 
| 
      
 21 
     | 
    
         
            +
                    raise FeatureParseException.new
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
       19 
23 
     | 
    
         
             
                  hash = formatter.to_hash
         
     | 
| 
       20 
24 
     | 
    
         
             
                  hash
         
     | 
| 
       21 
25 
     | 
    
         
             
                end
         
     | 
| 
       22 
26 
     | 
    
         
             
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              class FeatureParseException < StandardError
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
       23 
30 
     | 
    
         
             
            end
         
     | 
| 
         @@ -9,21 +9,21 @@ module Wally 
     | 
|
| 
       9 
9 
     | 
    
         
             
                def find(query)
         
     | 
| 
       10 
10 
     | 
    
         
             
                  searchables = []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                  @lists_features. 
     | 
| 
       13 
     | 
    
         
            -
                    feature_text = feature["name"]
         
     | 
| 
       14 
     | 
    
         
            -
                    if feature["tags"]
         
     | 
| 
       15 
     | 
    
         
            -
                      feature_text += " " + feature["tags"].map { |tag| tag["name"] }.join(" ")
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @lists_features.all.each do |feature|
         
     | 
| 
      
 13 
     | 
    
         
            +
                    feature_text = feature.gherkin["name"]
         
     | 
| 
      
 14 
     | 
    
         
            +
                    if feature.gherkin["tags"]
         
     | 
| 
      
 15 
     | 
    
         
            +
                      feature_text += " " + feature.gherkin["tags"].map { |tag| tag["name"] }.join(" ")
         
     | 
| 
       16 
16 
     | 
    
         
             
                    end
         
     | 
| 
       17 
     | 
    
         
            -
                    if feature["description"]
         
     | 
| 
       18 
     | 
    
         
            -
                      feature_text += " " + feature["description"]
         
     | 
| 
      
 17 
     | 
    
         
            +
                    if feature.gherkin["description"]
         
     | 
| 
      
 18 
     | 
    
         
            +
                      feature_text += " " + feature.gherkin["description"]
         
     | 
| 
       19 
19 
     | 
    
         
             
                    end
         
     | 
| 
       20 
20 
     | 
    
         
             
                    feature_data = OpenStruct.new
         
     | 
| 
       21 
     | 
    
         
            -
                    feature_data.feature = feature
         
     | 
| 
      
 21 
     | 
    
         
            +
                    feature_data.feature = feature.gherkin
         
     | 
| 
       22 
22 
     | 
    
         
             
                    feature_data.text = feature_text
         
     | 
| 
       23 
23 
     | 
    
         
             
                    searchables << feature_data
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                    if feature["elements"]
         
     | 
| 
       26 
     | 
    
         
            -
                      feature["elements"].each do |element|
         
     | 
| 
      
 25 
     | 
    
         
            +
                    if feature.gherkin["elements"]
         
     | 
| 
      
 26 
     | 
    
         
            +
                      feature.gherkin["elements"].each do |element|
         
     | 
| 
       27 
27 
     | 
    
         
             
                        element_text = [element["name"]]
         
     | 
| 
       28 
28 
     | 
    
         
             
                        if element["steps"]
         
     | 
| 
       29 
29 
     | 
    
         
             
                          element_text << element["steps"].map { |s| s["name"] }
         
     | 
| 
         @@ -32,7 +32,7 @@ module Wally 
     | 
|
| 
       32 
32 
     | 
    
         
             
                          element_text << element["tags"].map { |t| t["name"] }
         
     | 
| 
       33 
33 
     | 
    
         
             
                        end
         
     | 
| 
       34 
34 
     | 
    
         
             
                        scenario_data = OpenStruct.new
         
     | 
| 
       35 
     | 
    
         
            -
                        scenario_data.feature = feature
         
     | 
| 
      
 35 
     | 
    
         
            +
                        scenario_data.feature = feature.gherkin
         
     | 
| 
       36 
36 
     | 
    
         
             
                        scenario_data.scenario = element
         
     | 
| 
       37 
37 
     | 
    
         
             
                        scenario_data.text = element_text.join(" ")
         
     | 
| 
       38 
38 
     | 
    
         
             
                        searchables << scenario_data
         
     | 
    
        data/lib/wally/version.rb
    CHANGED
    
    
| 
         @@ -1,15 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            %h2
         
     | 
| 
       2 
     | 
    
         
            -
              = @feature["name"]
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
              %section{:class=> 
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                   
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            - if @feature["description"]
         
     | 
| 
      
 2 
     | 
    
         
            +
              = @feature.gherkin["name"]
         
     | 
| 
      
 3 
     | 
    
         
            +
            %p
         
     | 
| 
      
 4 
     | 
    
         
            +
              from
         
     | 
| 
      
 5 
     | 
    
         
            +
              %em
         
     | 
| 
      
 6 
     | 
    
         
            +
                = @feature.path
         
     | 
| 
      
 7 
     | 
    
         
            +
            %section{:class=>"scenarios"}
         
     | 
| 
      
 8 
     | 
    
         
            +
              %section{:class => 'feature'}
         
     | 
| 
      
 9 
     | 
    
         
            +
                :markdown
         
     | 
| 
      
 10 
     | 
    
         
            +
                  #{@feature.gherkin["description"]}
         
     | 
| 
      
 11 
     | 
    
         
            +
            - if @feature.gherkin["description"]
         
     | 
| 
       13 
12 
     | 
    
         
             
              %h2 Scenarios
         
     | 
| 
       14 
13 
     | 
    
         
             
              %ul
         
     | 
| 
       15 
14 
     | 
    
         
             
                - get_sorted_scenarios(@feature).each do |scenario|
         
     | 
| 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            %li
         
     | 
| 
       2 
     | 
    
         
            -
              %a{:href => "/features/#{feature["id"]}"}
         
     | 
| 
       3 
     | 
    
         
            -
                = feature["name"]
         
     | 
| 
       4 
     | 
    
         
            -
              - if feature["tags"]
         
     | 
| 
       5 
     | 
    
         
            -
                - tags = feature["tags"]
         
     | 
| 
      
 2 
     | 
    
         
            +
              %a{:href => "/features/#{feature.gherkin["id"]}"}
         
     | 
| 
      
 3 
     | 
    
         
            +
                = feature.gherkin["name"]
         
     | 
| 
      
 4 
     | 
    
         
            +
              - if feature.gherkin["tags"]
         
     | 
| 
      
 5 
     | 
    
         
            +
                - tags = feature.gherkin["tags"]
         
     | 
| 
       6 
6 
     | 
    
         
             
                = haml :tag_links, {:locals => {:tags => tags}, :layout => false}
         
     | 
    
        data/lib/wally/views/layout.haml
    CHANGED
    
    | 
         @@ -18,19 +18,13 @@ 
     | 
|
| 
       18 
18 
     | 
    
         
             
                %div.container-fluid
         
     | 
| 
       19 
19 
     | 
    
         
             
                  %div.sidebar
         
     | 
| 
       20 
20 
     | 
    
         
             
                    %ul
         
     | 
| 
       21 
     | 
    
         
            -
                      -# %li
         
     | 
| 
       22 
     | 
    
         
            -
                      -#   %a{:href => "/search?q="}
         
     | 
| 
       23 
     | 
    
         
            -
                      -#     = "Scenarios (#{scenario_count})"
         
     | 
| 
       24 
     | 
    
         
            -
                      -# %li
         
     | 
| 
       25 
     | 
    
         
            -
                      -#   %a{:href => "/"}
         
     | 
| 
       26 
     | 
    
         
            -
                      -#     = "Features (#{lists_features.features.length})"
         
     | 
| 
       27 
21 
     | 
    
         
             
                      %li
         
     | 
| 
       28 
22 
     | 
    
         
             
                        %a{:href => "/progress"}
         
     | 
| 
       29 
23 
     | 
    
         
             
                          Progress
         
     | 
| 
       30 
24 
     | 
    
         
             
                    %h2
         
     | 
| 
       31 
     | 
    
         
            -
                      = "Features (#{ 
     | 
| 
      
 25 
     | 
    
         
            +
                      = "Features (#{Wally::Feature.all.count})"
         
     | 
| 
       32 
26 
     | 
    
         
             
                    %ul
         
     | 
| 
       33 
     | 
    
         
            -
                      -  
     | 
| 
      
 27 
     | 
    
         
            +
                      - Wally::Feature.sort(:name).each do |feature|
         
     | 
| 
       34 
28 
     | 
    
         
             
                        = haml :feature_link, {:locals => {:feature => feature}, :layout => false}
         
     | 
| 
       35 
29 
     | 
    
         
             
                    - if tag_count.any?
         
     | 
| 
       36 
30 
     | 
    
         
             
                      %h2
         
     | 
| 
         @@ -17,9 +17,7 @@ module Wally 
     | 
|
| 
       17 
17 
     | 
    
         
             
                it "counts feature tags" do
         
     | 
| 
       18 
18 
     | 
    
         
             
                  create_feature("feature-1.feature", "@tag1 @tag2\nFeature: Feature 1")
         
     | 
| 
       19 
19 
     | 
    
         
             
                  create_feature("feature-2.feature", "@tag2 @tag2\nFeature: Feature 2")
         
     | 
| 
       20 
     | 
    
         
            -
                   
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                  CountsTags.new(lists_features).count_tags.should == {
         
     | 
| 
      
 20 
     | 
    
         
            +
                  CountsTags.new(Feature).count_tags.should == {
         
     | 
| 
       23 
21 
     | 
    
         
             
                    "@tag1" => 1,
         
     | 
| 
       24 
22 
     | 
    
         
             
                    "@tag2" => 3
         
     | 
| 
       25 
23 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -28,8 +26,7 @@ module Wally 
     | 
|
| 
       28 
26 
     | 
    
         
             
                it "counts scenario tags" do
         
     | 
| 
       29 
27 
     | 
    
         
             
                  create_feature("feature-1.feature", "Feature: Feature 1\n@tag1@tag1\nScenario: Scenario 1")
         
     | 
| 
       30 
28 
     | 
    
         
             
                  create_feature("feature-2.feature", "Feature: Feature 2\n@tag3@tag1\nScenario: Scenario 1")
         
     | 
| 
       31 
     | 
    
         
            -
                   
     | 
| 
       32 
     | 
    
         
            -
                  CountsTags.new(lists_features).count_tags.should == {
         
     | 
| 
      
 29 
     | 
    
         
            +
                  CountsTags.new(Feature).count_tags.should == {
         
     | 
| 
       33 
30 
     | 
    
         
             
                    "@tag1" => 3,
         
     | 
| 
       34 
31 
     | 
    
         
             
                    "@tag3" => 1
         
     | 
| 
       35 
32 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -39,9 +36,7 @@ module Wally 
     | 
|
| 
       39 
36 
     | 
    
         
             
                  create_feature("feature-1.feature", "@tag1\nFeature: Feature 1")
         
     | 
| 
       40 
37 
     | 
    
         
             
                  create_feature("feature-2.feature", "@TAG1\nFeature: Feature 2")
         
     | 
| 
       41 
38 
     | 
    
         
             
                  create_feature("feature-3.feature", "Feature: Feature 2\n@TAG1\nScenario: Scenario 1")
         
     | 
| 
       42 
     | 
    
         
            -
                   
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                  CountsTags.new(lists_features).count_tags.should == {
         
     | 
| 
      
 39 
     | 
    
         
            +
                  CountsTags.new(Feature).count_tags.should == {
         
     | 
| 
       45 
40 
     | 
    
         
             
                    "@tag1" => 3
         
     | 
| 
       46 
41 
     | 
    
         
             
                  }
         
     | 
| 
       47 
42 
     | 
    
         
             
                end
         
     | 
    
        data/spec/wally/feature_spec.rb
    CHANGED
    
    
| 
         @@ -13,5 +13,16 @@ module Wally 
     | 
|
| 
       13 
13 
     | 
    
         
             
                    "uri"         => nil
         
     | 
| 
       14 
14 
     | 
    
         
             
                  }
         
     | 
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                it "raises nice errors" do
         
     | 
| 
      
 18 
     | 
    
         
            +
                  feature = "!WEFFW"
         
     | 
| 
      
 19 
     | 
    
         
            +
                  error = nil
         
     | 
| 
      
 20 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 21 
     | 
    
         
            +
                    ParsesFeatures.new.parse(feature)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  rescue Exception => e
         
     | 
| 
      
 23 
     | 
    
         
            +
                    error = e
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                  error.should_not be_nil
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
       16 
27 
     | 
    
         
             
              end
         
     | 
| 
       17 
28 
     | 
    
         
             
            end
         
     | 
| 
         @@ -13,36 +13,32 @@ module Wally 
     | 
|
| 
       13 
13 
     | 
    
         
             
                  feature.save
         
     | 
| 
       14 
14 
     | 
    
         
             
                end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                let :lists_features do
         
     | 
| 
       17 
     | 
    
         
            -
                  ListsFeatures.new
         
     | 
| 
       18 
     | 
    
         
            -
                end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
16 
     | 
    
         
             
                it "finds features containing text" do
         
     | 
| 
       21 
17 
     | 
    
         
             
                  create_feature("sample1.feature", "Feature: Bla")
         
     | 
| 
       22 
18 
     | 
    
         
             
                  create_feature("sample2.feature", "Feature: Meh")
         
     | 
| 
       23 
19 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                  results = SearchFeatures.new( 
     | 
| 
      
 20 
     | 
    
         
            +
                  results = SearchFeatures.new(Feature).find(:query => "Meh")
         
     | 
| 
       25 
21 
     | 
    
         
             
                  results.items.size.should == 1
         
     | 
| 
       26 
22 
     | 
    
         
             
                  results.items.first.object.feature["name"].should == "Meh"
         
     | 
| 
       27 
23 
     | 
    
         
             
                end
         
     | 
| 
       28 
24 
     | 
    
         | 
| 
       29 
25 
     | 
    
         
             
                it "finds features by narrative" do
         
     | 
| 
       30 
26 
     | 
    
         
             
                  create_feature("sample1.feature", "Feature: bla\nIn order to bananas")
         
     | 
| 
       31 
     | 
    
         
            -
                  results = SearchFeatures.new( 
     | 
| 
      
 27 
     | 
    
         
            +
                  results = SearchFeatures.new(Feature).find(:query => "bananas")
         
     | 
| 
       32 
28 
     | 
    
         
             
                  results.items.size.should == 1
         
     | 
| 
       33 
29 
     | 
    
         
             
                  results.items.first.object.feature["name"].should == "bla"
         
     | 
| 
       34 
30 
     | 
    
         
             
                end
         
     | 
| 
       35 
31 
     | 
    
         | 
| 
       36 
32 
     | 
    
         
             
                it "has a suggestion" do
         
     | 
| 
       37 
33 
     | 
    
         
             
                  create_feature("sample1.feature", "Feature: Monkeys")
         
     | 
| 
       38 
     | 
    
         
            -
                  results = SearchFeatures.new( 
     | 
| 
      
 34 
     | 
    
         
            +
                  results = SearchFeatures.new(Feature).find(:query => "mnkeys")
         
     | 
| 
       39 
35 
     | 
    
         
             
                  results.suggestion.should == "Monkeys"
         
     | 
| 
       40 
36 
     | 
    
         
             
                end
         
     | 
| 
       41 
37 
     | 
    
         | 
| 
       42 
38 
     | 
    
         
             
                it "has a suggestion only when it's different from the search query" do
         
     | 
| 
       43 
39 
     | 
    
         
             
                  create_feature("sample1.feature", "Feature: monkeys\nScenario: feature")
         
     | 
| 
       44 
40 
     | 
    
         
             
                  create_feature("sample2.feature", "Feature: dogs\nScenario: Sample scenario")
         
     | 
| 
       45 
     | 
    
         
            -
                  results = SearchFeatures.new( 
     | 
| 
      
 41 
     | 
    
         
            +
                  results = SearchFeatures.new(Feature).find(:query => "feature")
         
     | 
| 
       46 
42 
     | 
    
         
             
                  results.suggestion.should be_nil
         
     | 
| 
       47 
43 
     | 
    
         
             
                end
         
     | 
| 
       48 
44 
     | 
    
         | 
| 
         @@ -59,13 +55,13 @@ module Wally 
     | 
|
| 
       59 
55 
     | 
    
         
             
                  end
         
     | 
| 
       60 
56 
     | 
    
         | 
| 
       61 
57 
     | 
    
         
             
                  it "finds scenarios containing text" do
         
     | 
| 
       62 
     | 
    
         
            -
                    results = SearchFeatures.new( 
     | 
| 
      
 58 
     | 
    
         
            +
                    results = SearchFeatures.new(Feature).find(:query => "MATCHED")
         
     | 
| 
       63 
59 
     | 
    
         
             
                    results.items.size.should == 1
         
     | 
| 
       64 
60 
     | 
    
         
             
                    results.items.first.object.scenario["name"].should == "Matched Scenario"
         
     | 
| 
       65 
61 
     | 
    
         
             
                  end
         
     | 
| 
       66 
62 
     | 
    
         | 
| 
       67 
63 
     | 
    
         
             
                  it "finds scenario steps" do
         
     | 
| 
       68 
     | 
    
         
            -
                    results = SearchFeatures.new( 
     | 
| 
      
 64 
     | 
    
         
            +
                    results = SearchFeatures.new(Feature).find(:query => "DOUGHNUTS")
         
     | 
| 
       69 
65 
     | 
    
         
             
                    results.items.size.should == 1
         
     | 
| 
       70 
66 
     | 
    
         
             
                    results.items.first.object.scenario["name"].should == "Matched Scenario"
         
     | 
| 
       71 
67 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -74,13 +70,13 @@ module Wally 
     | 
|
| 
       74 
70 
     | 
    
         
             
                context "feature with tags" do
         
     | 
| 
       75 
71 
     | 
    
         
             
                  it "finds features by tag" do
         
     | 
| 
       76 
72 
     | 
    
         
             
                    create_feature("example-feature.feature", "@tag_name\nFeature: Example Feature")
         
     | 
| 
       77 
     | 
    
         
            -
                    results = SearchFeatures.new( 
     | 
| 
      
 73 
     | 
    
         
            +
                    results = SearchFeatures.new(Feature).find(:query => "@tag_NAME")
         
     | 
| 
       78 
74 
     | 
    
         
             
                    results.items.first.object.feature["name"].should == "Example Feature"
         
     | 
| 
       79 
75 
     | 
    
         
             
                  end
         
     | 
| 
       80 
76 
     | 
    
         | 
| 
       81 
77 
     | 
    
         
             
                  it "finds scenarios by tag" do
         
     | 
| 
       82 
78 
     | 
    
         
             
                    create_feature("example-feature.feature", "Feature: Example Feature\n@scenario_tag\nScenario: Example Scenario")
         
     | 
| 
       83 
     | 
    
         
            -
                    results = SearchFeatures.new( 
     | 
| 
      
 79 
     | 
    
         
            +
                    results = SearchFeatures.new(Feature).find(:query => "@scenario_TAG")
         
     | 
| 
       84 
80 
     | 
    
         
             
                    results.items.first.object.scenario["name"].should == "Example Scenario"
         
     | 
| 
       85 
81 
     | 
    
         
             
                  end
         
     | 
| 
       86 
82 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: wally
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.30
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -13,7 +13,7 @@ date: 2011-12-05 00:00:00.000000000Z 
     | 
|
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rest-client
         
     | 
| 
       16 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: &70272590012520 !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: *70272590012520
         
     | 
| 
       25 
25 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       26 
26 
     | 
    
         
             
              name: sinatra
         
     | 
| 
       27 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 27 
     | 
    
         
            +
              requirement: &70272590011980 !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: *70272590011980
         
     | 
| 
       36 
36 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       37 
37 
     | 
    
         
             
              name: haml
         
     | 
| 
       38 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 38 
     | 
    
         
            +
              requirement: &70272590011500 !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: *70272590011500
         
     | 
| 
       47 
47 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       48 
48 
     | 
    
         
             
              name: rdiscount
         
     | 
| 
       49 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 49 
     | 
    
         
            +
              requirement: &70272590010780 !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: :runtime
         
     | 
| 
       56 
56 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       57 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 57 
     | 
    
         
            +
              version_requirements: *70272590010780
         
     | 
| 
       58 
58 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       59 
59 
     | 
    
         
             
              name: gherkin
         
     | 
| 
       60 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 60 
     | 
    
         
            +
              requirement: &70272590010040 !ruby/object:Gem::Requirement
         
     | 
| 
       61 
61 
     | 
    
         
             
                none: false
         
     | 
| 
       62 
62 
     | 
    
         
             
                requirements:
         
     | 
| 
       63 
63 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -65,10 +65,10 @@ dependencies: 
     | 
|
| 
       65 
65 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       66 
66 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       67 
67 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       68 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 68 
     | 
    
         
            +
              version_requirements: *70272590010040
         
     | 
| 
       69 
69 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
70 
     | 
    
         
             
              name: komainu
         
     | 
| 
       71 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: &70272590009360 !ruby/object:Gem::Requirement
         
     | 
| 
       72 
72 
     | 
    
         
             
                none: false
         
     | 
| 
       73 
73 
     | 
    
         
             
                requirements:
         
     | 
| 
       74 
74 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -76,10 +76,10 @@ dependencies: 
     | 
|
| 
       76 
76 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       77 
77 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       78 
78 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       79 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 79 
     | 
    
         
            +
              version_requirements: *70272590009360
         
     | 
| 
       80 
80 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       81 
81 
     | 
    
         
             
              name: cucumber
         
     | 
| 
       82 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 82 
     | 
    
         
            +
              requirement: &70272590008620 !ruby/object:Gem::Requirement
         
     | 
| 
       83 
83 
     | 
    
         
             
                none: false
         
     | 
| 
       84 
84 
     | 
    
         
             
                requirements:
         
     | 
| 
       85 
85 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -87,10 +87,10 @@ dependencies: 
     | 
|
| 
       87 
87 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       88 
88 
     | 
    
         
             
              type: :development
         
     | 
| 
       89 
89 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       90 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 90 
     | 
    
         
            +
              version_requirements: *70272590008620
         
     | 
| 
       91 
91 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       92 
92 
     | 
    
         
             
              name: capybara
         
     | 
| 
       93 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 93 
     | 
    
         
            +
              requirement: &70272590007760 !ruby/object:Gem::Requirement
         
     | 
| 
       94 
94 
     | 
    
         
             
                none: false
         
     | 
| 
       95 
95 
     | 
    
         
             
                requirements:
         
     | 
| 
       96 
96 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -98,10 +98,10 @@ dependencies: 
     | 
|
| 
       98 
98 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       99 
99 
     | 
    
         
             
              type: :development
         
     | 
| 
       100 
100 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       101 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 101 
     | 
    
         
            +
              version_requirements: *70272590007760
         
     | 
| 
       102 
102 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       103 
103 
     | 
    
         
             
              name: rspec
         
     | 
| 
       104 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 104 
     | 
    
         
            +
              requirement: &70272590006900 !ruby/object:Gem::Requirement
         
     | 
| 
       105 
105 
     | 
    
         
             
                none: false
         
     | 
| 
       106 
106 
     | 
    
         
             
                requirements:
         
     | 
| 
       107 
107 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -109,10 +109,10 @@ dependencies: 
     | 
|
| 
       109 
109 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       110 
110 
     | 
    
         
             
              type: :development
         
     | 
| 
       111 
111 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       112 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 112 
     | 
    
         
            +
              version_requirements: *70272590006900
         
     | 
| 
       113 
113 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       114 
114 
     | 
    
         
             
              name: fakefs
         
     | 
| 
       115 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 115 
     | 
    
         
            +
              requirement: &70272590006080 !ruby/object:Gem::Requirement
         
     | 
| 
       116 
116 
     | 
    
         
             
                none: false
         
     | 
| 
       117 
117 
     | 
    
         
             
                requirements:
         
     | 
| 
       118 
118 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -120,10 +120,10 @@ dependencies: 
     | 
|
| 
       120 
120 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       121 
121 
     | 
    
         
             
              type: :development
         
     | 
| 
       122 
122 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       123 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 123 
     | 
    
         
            +
              version_requirements: *70272590006080
         
     | 
| 
       124 
124 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       125 
125 
     | 
    
         
             
              name: launchy
         
     | 
| 
       126 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 126 
     | 
    
         
            +
              requirement: &70272590005180 !ruby/object:Gem::Requirement
         
     | 
| 
       127 
127 
     | 
    
         
             
                none: false
         
     | 
| 
       128 
128 
     | 
    
         
             
                requirements:
         
     | 
| 
       129 
129 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -131,7 +131,7 @@ dependencies: 
     | 
|
| 
       131 
131 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       132 
132 
     | 
    
         
             
              type: :development
         
     | 
| 
       133 
133 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       134 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 134 
     | 
    
         
            +
              version_requirements: *70272590005180
         
     | 
| 
       135 
135 
     | 
    
         
             
            description: ''
         
     | 
| 
       136 
136 
     | 
    
         
             
            email:
         
     | 
| 
       137 
137 
     | 
    
         
             
            - andrew.vos@gmail.com
         
     | 
| 
         @@ -171,7 +171,6 @@ files: 
     | 
|
| 
       171 
171 
     | 
    
         
             
            - lib/wally/application.rb
         
     | 
| 
       172 
172 
     | 
    
         
             
            - lib/wally/counts_tags.rb
         
     | 
| 
       173 
173 
     | 
    
         
             
            - lib/wally/feature.rb
         
     | 
| 
       174 
     | 
    
         
            -
            - lib/wally/lists_features.rb
         
     | 
| 
       175 
174 
     | 
    
         
             
            - lib/wally/parses_features.rb
         
     | 
| 
       176 
175 
     | 
    
         
             
            - lib/wally/public/bootstrap.min.css
         
     | 
| 
       177 
176 
     | 
    
         
             
            - lib/wally/public/skin.css
         
     | 
| 
         @@ -189,7 +188,6 @@ files: 
     | 
|
| 
       189 
188 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       190 
189 
     | 
    
         
             
            - spec/wally/counts_tags_spec.rb
         
     | 
| 
       191 
190 
     | 
    
         
             
            - spec/wally/feature_spec.rb
         
     | 
| 
       192 
     | 
    
         
            -
            - spec/wally/lists_features_spec.rb
         
     | 
| 
       193 
191 
     | 
    
         
             
            - spec/wally/parses_features_spec.rb
         
     | 
| 
       194 
192 
     | 
    
         
             
            - spec/wally/search_features_spec.rb
         
     | 
| 
       195 
193 
     | 
    
         
             
            - wally.gemspec
         
     | 
| 
         @@ -235,6 +233,5 @@ test_files: 
     | 
|
| 
       235 
233 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       236 
234 
     | 
    
         
             
            - spec/wally/counts_tags_spec.rb
         
     | 
| 
       237 
235 
     | 
    
         
             
            - spec/wally/feature_spec.rb
         
     | 
| 
       238 
     | 
    
         
            -
            - spec/wally/lists_features_spec.rb
         
     | 
| 
       239 
236 
     | 
    
         
             
            - spec/wally/parses_features_spec.rb
         
     | 
| 
       240 
237 
     | 
    
         
             
            - spec/wally/search_features_spec.rb
         
     | 
    
        data/lib/wally/lists_features.rb
    DELETED
    
    | 
         @@ -1,24 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'gherkin/formatter/json_formatter'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'gherkin/parser/parser'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module Gherkin::Formatter
         
     | 
| 
       5 
     | 
    
         
            -
              class JSONFormatter
         
     | 
| 
       6 
     | 
    
         
            -
                def to_hash
         
     | 
| 
       7 
     | 
    
         
            -
                  @feature_hash
         
     | 
| 
       8 
     | 
    
         
            -
                end
         
     | 
| 
       9 
     | 
    
         
            -
              end
         
     | 
| 
       10 
     | 
    
         
            -
            end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            module Wally
         
     | 
| 
       13 
     | 
    
         
            -
              class ListsFeatures
         
     | 
| 
       14 
     | 
    
         
            -
                def features
         
     | 
| 
       15 
     | 
    
         
            -
                  features = []
         
     | 
| 
       16 
     | 
    
         
            -
                  Feature.all.each do |feature|
         
     | 
| 
       17 
     | 
    
         
            -
                    gherkin = feature.gherkin
         
     | 
| 
       18 
     | 
    
         
            -
                    gherkin["path"] = feature.path
         
     | 
| 
       19 
     | 
    
         
            -
                    features << gherkin
         
     | 
| 
       20 
     | 
    
         
            -
                  end
         
     | 
| 
       21 
     | 
    
         
            -
                  features.sort {|a,b| a["name"] <=> b["name"]}
         
     | 
| 
       22 
     | 
    
         
            -
                end
         
     | 
| 
       23 
     | 
    
         
            -
              end
         
     | 
| 
       24 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,28 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require File.join(File.dirname(__FILE__), "..", "spec_helper")
         
     | 
| 
       2 
     | 
    
         
            -
            require 'fileutils'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module Wally
         
     | 
| 
       5 
     | 
    
         
            -
              describe ListsFeatures do
         
     | 
| 
       6 
     | 
    
         
            -
                after do
         
     | 
| 
       7 
     | 
    
         
            -
                  Feature.delete_all
         
     | 
| 
       8 
     | 
    
         
            -
                end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                def create_feature path, content
         
     | 
| 
       11 
     | 
    
         
            -
                  feature = Feature.new
         
     | 
| 
       12 
     | 
    
         
            -
                  feature.path = path
         
     | 
| 
       13 
     | 
    
         
            -
                  feature.gherkin = ParsesFeatures.new.parse(content)
         
     | 
| 
       14 
     | 
    
         
            -
                  feature.save
         
     | 
| 
       15 
     | 
    
         
            -
                end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                it "returns a list of alphabeticaly ordered features" do
         
     | 
| 
       18 
     | 
    
         
            -
                  create_feature("1-sample.feature", "Feature: Zorro")
         
     | 
| 
       19 
     | 
    
         
            -
                  create_feature("2-sample.feature", "Feature: Malgor")
         
     | 
| 
       20 
     | 
    
         
            -
                  create_feature("3-sample.feature", "Feature: Adrian")
         
     | 
| 
       21 
     | 
    
         
            -
                  lists_features = ListsFeatures.new
         
     | 
| 
       22 
     | 
    
         
            -
                  lists_features.features.size.should == 3
         
     | 
| 
       23 
     | 
    
         
            -
                  lists_features.features[0]["name"].should == "Adrian"
         
     | 
| 
       24 
     | 
    
         
            -
                  lists_features.features[1]["name"].should == "Malgor"
         
     | 
| 
       25 
     | 
    
         
            -
                  lists_features.features[2]["name"].should == "Zorro"
         
     | 
| 
       26 
     | 
    
         
            -
                end
         
     | 
| 
       27 
     | 
    
         
            -
              end
         
     | 
| 
       28 
     | 
    
         
            -
            end
         
     |