cloudspace_chat_service 0.0.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.
- data/.document +5 -0
- data/.rspec +1 -0
- data/CHANGELOG +4 -0
- data/Gemfile +30 -0
- data/Gemfile.lock +160 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/app/controllers/cloudspace_chat/handle_messages.rb +77 -0
- data/app/models/cloudspace_chat.rb +5 -0
- data/app/models/cloudspace_chat/current_room_user.rb +31 -0
- data/app/models/cloudspace_chat/message.rb +18 -0
- data/app/models/cloudspace_chat/role.rb +4 -0
- data/app/models/cloudspace_chat/room.rb +5 -0
- data/app/models/cloudspace_chat/room_user_role.rb +6 -0
- data/config/routes.rb +4 -0
- data/lib/cloudspace_chat_service.rb +2 -0
- data/lib/cloudspace_chat_service/config.rb +31 -0
- data/lib/cloudspace_chat_service/engine.rb +4 -0
- data/lib/cloudspace_chat_service/railtie.rb +8 -0
- data/lib/generators/cloudspace_chat_service/install_generator.rb +45 -0
- data/lib/generators/cloudspace_chat_service/templates/config.rb +3 -0
- data/lib/generators/cloudspace_chat_service/templates/migrations/install_migration.rb.erb +51 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +45 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +26 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +35 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cloudspace_chat_service.rb +3 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/db/migrate/20111101133120_create_cloudspace_chat_service_tables.rb +51 -0
- data/spec/dummy/db/schema.rb +55 -0
- data/spec/dummy/features/step_definitions/web_steps.rb +214 -0
- data/spec/dummy/features/support/env.rb +14 -0
- data/spec/dummy/features/support/paths.rb +22 -0
- data/spec/dummy/features/support/selectors.rb +39 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/application.js +2 -0
- data/spec/dummy/public/javascripts/controls.js +965 -0
- data/spec/dummy/public/javascripts/dragdrop.js +974 -0
- data/spec/dummy/public/javascripts/effects.js +1123 -0
- data/spec/dummy/public/javascripts/prototype.js +6001 -0
- data/spec/dummy/public/javascripts/rails.js +191 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/models/current_room_user_spec.rb +105 -0
- data/spec/models/message_spec.rb +39 -0
- data/spec/models/role_spec.rb +13 -0
- data/spec/models/room_spec.rb +22 -0
- data/spec/models/room_user_role_spec.rb +13 -0
- data/spec/spec_helper.rb +39 -0
- data/spec/support/readme +1 -0
- metadata +292 -0
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
|
4
|
+
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
6
|
+
# which shouldn't be used to store highly confidential information
|
7
|
+
# (create the session table with "rails generate session_migration")
|
8
|
+
# Dummy::Application.config.session_store :active_record_store
|
@@ -0,0 +1,58 @@
|
|
1
|
+
Dummy::Application.routes.draw do
|
2
|
+
# The priority is based upon order of creation:
|
3
|
+
# first created -> highest priority.
|
4
|
+
|
5
|
+
# Sample of regular route:
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
8
|
+
|
9
|
+
# Sample of named route:
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
+
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
+
# resources :products
|
15
|
+
|
16
|
+
# Sample resource route with options:
|
17
|
+
# resources :products do
|
18
|
+
# member do
|
19
|
+
# get 'short'
|
20
|
+
# post 'toggle'
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# collection do
|
24
|
+
# get 'sold'
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# Sample resource route with sub-resources:
|
29
|
+
# resources :products do
|
30
|
+
# resources :comments, :sales
|
31
|
+
# resource :seller
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with more complex sub-resources
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments
|
37
|
+
# resources :sales do
|
38
|
+
# get 'recent', :on => :collection
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Sample resource route within a namespace:
|
43
|
+
# namespace :admin do
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
46
|
+
# resources :products
|
47
|
+
# end
|
48
|
+
|
49
|
+
# You can have the root of your site routed with "root"
|
50
|
+
# just remember to delete public/index.html.
|
51
|
+
# root :to => "welcome#index"
|
52
|
+
|
53
|
+
# See how all your routes lay out with "rake routes"
|
54
|
+
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
+
# match ':controller(/:action(/:id(.:format)))'
|
58
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class CreateCloudspaceChatServiceTables < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :cloudspace_chat_current_room_users do |t|
|
4
|
+
t.integer :user_id, :null => false
|
5
|
+
t.integer :room_id, :null => false
|
6
|
+
t.boolean :connected
|
7
|
+
t.string :connected_hash
|
8
|
+
t.boolean :allowed
|
9
|
+
t.boolean :banned
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
create_table :cloudspace_chat_messages do |t|
|
15
|
+
t.integer :current_room_user_id, :null => false
|
16
|
+
t.text :input_text, :null => false
|
17
|
+
t.text :output_text, :null => false
|
18
|
+
t.boolean :visible
|
19
|
+
|
20
|
+
t.timestamps
|
21
|
+
end
|
22
|
+
|
23
|
+
create_table :cloudspace_chat_room_user_roles do |t|
|
24
|
+
t.integer :current_room_user_id, :null => false
|
25
|
+
t.integer :role_id, :null => false
|
26
|
+
|
27
|
+
t.timestamps
|
28
|
+
end
|
29
|
+
|
30
|
+
create_table :cloudspace_chat_rooms do |t|
|
31
|
+
t.string :name, :null => false
|
32
|
+
t.boolean :public
|
33
|
+
|
34
|
+
t.timestamps
|
35
|
+
end
|
36
|
+
|
37
|
+
create_table :cloudspace_chat_roles do |t|
|
38
|
+
t.string :name, :null => false
|
39
|
+
|
40
|
+
t.timestamps
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.down
|
45
|
+
drop_table :cloudspace_chat_current_room_users
|
46
|
+
drop_table :cloudspace_chat_messages
|
47
|
+
drop_table :cloudspace_chat_room_user_roles
|
48
|
+
drop_table :cloudspace_chat_rooms
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended to check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(:version => 20111101133120) do
|
14
|
+
|
15
|
+
create_table "cloudspace_chat_current_room_users", :force => true do |t|
|
16
|
+
t.integer "user_id", :null => false
|
17
|
+
t.integer "room_id", :null => false
|
18
|
+
t.boolean "connected"
|
19
|
+
t.string "connected_hash"
|
20
|
+
t.boolean "allowed"
|
21
|
+
t.boolean "banned"
|
22
|
+
t.datetime "created_at"
|
23
|
+
t.datetime "updated_at"
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table "cloudspace_chat_messages", :force => true do |t|
|
27
|
+
t.integer "current_room_user_id", :null => false
|
28
|
+
t.text "input_text", :null => false
|
29
|
+
t.text "output_text", :null => false
|
30
|
+
t.boolean "visible"
|
31
|
+
t.datetime "created_at"
|
32
|
+
t.datetime "updated_at"
|
33
|
+
end
|
34
|
+
|
35
|
+
create_table "cloudspace_chat_roles", :force => true do |t|
|
36
|
+
t.string "name", :null => false
|
37
|
+
t.datetime "created_at"
|
38
|
+
t.datetime "updated_at"
|
39
|
+
end
|
40
|
+
|
41
|
+
create_table "cloudspace_chat_room_user_roles", :force => true do |t|
|
42
|
+
t.integer "current_room_user_id", :null => false
|
43
|
+
t.integer "role_id", :null => false
|
44
|
+
t.datetime "created_at"
|
45
|
+
t.datetime "updated_at"
|
46
|
+
end
|
47
|
+
|
48
|
+
create_table "cloudspace_chat_rooms", :force => true do |t|
|
49
|
+
t.string "name", :null => false
|
50
|
+
t.boolean "public"
|
51
|
+
t.datetime "created_at"
|
52
|
+
t.datetime "updated_at"
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,214 @@
|
|
1
|
+
# TL;DR: YOU SHOULD DELETE THIS FILE
|
2
|
+
#
|
3
|
+
# This file was generated by Cucumber-Rails and is only here to get you a head start
|
4
|
+
# These step definitions are thin wrappers around the Capybara/Webrat API that lets you
|
5
|
+
# visit pages, interact with widgets and make assertions about page content.
|
6
|
+
#
|
7
|
+
# If you use these step definitions as basis for your features you will quickly end up
|
8
|
+
# with features that are:
|
9
|
+
#
|
10
|
+
# * Hard to maintain
|
11
|
+
# * Verbose to read
|
12
|
+
#
|
13
|
+
# A much better approach is to write your own higher level step definitions, following
|
14
|
+
# the advice in the following blog posts:
|
15
|
+
#
|
16
|
+
# * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html
|
17
|
+
# * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
|
18
|
+
# * http://elabs.se/blog/15-you-re-cuking-it-wrong
|
19
|
+
#
|
20
|
+
|
21
|
+
|
22
|
+
require 'uri'
|
23
|
+
require 'cgi'
|
24
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
25
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
|
26
|
+
|
27
|
+
module WithinHelpers
|
28
|
+
def with_scope(locator)
|
29
|
+
locator ? within(*selector_for(locator)) { yield } : yield
|
30
|
+
end
|
31
|
+
end
|
32
|
+
World(WithinHelpers)
|
33
|
+
|
34
|
+
# Single-line step scoper
|
35
|
+
When /^(.*) within (.*[^:])$/ do |step, parent|
|
36
|
+
with_scope(parent) { When step }
|
37
|
+
end
|
38
|
+
|
39
|
+
# Multi-line step scoper
|
40
|
+
When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string|
|
41
|
+
with_scope(parent) { When "#{step}:", table_or_string }
|
42
|
+
end
|
43
|
+
|
44
|
+
Given /^(?:|I )am on (.+)$/ do |page_name|
|
45
|
+
visit path_to(page_name)
|
46
|
+
end
|
47
|
+
|
48
|
+
When /^(?:|I )go to (.+)$/ do |page_name|
|
49
|
+
visit path_to(page_name)
|
50
|
+
end
|
51
|
+
|
52
|
+
When /^(?:|I )press "([^"]*)"$/ do |button|
|
53
|
+
click_button(button)
|
54
|
+
end
|
55
|
+
|
56
|
+
When /^(?:|I )follow "([^"]*)"$/ do |link|
|
57
|
+
click_link(link)
|
58
|
+
end
|
59
|
+
|
60
|
+
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
|
61
|
+
fill_in(field, :with => value)
|
62
|
+
end
|
63
|
+
|
64
|
+
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
|
65
|
+
fill_in(field, :with => value)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Use this to fill in an entire form with data from a table. Example:
|
69
|
+
#
|
70
|
+
# When I fill in the following:
|
71
|
+
# | Account Number | 5002 |
|
72
|
+
# | Expiry date | 2009-11-01 |
|
73
|
+
# | Note | Nice guy |
|
74
|
+
# | Wants Email? | |
|
75
|
+
#
|
76
|
+
# TODO: Add support for checkbox, select og option
|
77
|
+
# based on naming conventions.
|
78
|
+
#
|
79
|
+
When /^(?:|I )fill in the following:$/ do |fields|
|
80
|
+
fields.rows_hash.each do |name, value|
|
81
|
+
When %{I fill in "#{name}" with "#{value}"}
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
|
86
|
+
select(value, :from => field)
|
87
|
+
end
|
88
|
+
|
89
|
+
# moved to maniuplation steps
|
90
|
+
When /^(?:|I )check "([^"]*)"$/ do |field|
|
91
|
+
check(field)
|
92
|
+
end
|
93
|
+
|
94
|
+
When /^(?:|I )uncheck "([^"]*)"$/ do |field|
|
95
|
+
uncheck(field)
|
96
|
+
end
|
97
|
+
|
98
|
+
When /^(?:|I )choose "([^"]*)"$/ do |field|
|
99
|
+
choose(field)
|
100
|
+
end
|
101
|
+
|
102
|
+
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
|
103
|
+
attach_file(field, File.expand_path(path))
|
104
|
+
end
|
105
|
+
|
106
|
+
Then /^(?:|I )should see "([^"]*)"$/ do |text|
|
107
|
+
if page.respond_to? :should
|
108
|
+
page.should have_content(text)
|
109
|
+
else
|
110
|
+
assert page.has_content?(text)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
|
115
|
+
regexp = Regexp.new(regexp)
|
116
|
+
|
117
|
+
if page.respond_to? :should
|
118
|
+
page.should have_xpath('//*', :text => regexp)
|
119
|
+
else
|
120
|
+
assert page.has_xpath?('//*', :text => regexp)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
Then /^(?:|I )should not see "([^"]*)"$/ do |text|
|
125
|
+
if page.respond_to? :should
|
126
|
+
page.should have_no_content(text)
|
127
|
+
else
|
128
|
+
assert page.has_no_content?(text)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
|
133
|
+
regexp = Regexp.new(regexp)
|
134
|
+
|
135
|
+
if page.respond_to? :should
|
136
|
+
page.should have_no_xpath('//*', :text => regexp)
|
137
|
+
else
|
138
|
+
assert page.has_no_xpath?('//*', :text => regexp)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
|
143
|
+
with_scope(parent) do
|
144
|
+
field = find_field(field)
|
145
|
+
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
146
|
+
if field_value.respond_to? :should
|
147
|
+
field_value.should =~ /#{value}/
|
148
|
+
else
|
149
|
+
assert_match(/#{value}/, field_value)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
|
155
|
+
with_scope(parent) do
|
156
|
+
field = find_field(field)
|
157
|
+
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
158
|
+
if field_value.respond_to? :should_not
|
159
|
+
field_value.should_not =~ /#{value}/
|
160
|
+
else
|
161
|
+
assert_no_match(/#{value}/, field_value)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# moved to generic steps
|
167
|
+
Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
|
168
|
+
with_scope(parent) do
|
169
|
+
field_checked = find_field(label)['checked']
|
170
|
+
if field_checked.respond_to? :should
|
171
|
+
field_checked.should be_true
|
172
|
+
else
|
173
|
+
assert field_checked
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# moved to generic steps
|
179
|
+
Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
|
180
|
+
with_scope(parent) do
|
181
|
+
field_checked = find_field(label)['checked']
|
182
|
+
if field_checked.respond_to? :should
|
183
|
+
field_checked.should be_false
|
184
|
+
else
|
185
|
+
assert !field_checked
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
191
|
+
current_path = URI.parse(current_url).path
|
192
|
+
if current_path.respond_to? :should
|
193
|
+
current_path.should == path_to(page_name)
|
194
|
+
else
|
195
|
+
assert_equal path_to(page_name), current_path
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
200
|
+
query = URI.parse(current_url).query
|
201
|
+
actual_params = query ? CGI.parse(query) : {}
|
202
|
+
expected_params = {}
|
203
|
+
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
204
|
+
|
205
|
+
if actual_params.respond_to? :should
|
206
|
+
actual_params.should == expected_params
|
207
|
+
else
|
208
|
+
assert_equal expected_params, actual_params
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
Then /^show me the page$/ do
|
213
|
+
save_and_open_page
|
214
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'ruby-debug'
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
4
|
+
|
5
|
+
require 'cucumber/rails'
|
6
|
+
#require 'rspec/expectations'
|
7
|
+
|
8
|
+
# Remove/comment out the lines below if your app doesn't have a database.
|
9
|
+
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
|
10
|
+
begin
|
11
|
+
DatabaseCleaner.strategy = :transaction
|
12
|
+
rescue NameError
|
13
|
+
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module NavigationHelpers
|
2
|
+
|
3
|
+
def path_to(page_name)
|
4
|
+
case page_name
|
5
|
+
|
6
|
+
when /^the home page$/
|
7
|
+
'/'
|
8
|
+
|
9
|
+
else
|
10
|
+
begin
|
11
|
+
page_name =~ /the (.*) page/
|
12
|
+
path_components = $1.split(/\s+/)
|
13
|
+
self.send(path_components.push('path').join('_').to_sym)
|
14
|
+
rescue Object => e
|
15
|
+
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
16
|
+
"Now, go and add a mapping in #{__FILE__}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
World(NavigationHelpers)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module HtmlSelectorsHelpers
|
2
|
+
# Maps a name to a selector. Used primarily by the
|
3
|
+
#
|
4
|
+
# When /^(.+) within (.+)$/ do |step, scope|
|
5
|
+
#
|
6
|
+
# step definitions in web_steps.rb
|
7
|
+
#
|
8
|
+
def selector_for(locator)
|
9
|
+
case locator
|
10
|
+
|
11
|
+
when "the page"
|
12
|
+
"html > body"
|
13
|
+
|
14
|
+
# Add more mappings here.
|
15
|
+
# Here is an example that pulls values out of the Regexp:
|
16
|
+
#
|
17
|
+
# when /^the (notice|error|info) flash$/
|
18
|
+
# ".flash.#{$1}"
|
19
|
+
|
20
|
+
# You can also return an array to use a different selector
|
21
|
+
# type, like:
|
22
|
+
#
|
23
|
+
# when /the header/
|
24
|
+
# [:xpath, "//header"]
|
25
|
+
|
26
|
+
# This allows you to provide a quoted selector as the scope
|
27
|
+
# for "within" steps as was previously the default for the
|
28
|
+
# web steps:
|
29
|
+
when /^"(.+)"$/
|
30
|
+
$1
|
31
|
+
|
32
|
+
else
|
33
|
+
raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
|
34
|
+
"Now, go and add a mapping in #{__FILE__}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
World(HtmlSelectorsHelpers)
|