Skip to content

Commit 9f16776

Browse files
committed
Add url generation
1 parent def7d87 commit 9f16776

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/browser_stack_button/helpers.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require_relative "url"
2+
13
module BrowserStackButton
24
module Helpers
35
def browser_stack_button
@@ -6,7 +8,8 @@ def browser_stack_button
68

79
def each_browser_stack_browser_and_url
810
BrowserStackButton.configuration.browsers.each do |name, options|
9-
yield name, "world"
11+
options = BrowserStackButton.configuration.default_options.merge options
12+
yield name, BrowserStackButton::Url.new("http://google.com", options).to_s
1013
end
1114
end
1215
end

lib/browser_stack_button/url.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
require "cgi"
2+
3+
module BrowserStackButton
4+
class Url
5+
def initialize(url, options={})
6+
params = options.map {|k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"}.join("&")
7+
8+
@url = "http://www.browserstack.com/start##{params}"
9+
end
10+
11+
def to_s
12+
@url
13+
end
14+
end
15+
end

0 commit comments

Comments
 (0)