Top Level Namespace
Defined Under Namespace
Modules: Wally
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
- #current_project ⇒ Object
- #excessive_wip_tags ⇒ Object
- #get_scenario_url(scenario) ⇒ Object
- #get_sorted_scenarios(feature) ⇒ Object
- #highlighted_search_result_blurb(search_result) ⇒ Object
- #scenario_count ⇒ Object
- #tag_count ⇒ Object
Instance Method Details
#authenticated? ⇒ Boolean
68 69 70 |
# File 'lib/wally/application.rb', line 68 def authenticated? File.exist?(".wally") && params[:authentication_code] == File.read(".wally").strip end |
#current_project ⇒ Object
26 27 28 |
# File 'lib/wally/application.rb', line 26 def current_project @current_project ||= Wally::Project.first(:name => params[:project]) end |
#excessive_wip_tags ⇒ Object
35 36 37 |
# File 'lib/wally/application.rb', line 35 def tag_count["@wip"] >= 10 if tag_count["@wip"] end |
#get_scenario_url(scenario) ⇒ Object
72 73 74 |
# File 'lib/wally/application.rb', line 72 def get_scenario_url(scenario) url = "/projects/#{current_project.name}/features/#{scenario["id"].gsub(";", "/scenario/")}" end |
#get_sorted_scenarios(feature) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/wally/application.rb', line 76 def get_sorted_scenarios(feature) scenarios = [] if feature.gherkin["elements"] feature.gherkin["elements"].each do |element| if element["type"] == "scenario" || element["type"] == "scenario_outline" scenarios << element end end end scenarios.sort! { |a, b| a["name"] <=> b["name"] } scenarios end |
#highlighted_search_result_blurb(search_result) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/wally/application.rb', line 51 def highlighted_search_result_blurb search_result offset = 0 highlighted = search_result.object.text.dup span_start = "!!SPAN_START!!" span_end = "!!SPAN_END!!" search_result.matches.each do |match| highlighted.insert(match.index + offset, span_start) offset += span_start.length highlighted.insert(match.index + match.text.length + offset, span_end) offset += span_end.length end highlighted = CGI::escapeHTML(highlighted) highlighted.gsub!(span_start, "<span class=\"search-result\">") highlighted.gsub!(span_end, "</span>") highlighted end |
#scenario_count ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/wally/application.rb', line 39 def scenario_count current_project.features.inject(0) do |count, feature| if feature.gherkin["elements"] count += feature.gherkin["elements"].select { |e| e["type"] == "scenario" }.size end if feature.gherkin["elements"] count += feature.gherkin["elements"].select { |e| e["type"] == "scenario_outline" }.size end count end end |
#tag_count ⇒ Object
30 31 32 33 |
# File 'lib/wally/application.rb', line 30 def tag_count return {} if current_project.nil? @tag_count ||= Wally::CountsTags.new(current_project). end |