Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'features/support/matchers.rb')
-rw-r--r--features/support/matchers.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/features/support/matchers.rb b/features/support/matchers.rb
index d87247046..931336234 100644
--- a/features/support/matchers.rb
+++ b/features/support/matchers.rb
@@ -39,6 +39,19 @@ RSpec::Matchers.define :have_value do |expected|
end
end
+RSpec::Matchers.define :have_js_defined do |expected|
+ match do |actual|
+ await_condition { actual.evaluate_script("#{expected} !== undefined") == true }
+ end
+
+ failure_message_for_should do |actual|
+ "expected #{actual.inspect} to have a value for #{expected.inspect} in Javascript but it did not"
+ end
+ failure_message_for_should_not do |actual|
+ "expected #{actual.inspect} to not have a value for #{expected.inspect} in Javascript but it had"
+ end
+end
+
def await_condition &condition
start_time = Time.zone.now
until condition.call