riot-gear 0.0.10 → 0.0.11

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.
@@ -0,0 +1,24 @@
1
+ class Riot::Gear::AnythingRunnable < Riot::RunnableBlock
2
+ def initialize(description, &definition)
3
+ super("[anything] #{description}", &definition)
4
+ end
5
+
6
+ # @param [Riot::Situation] situation An instance of a {Riot::Situation}
7
+ # @return [Array<Symbol>]
8
+ def run(situation)
9
+ situation.evaluate(&definition)
10
+ [:anything]
11
+ end
12
+ end
13
+
14
+ module Riot::Gear::AnythingContextHelper
15
+ # @param [String] description A description of what the block is for
16
+ # @param [lambda] &definition The block that will be executed ...
17
+ # @return [Riot::Gear::AnythingRunnable]
18
+ def anything(description="", &definition)
19
+ @assertions << Riot::Gear::AnythingRunnable.new(description, &definition)
20
+ end
21
+ end
22
+
23
+ Riot::Context.instance_eval { include Riot::Gear::AnythingContextHelper }
24
+
@@ -0,0 +1,20 @@
1
+ module Riot
2
+ module Gear
3
+ module AssertsCookie
4
+
5
+ # Generates an assertion that retrieves the value of some cookie from the last response.
6
+ #
7
+ # asserts_cookie("ui_session").matches(/stuff/)
8
+ #
9
+ # @param [String] cookie-name the name of the cookie
10
+ # @return [Riot::Assertion] an assertion block that macros can be applied to
11
+ def asserts_cookie(cookie_name)
12
+ asserts("set-cookie #{cookie_name}") { cookie_values[cookie_name] }
13
+ end
14
+
15
+ end # AssertsHeader
16
+ end # Gear
17
+ end # Riot
18
+
19
+ Riot::Context.instance_eval { include Riot::Gear::AssertsCookie }
20
+
@@ -1,5 +1,3 @@
1
- require 'open-uri'
2
-
3
1
  module Riot
4
2
  module Gear
5
3
  module AssertsHeader
@@ -1,5 +1,7 @@
1
1
  require 'riot/gear/context/once'
2
+ require 'riot/gear/context/anything'
2
3
  require 'riot/gear/context/persist_cookie'
3
4
  require 'riot/gear/context/asserts_status'
4
5
  require 'riot/gear/context/asserts_header'
6
+ require 'riot/gear/context/asserts_cookie'
5
7
  require 'riot/gear/context/asserts_json'
@@ -81,8 +81,10 @@ private
81
81
  def proxy_action_methods(context)
82
82
  context_eigen = (class << context; self; end)
83
83
  actionable_methods.each do |method_name|
84
+
84
85
  context_eigen.__send__(:define_method, method_name) do |*args, &settings_block|
85
- hookup do
86
+ #hookup do
87
+ anything do
86
88
  if settings_block
87
89
  name = args.first
88
90
  options = instance_eval(&settings_block)
@@ -91,13 +93,12 @@ private
91
93
  name = nil
92
94
  path, options = *args
93
95
  end
94
- #debug_start = Time.now
95
96
  result = topic.__send__(method_name, path, options || {})
96
- #puts "TIME #{(Time.now - debug_start) * 1000.0}ms #{topic.base_uri}#{path}"
97
97
  @saved_responses[name] = result
98
98
  @smoke_response = result # TODO remove this after it's certain no usages in the wild
99
99
  end
100
100
  end
101
+
101
102
  end # methods.each
102
103
  end
103
104
 
@@ -1,6 +1,6 @@
1
1
  module Riot
2
2
  module Gear
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riot-gear
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-30 00:00:00.000000000 Z
12
+ date: 2013-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: riot
@@ -60,6 +60,8 @@ files:
60
60
  - Rakefile
61
61
  - lib/riot/gear.rb
62
62
  - lib/riot/gear/context.rb
63
+ - lib/riot/gear/context/anything.rb
64
+ - lib/riot/gear/context/asserts_cookie.rb
63
65
  - lib/riot/gear/context/asserts_header.rb
64
66
  - lib/riot/gear/context/asserts_json.rb
65
67
  - lib/riot/gear/context/asserts_status.rb