Sha256: 8d03c6916b713f68b52ef05b738b07e6aec80b49c3cd5069e6a3e6f701874bda

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe Hercules::UptimeMonitor::BrowsersLangParser do
  before(:all) do
    @parser = Hercules::UptimeMonitor::BrowsersLangParser.new
  end
  it "parses valid browser names in the format - [\S]+" do
    @parser.parse("firefox").should == {browser: "firefox", headless: false}
    @parser.parse("   firefox ").should == {browser: "firefox", headless: false}
    @parser.parse("_,0any_non_whitespace").should == {browser: "_,0any_non_whitespace", headless: false}
  end
  it "raises an exception for invalid browser name" do
    expect { @parser.parse("\n") }.to raise_error
    expect { @parser.parse(" ") }.to raise_error(Hercules::UptimeMonitor::ParserSyntaxError)
  end
  it "parses valid specification for headless browser operation" do
    @parser.parse("firefox headless").should == {browser: "firefox", headless: true}
    @parser.parse(" firefox headless ").should == {browser: "firefox", headless: true}
    @parser.parse("   firefox    headless          ").should == {browser: "firefox", headless: true}

    browser = <<-eos
      chrome headless
    eos
    @parser.parse(browser).should == {browser: "chrome", headless: true}

    browser = <<-eos
      chrome

      headless
    eos
    @parser.parse(browser).should == {browser: "chrome", headless: true}
  end
  it "raises an exception for invalid headless assignment" do
    expect { @parser.parse("anybrowser invalid") }.to raise_error(Hercules::UptimeMonitor::ParserSyntaxError)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
uptime_monitor-0.6.3 spec/browsers_lang_parser_spec.rb
uptime_monitor-0.6.0 spec/browsers_lang_parser_spec.rb
uptime_monitor-0.5.0 spec/browsers_lang_parser_spec.rb
uptime_monitor-0.4.0 spec/browsers_lang_parser_spec.rb
uptime_monitor-0.3.3 spec/browsers_lang_parser_spec.rb
uptime_monitor-0.3.2 spec/browsers_lang_parser_spec.rb
uptime_monitor-0.3.1 spec/browsers_lang_parser_spec.rb