masque 0.2.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 908348e60ad9b4d4aba7b807fe67ae580269590f
4
- data.tar.gz: f92f31b253ba7e9ff2c0120aee96f120b88c16e4
3
+ metadata.gz: 5ce74176f64dc03dce4b0789c2dad179fd2b4674
4
+ data.tar.gz: 6f591a6e12e9895f433f59f3d2e823af94d21a51
5
5
  SHA512:
6
- metadata.gz: 62e25f8445f8ab6a9a217f8594df135a5e48b72c954da4f3896cac05e3091712849acab5b60fb9e5421c19ef48e07476a1def2bfa66020431021bfcc595f13ff
7
- data.tar.gz: 8e098ad8cd8cd7e8d318331593336013e357b568e7acc7fa74740e0b67d9458349a258aa4302f6e64be21615487337380a5a503258f703618530d0243850c925
6
+ metadata.gz: 6fa6ac963be6a889b0fd3dd852b7fc42fc78698518227294b1fb5b1f99d18fac0678e2f66811b558afa98dd10d9067a4222ff5ca4e961ebf12fcda1091f34788
7
+ data.tar.gz: f5db900a1fef41084923f4cd7d10cab59f49ad21a20d921ec01597e682410d7b33c303bc6227191d59dfdb202d0fd85297dafd3d3889658e7da21eaf98208d57
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ before_install:
6
+ - "export DISPLAY=:99.0"
7
+ - "sh -e /etc/init.d/xvfb start"
8
+ script: "bundle exec rspec"
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in masque.gemspec
4
4
  gemspec
5
+
6
+ gem 'coveralls', require: false
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Build Status](https://travis-ci.org/uu59/masque.png?branch=master)](https://travis-ci.org/uu59/masque)
2
+ [![Coverage Status](https://coveralls.io/repos/uu59/masque/badge.png?branch=master)](https://coveralls.io/r/uu59/masque)
3
+
1
4
  # Masque
2
5
 
3
6
  <a href="http://ja.wikipedia.org/wiki/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB:Noh_mask02.jpg"><img src="http://upload.wikimedia.org/wikipedia/commons/b/bd/Noh_mask02.jpg" alt="女面" /></a>
data/lib/masque/dsl.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # -- coding: utf-8
2
2
 
3
+ require "timeout"
4
+
3
5
  class Masque
4
6
  module DSL
5
7
  def save_screenshot(path)
@@ -54,5 +56,17 @@ class Masque
54
56
  end
55
57
  alias :resize_window :resize
56
58
 
59
+ def wait_until(timeout = nil, &block)
60
+ timeout ||= 5
61
+ start = Time.now
62
+ ret = nil
63
+ loop do
64
+ break if ret = yield
65
+ sleep 0.01
66
+ raise TimeoutError if (Time.now - start) > timeout
67
+ end
68
+ ret
69
+ end
70
+
57
71
  end
58
72
  end
@@ -1,3 +1,3 @@
1
1
  class Masque
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -11,6 +11,9 @@ if ENV["COVERAGE"]
11
11
  SimpleCov.start
12
12
  end
13
13
 
14
+ require 'coveralls'
15
+ Coveralls.wear!
16
+
14
17
  require File.expand_path("../../lib/masque.rb", __FILE__)
15
18
 
16
19
 
@@ -68,6 +68,25 @@ shared_examples_for "driver" do
68
68
  end
69
69
  body.should_not be_nil
70
70
  end
71
+
72
+ describe "#wait_until" do
73
+ it "return block value" do
74
+ masque.run do
75
+ wait_until do
76
+ "hi"
77
+ end.should == "hi"
78
+ end
79
+ end
80
+
81
+ it "raise TimeoutError when timeout" do
82
+ expect do
83
+ masque.run do
84
+ wait_until(0.01) do
85
+ end
86
+ end
87
+ end.to raise_error(TimeoutError)
88
+ end
89
+ end
71
90
  end
72
91
 
73
92
  it "#reset_session!" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masque
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - uu59
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-24 00:00:00.000000000 Z
11
+ date: 2013-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: headless
@@ -130,6 +130,7 @@ extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
132
  - .gitignore
133
+ - .travis.yml
133
134
  - Gemfile
134
135
  - LICENSE.txt
135
136
  - README.md