wagn 1.18.6 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/Guardfile +2 -2
  3. data/bin/wagn +3 -3
  4. data/features/notifications.feature +1 -0
  5. data/features/rules.feature +2 -0
  6. data/features/step_definitions/email_steps.rb +10 -2
  7. data/features/step_definitions/history_steps.rb +1 -1
  8. data/features/step_definitions/wagn_steps.rb +72 -48
  9. data/features/step_definitions/web_steps.rb +12 -12
  10. data/features/step_definitions/window_steps.rb +3 -3
  11. data/features/structure.feature +1 -0
  12. data/features/support/delayed_job.rb +18 -0
  13. data/features/support/env.rb +43 -24
  14. data/features/support/paths.rb +4 -4
  15. data/features/support/scopes.rb +6 -6
  16. data/features/support/wagn_env.rb +2 -2
  17. data/features/table_of_contents.feature +1 -0
  18. data/features/update_includers.feature +2 -4
  19. data/lib/decko/engine.rb +29 -28
  20. data/lib/wagn.rb +1 -1
  21. data/lib/wagn/all.rb +1 -1
  22. data/lib/wagn/application.rb +9 -9
  23. data/lib/wagn/cli.rb +5 -5
  24. data/lib/wagn/commands.rb +48 -48
  25. data/lib/wagn/commands/application.rb +4 -4
  26. data/lib/wagn/config/environments/cucumber.rb +2 -0
  27. data/lib/wagn/config/environments/development.rb +2 -2
  28. data/lib/wagn/config/environments/production.rb +2 -2
  29. data/lib/wagn/config/environments/test.rb +12 -3
  30. data/lib/wagn/config/initializers/secret_token.rb +2 -2
  31. data/lib/wagn/generators/wagn/templates/Gemfile +38 -51
  32. data/lib/wagn/generators/wagn/templates/bin/spring +6 -6
  33. data/lib/wagn/generators/wagn/templates/config/application.rb +12 -1
  34. data/lib/wagn/generators/wagn/templates/spec/javascripts/support/deck_jasmine.yml +2 -2
  35. data/lib/wagn/generators/wagn/templates/spec/javascripts/support/wagn_jasmine.yml +15 -10
  36. data/lib/wagn/generators/wagn/templates/spec/spec_helper.rb +1 -1
  37. data/lib/wagn/generators/wagn/wagn_generator.rb +87 -87
  38. data/lib/wagn/generators/wagn/wagn_generator/interactive.rb +28 -28
  39. data/lib/wagn/mods_spec_helper.rb +9 -9
  40. data/lib/wagn/parser.rb +27 -27
  41. data/lib/wagn/response.rb +106 -0
  42. data/lib/wagn/script_wagn_loader.rb +4 -4
  43. data/lib/wagn/simplecov_helper.rb +19 -19
  44. data/lib/wagn/tasks/cucumber.rake +19 -19
  45. data/lib/wagn/tasks/db.rake +8 -8
  46. data/lib/wagn/tasks/test.rake +25 -25
  47. data/lib/wagn/tasks/wagn.rake +107 -110
  48. data/rails/application-routes.rb +2 -2
  49. data/rails/controllers/card_controller.rb +37 -196
  50. data/rails/engine-routes.rb +29 -29
  51. data/script/autospec +3 -3
  52. data/script/rails +3 -3
  53. data/script/test_filter +2 -2
  54. data/script/wagn +3 -3
  55. data/spec/controllers/card_controller_spec.rb +194 -170
  56. data/spec/controllers/location_spec.rb +10 -10
  57. data/spec/javascripts/support/jasmine.yml.erb +4 -4
  58. data/spec/javascripts/support/jasmine_config.rb +4 -4
  59. data/spec/javascripts/support/jasmine_runner.rb +5 -5
  60. data/test/performance/card_create_test.rb +5 -5
  61. data/test/performance/fetch_test.rb +3 -3
  62. data/test/performance/homepage_test.rb +3 -3
  63. data/test/performance/render_test.rb +3 -3
  64. data/test/test_helper.rb +14 -14
  65. data/wagn.gemspec +16 -16
  66. metadata +7 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb5bf101e2cb0e4ff563ad4dbd19bf3bb438f58f
4
- data.tar.gz: dcd6763cdd24f0d6ec5765ca0945f15fa8c3746e
3
+ metadata.gz: 9f5def697ca9071dc1eb8fbb857b6f3b9f7b9d62
4
+ data.tar.gz: 18c4adb2308e3b2793d98daaf210d02b746ac804
5
5
  SHA512:
6
- metadata.gz: d9b74edbafb538e92f19d2f4205fd6c86e62c720b8fdb191efe93472e959b85da8a3eb2783709ed2a2520e6d6404273b0fca76d7ee6762fe03d782c1590423b0
7
- data.tar.gz: 5b45b232e7b9cb661984cb87a0c7f0511c2e242eb1286240019bd18edd4950243997383e1bd1aabb187537db3a89abab298939a49ea6520040de91505ea76263
6
+ metadata.gz: 18bed7fa63837c98a67740861e9d9461774faddc0052a1f915ea2438c7524ef9b607283ae86c002725b22151aa9a5167ba1b2b60f04c644bd5610e916624b38a
7
+ data.tar.gz: d8df098265a6e02e6e3e1b98afa07dfea4e32ee1ec9609a429bfceaa75ded1777c43e5af756817f03ac42b31247b6577534454bf939b6a45933bd74175c9e821
data/Guardfile CHANGED
@@ -2,10 +2,10 @@
2
2
  # More info at https://github.com/guard/guard#readme
3
3
 
4
4
  # guard :rspec, cmd: 'bundle exec env COVERAGE=false rspec' do
5
- guard :rspec, cmd: 'bundle exec wagn rspec' do
5
+ guard :rspec, cmd: "bundle exec wagn rspec" do
6
6
  watch(%r{^spec/.+_spec\.rb$})
7
7
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
8
- watch('spec/spec_helper.rb') { 'spec' }
8
+ watch("spec/spec_helper.rb") { "spec" }
9
9
 
10
10
  # Rails example
11
11
  watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
data/bin/wagn CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- git_path = File.expand_path('../../../.git', __FILE__)
3
+ git_path = File.expand_path("../../../.git", __FILE__)
4
4
 
5
5
  if File.exist?(git_path)
6
- railties_path = File.expand_path('../../lib', __FILE__)
6
+ railties_path = File.expand_path("../../lib", __FILE__)
7
7
  $LOAD_PATH.unshift(railties_path)
8
8
  end
9
- require 'wagn/cli'
9
+ require "wagn/cli"
@@ -1,3 +1,4 @@
1
+ @javascript @delayed-jobs
1
2
  Feature: Notifications
2
3
  In order for Wagn to be a more effective communication platform
3
4
  Users should be able to track changes to Wagn cards from their email
@@ -1,3 +1,4 @@
1
+ @javascript
1
2
  Feature: Set-based Rles
2
3
  In order to control settings in an efficient way
3
4
  As a Wagneer
@@ -6,6 +7,7 @@ Feature: Set-based Rles
6
7
  Background:
7
8
  Given I am signed in as Joe Admin
8
9
  And I create card "*all+*help" with content "say something spicy"
10
+ And I wait a sec
9
11
 
10
12
  Scenario: default setting and plus card override
11
13
  Given I create Phrase card "color+*right+*add help" with content "If colorblind, leave blank"
@@ -31,7 +31,7 @@ module EmailHelpers
31
31
  # Replace with your a way to find your current email. e.g session -> email
32
32
  # last_email_address will return the last email address used by email spec to find an email.
33
33
  # Note that last_email_address will be reset after each Scenario.
34
- last_email_address || 'fixthis@wagn.org'
34
+ last_email_address || "fixthis@wagn.org"
35
35
  end
36
36
  end
37
37
 
@@ -189,6 +189,10 @@ Then /^save and open all raw emails$/ do
189
189
  end
190
190
 
191
191
  Then /^(.*) should be notified that "(.*)"$/ do |username, subject|
192
+ Timeout.timeout(Capybara.default_wait_time) do
193
+ sleep(0.5) while page.evaluate_script("jQuery.active") != 0
194
+ end
195
+ Delayed::Worker.new.work_off
192
196
  email = address_for_user username
193
197
  begin
194
198
  step %("#{email}" should receive 1 email)
@@ -199,10 +203,14 @@ Then /^(.*) should be notified that "(.*)"$/ do |username, subject|
199
203
  end
200
204
 
201
205
  Then /^No notification should be sent$/ do
206
+ Timeout.timeout(Capybara.default_wait_time) do
207
+ sleep(0.5) while page.evaluate_script("jQuery.active") != 0
208
+ end
209
+ Delayed::Worker.new.work_off
202
210
  expect(all_emails).to be_empty
203
211
  end
204
212
 
205
213
  def address_for_user username
206
- card_with_acct = username == 'I' ? Auth.current : Card[username]
214
+ card_with_acct = username == "I" ? Auth.current : Card[username]
207
215
  card_with_acct ? card_with_acct.account.email : username
208
216
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  # rubocop:disable Lint/AmbiguousRegexpLiteral
3
3
  When /^I expand act (\d+)$/ do |index|
4
- all('a.arrow-right')[-index.to_i].click
4
+ all("a.arrow-right")[-index.to_i].click
5
5
  end
@@ -1,14 +1,14 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  # rubocop:disable Lint/AmbiguousRegexpLiteral
3
- require 'uri'
4
- require 'cgi'
5
- support_paths_file = File.join File.dirname(__FILE__), '..', 'support', 'paths'
3
+ require "uri"
4
+ require "cgi"
5
+ support_paths_file = File.join File.dirname(__FILE__), "..", "support", "paths"
6
6
  require File.expand_path support_paths_file
7
7
 
8
8
  if RUBY_VERSION =~ /^2/
9
- require 'byebug'
9
+ require "byebug"
10
10
  else
11
- require 'debugger'
11
+ require "debugger"
12
12
  end
13
13
 
14
14
  Given /^site simulates setup need$/ do
@@ -17,19 +17,19 @@ end
17
17
 
18
18
  Given /^site stops simulating setup need$/ do
19
19
  Card::Auth.simulate_setup_need! false
20
- step 'I am signed out'
20
+ step "I am signed out"
21
21
  end
22
22
 
23
23
  Given /^I am signed in as (.+)$/ do |account_name|
24
24
  accounted = Card[account_name]
25
- visit '/update/:signin?card[subcards][%2B*email][content]='\
25
+ visit "/update/:signin?card[subcards][%2B*email][content]="\
26
26
  "#{accounted.account.email}&card[subcards][%2B*password][content]=joe_pass"
27
27
  # could optimize by specifying simple text success page
28
28
  end
29
29
 
30
30
  Given /^I am signed out$/ do
31
- visit '/'
32
- step 'I follow "Sign out"' if page.has_content? 'Sign out'
31
+ visit "/"
32
+ step 'I follow "Sign out"' if page.has_content? "Sign out"
33
33
  end
34
34
 
35
35
  # Given /^I sign in as (.+)$/ do |account_name|
@@ -62,7 +62,7 @@ When wysiwyg_re do |username, cardname, content|
62
62
  signed_in_as(username) do
63
63
  visit "/card/edit/#{cardname.to_name.url_key}"
64
64
  page.execute_script "$('#main .card-content').val('#{content}')"
65
- click_button 'Submit'
65
+ click_button "Submit"
66
66
  end
67
67
  end
68
68
 
@@ -70,40 +70,55 @@ edit_re = /^(.*) edits? "([^\"]*)" setting (.*) to "([^\"]*)"$/
70
70
  When edit_re do |username, cardname, _field, content|
71
71
  signed_in_as(username) do
72
72
  visit "/card/edit/#{cardname.to_name.url_key}"
73
- fill_in 'card[content]', with: content
74
- click_button 'Submit'
73
+ set_content "card[content]", content
74
+ click_button "Submit"
75
75
  end
76
76
  end
77
77
 
78
78
  filling_re = /^(.*) edits? "([^\"]*)" filling in "([^\"]*)"$/
79
79
  When filling_re do |_username, cardname, content|
80
80
  visit "/card/edit/#{cardname.to_name.url_key}"
81
- fill_in 'card[content]', with: content
81
+ fill_in "card[content]", with: content
82
82
  end
83
83
 
84
84
  When /^(.*) edits? "([^\"]*)" with plusses:/ do |username, cardname, plusses|
85
85
  signed_in_as(username) do
86
86
  visit "/card/edit/#{cardname.to_name.url_key}"
87
87
  plusses.hashes.first.each do |name, content|
88
- fill_in "card[subcards][#{cardname}+#{name}][content]", with: content
88
+ set_content "card[subcards][#{cardname}+#{name}][content]", content
89
89
  end
90
- click_button 'Submit'
90
+ click_button "Submit"
91
91
  end
92
92
  end
93
93
 
94
+ def set_content name, content, cardtype=nil
95
+ Capybara.ignore_hidden_elements = false
96
+ ace_editors = all(".ace-editor-textarea[name='#{name}']")
97
+ pm_editors = all(".prosemirror-editor > [name='#{name}']")
98
+ if ace_editors.present? &&
99
+ page.evaluate_script("typeof ace != 'undefined'")
100
+ page.execute_script "ace.edit($('.ace_editor').get(0))"\
101
+ ".getSession().setValue('#{content}')"
102
+ elsif pm_editors.present?
103
+ editor_id = pm_editors.first.first(:xpath, ".//..")[:id]
104
+ set_prosemirror_content editor_id, content
105
+ else
106
+ #rescue Selenium::WebDriver::Error::JavascriptError
107
+ fill_in(name, with: content)
108
+ end
109
+ Capybara.ignore_hidden_elements = true
110
+ end
111
+
112
+ def set_prosemirror_content editor_id, content
113
+ escaped_quotes = content.gsub("'", "\\'")
114
+ page.execute_script "getProseMirror('#{editor_id}')"\
115
+ ".setContent('#{escaped_quotes}', 'text')"
116
+ end
117
+
94
118
  content_re = /^(.*) creates?\s*a?\s*([^\s]*) card "(.*)" with content "(.*)"$/
95
119
  When content_re do |username, cardtype, cardname, content|
96
120
  create_card(username, cardtype, cardname, content) do
97
- normal_textarea_types = %w(
98
- JavaScript CoffeeScript HTML CSS SCSS Search
99
- )
100
- if !normal_textarea_types.include?(cardtype) ||
101
- !page.evaluate_script("typeof ace != 'undefined'")
102
- fill_in('card[content]', with: content)
103
- else
104
- page.execute_script "ace.edit($('.ace_editor').get(0))"\
105
- ".getSession().setValue('#{content}')"
106
- end
121
+ set_content "card[content]", content, cardtype
107
122
  end
108
123
  end
109
124
 
@@ -116,7 +131,7 @@ plus_re = /^(.*) creates?\s*([^\s]*) card "([^"]*)" with plusses:$/
116
131
  When plus_re do |username, cardtype, cardname, plusses|
117
132
  create_card(username, cardtype, cardname) do
118
133
  plusses.hashes.first.each do |name, content|
119
- fill_in "card[subcards][+#{name}][content]", with: content
134
+ set_content "card[subcards][+#{name}][content]", content, cardtype
120
135
  end
121
136
  end
122
137
  end
@@ -135,19 +150,20 @@ end
135
150
  When /^(?:|I )upload the (.+) "(.+)"$/ do |attachment_name, filename|
136
151
  script = "$('input[type=file]').css('opacity','1');"
137
152
  page.driver.browser.execute_script(script)
138
- file = File.join Wagn.gem_root, 'features', 'support', filename
153
+ file = File.join Wagn.gem_root, "features", "support", filename
139
154
  attach_file "card_#{attachment_name}", file
140
155
  end
141
156
 
142
157
  Given /^(.*) (is|am) watching "([^\"]+)"$/ do |user, _verb, cardname|
143
- user = Card::Auth.current.name if user == 'I'
158
+ Delayed::Worker.new.work_off
159
+ user = Card::Auth.current.name if user == "I"
144
160
  signed_in_as user do
145
161
  step "the card #{cardname}+#{user}+*follow contains \"[[*always]]\""
146
162
  end
147
163
  end
148
164
 
149
165
  Given /^(.*) (is|am) not watching "([^\"]+)"$/ do |user, _verb, cardname|
150
- user = Card::Auth.current.name if user == 'I'
166
+ user = Card::Auth.current.name if user == "I"
151
167
  signed_in_as user do
152
168
  step "the card #{cardname}+#{user}+*follow contains \"[[*never]]\""
153
169
  end
@@ -163,7 +179,7 @@ end
163
179
 
164
180
  When /^I wait until ajax response done$/ do
165
181
  Timeout.timeout(Capybara.default_wait_time) do
166
- sleep(0.5) while page.evaluate_script('jQuery.active') != 0
182
+ sleep(0.5) while page.evaluate_script("jQuery.active") != 0
167
183
  end
168
184
  end
169
185
 
@@ -181,20 +197,20 @@ end
181
197
  # nil
182
198
  # end
183
199
 
184
- def create_card username, cardtype, cardname, content=''
200
+ def create_card username, cardtype, cardname, content=""
185
201
  signed_in_as(username) do
186
- if cardtype == 'Pointer'
202
+ if cardtype == "Pointer"
187
203
  Card.create name: cardname, type: cardtype, content: content
188
204
  else
189
205
  visit "/card/new?card[name]=#{CGI.escape(cardname)}&type=#{cardtype}"
190
206
  yield if block_given?
191
- click_button 'Submit'
207
+ click_button "Submit"
192
208
  end
193
209
  end
194
210
  end
195
211
 
196
212
  def signed_in_as username
197
- sameuser = (username == 'I')
213
+ sameuser = (username == "I")
198
214
  sameuser ||= (Card::Auth.current.key == username.to_name.key)
199
215
  was_signed_in = Card::Auth.current_id if Card::Auth.signed_in?
200
216
  step "I am signed in as #{username}" unless sameuser
@@ -245,18 +261,22 @@ When /^In (.*) I find button with icon "(.*)" and click it$/ do |section, icon|
245
261
  end
246
262
  end
247
263
 
264
+ Given /^Jobs are dispatched$/ do
265
+ Delayed::Worker.new.work_off
266
+ end
267
+
248
268
  Then /I submit$/ do
249
- click_button 'Submit'
269
+ click_button "Submit"
250
270
  end
251
271
 
252
272
  When /^I open the main card menu$/ do
253
273
  slot = "$('#main .menu-slot .vertical-card-menu.show-on-hover .card-slot')"
254
274
  page.execute_script "#{slot}.show()"
255
- page.find('#main .menu-slot .card-menu a').click
275
+ page.find("#main .menu-slot .card-menu a").click
256
276
  end
257
277
 
258
278
  When /^I close the modal window$/ do
259
- page.find('.modal-menu .close-modal').click
279
+ page.find(".modal-menu .close-modal").click
260
280
  end
261
281
 
262
282
  # When /^I pick (.*)$/ do |menu_item|
@@ -264,36 +284,36 @@ end
264
284
 
265
285
  Then /the card (.*) should contain "([^\"]*)"$/ do |cardname, content|
266
286
  visit path_to("card #{cardname}")
267
- within scope_of('main card content') do
287
+ within scope_of("main card content") do
268
288
  expect(page).to have_content(content)
269
289
  end
270
290
  end
271
291
 
272
292
  Then /the card (.*) should not contain "([^\"]*)"$/ do |cardname, content|
273
293
  visit path_to("card #{cardname}")
274
- within scope_of('main card content') do
294
+ within scope_of("main card content") do
275
295
  expect(page).not_to have_content(content)
276
296
  end
277
297
  end
278
298
 
279
299
  Then /the card (.*) should point to "([^\"]*)"$/ do |cardname, content|
280
300
  visit path_to("card #{cardname}")
281
- within scope_of('pointer card content') do
301
+ within scope_of("pointer card content") do
282
302
  expect(page).to have_content(content)
283
303
  end
284
304
  end
285
305
 
286
306
  Then /the card (.*) should not point to "([^\"]*)"$/ do |cardname, content|
287
307
  visit path_to("card #{cardname}")
288
- within scope_of('pointer card content') do
308
+ within scope_of("pointer card content") do
289
309
  expect(page).not_to have_content(content)
290
310
  end
291
311
  end
292
312
 
293
313
  Then /^In (.*) I should see "([^\"]*)"$/ do |section, text|
294
314
  within scope_of(section) do
295
- if text.index('|')
296
- expect(text.split('|').any? { |t| have_content(t) }).to be
315
+ if text.index("|")
316
+ expect(text.split("|").any? { |t| have_content(t) }).to be
297
317
  else
298
318
  expect(page).to have_content(text)
299
319
  end
@@ -309,17 +329,17 @@ end
309
329
  class_re = /^In (.*) I should (not )?see a ([^\"]*) with class "([^\"]*)"$/
310
330
  Then class_re do |selection, neg, element, selector|
311
331
  # checks for existence of a element with a class in a selection context
312
- element = 'a' if element == 'link'
332
+ element = "a" if element == "link"
313
333
  within scope_of(selection) do
314
334
  verb = neg ? :should_not : :should
315
- page.send(verb, have_css([element, selector].join('.')))
335
+ page.send(verb, have_css([element, selector].join(".")))
316
336
  end
317
337
  end
318
338
 
319
339
  content_re = /^In (.*) I should (not )?see a ([^\"]*) with content "([^\"]*)"$/
320
340
  Then content_re do |selection, neg, element, content|
321
341
  # checks for existence of a element with a class in a selection context
322
- element = 'a' if element == 'link'
342
+ element = "a" if element == "link"
323
343
  within scope_of(selection) do
324
344
  verb = neg ? :should_not : :should
325
345
  page.send(verb, have_css(element, text: content))
@@ -337,11 +357,11 @@ Then /^"([^"]*)" should be selected for "([^"]*)"$/ do |value, field|
337
357
  end
338
358
 
339
359
  Then /^"([^"]*)" should be signed in$/ do |user| # "
340
- has_css?('#my-card-link', text: user)
360
+ has_css?("#my-card-link", text: user)
341
361
  end
342
362
 
343
363
  When /^I press enter to search$/ do
344
- find('#_keyword').native.send_keys(:return)
364
+ find("#_keyword").native.send_keys(:return)
345
365
  end
346
366
 
347
367
  ## variants of standard steps to handle """ style quoted args
@@ -374,6 +394,10 @@ Then /^I should see "([^\"]*)" in color (.*)$/ do |text, css_class|
374
394
  page.has_css?(".diff-#{css_class}", text: text)
375
395
  end
376
396
 
397
+ Then /^I should see css class "([^\"]*)"$/ do |css_class|
398
+ find(css_class)
399
+ end
400
+
377
401
  css_should = /^I should see css class "([^\"]*)" within "(.*)"$/
378
402
  Then css_should do |css_class, selector|
379
403
  within selector do
@@ -6,9 +6,9 @@
6
6
  # instead of editing this one. Cucumber will automatically load all features/**/*.rb
7
7
  # files.
8
8
 
9
- require 'uri'
10
- require 'cgi'
11
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'support', 'paths'))
9
+ require "uri"
10
+ require "cgi"
11
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
12
12
 
13
13
  # Commonly used webrat steps
14
14
  # http://github.com/brynary/webrat
@@ -108,17 +108,17 @@ end
108
108
  # passed to attach_file() you will get a "Photo file is not one of the allowed file types."
109
109
  # error message
110
110
  When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
111
- type = path.split('.')[1]
111
+ type = path.split(".")[1]
112
112
 
113
113
  case type
114
- when 'jpg'
115
- type = 'image/jpg'
116
- when 'jpeg'
117
- type = 'image/jpeg'
118
- when 'png'
119
- type = 'image/png'
120
- when 'gif'
121
- type = 'image/gif'
114
+ when "jpg"
115
+ type = "image/jpg"
116
+ when "jpeg"
117
+ type = "image/jpeg"
118
+ when "png"
119
+ type = "image/png"
120
+ when "gif"
121
+ type = "image/gif"
122
122
  end
123
123
 
124
124
  attach_file(field, path, type)
@@ -13,14 +13,14 @@ END_TAG
13
13
  end
14
14
 
15
15
  When /I switch to (.+) window$/ do |window|
16
- if window == 'first'
16
+ if window == "first"
17
17
  page.driver.browser.switch_to.window(page.driver.browser.window_handles.first)
18
- elsif window == 'last'
18
+ elsif window == "last"
19
19
  page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
20
20
  end
21
21
  end
22
22
 
23
23
  When /^I close window$/ do
24
- page.execute_script('window.close();')
24
+ page.execute_script("window.close();")
25
25
  page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
26
26
  end