rspectacular 0.59.0 → 0.60.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rspectacular.rb +1 -3
- data/lib/rspectacular/helpers.rb +0 -5
- data/lib/rspectacular/plugins.rb +1 -1
- data/lib/rspectacular/plugins/fakeredis.rb +4 -0
- data/lib/rspectacular/plugins/test_after_commit.rb +4 -0
- data/lib/rspectacular/support/focused.rb +0 -1
- data/lib/rspectacular/support/pending.rb +0 -1
- data/lib/rspectacular/version.rb +1 -1
- metadata +4 -19
- data/lib/rspectacular/helpers/date_time_select.rb +0 -35
- data/lib/rspectacular/helpers/dialog.rb +0 -3
- data/lib/rspectacular/helpers/facebook.rb +0 -59
- data/lib/rspectacular/helpers/paypal.rb +0 -30
- data/lib/rspectacular/helpers/rails_flashes.rb +0 -15
- data/lib/rspectacular/matchers.rb +0 -2
- data/lib/rspectacular/matchers/active_record.rb +0 -13
- data/lib/rspectacular/matchers/active_record/date_range_matcher.rb +0 -47
- data/lib/rspectacular/matchers/active_record/dateliness_matcher.rb +0 -39
- data/lib/rspectacular/matchers/active_record/persistence_matcher.rb +0 -37
- data/lib/rspectacular/matchers/active_record/positivity_matcher.rb +0 -39
- data/lib/rspectacular/matchers/active_record/truthfulness_matcher.rb +0 -35
- data/lib/rspectacular/matchers/authentication.rb +0 -39
- data/lib/rspectacular/plugins/capybara.rb +0 -48
- data/lib/rspectacular/plugins/paypal.rb +0 -11
- data/lib/rspectacular/selectors.rb +0 -28
- data/lib/rspectacular/selectors/defaults.rb +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 720ff48263cc9da21445eda39124f3f1d0e8c542
|
4
|
+
data.tar.gz: c19e3b6bdde3dcab7d4b86426cad8ca3c964eb78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a445a6a7c9eed223b66aee4802c37e26265b6b6ccd015d8a6ed55baaaff9c0e3b52638f4ef9eaadf9f2bbe63d24fe4d0428f3d8372c5be0e48be01cf4bf120f
|
7
|
+
data.tar.gz: c6cb933de456a1dde23eff06b2c6388fe8b25537a463795c28a4c7b36d216c70f59baab1420d437c7b227088123f59e35b551657ff72732eef541480cbf3eace
|
data/lib/rspectacular.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
# These Plugins Must Be Loaded Before Anything Else
|
2
2
|
require 'rspectacular/plugins/code_climate'
|
3
3
|
require 'rspectacular/plugins/simple_cov'
|
4
|
-
require 'rspectacular/plugins/capybara'
|
5
4
|
|
6
5
|
require 'rspectacular/support'
|
7
6
|
require 'rspectacular/helpers'
|
8
|
-
require 'rspectacular/selectors'
|
9
7
|
require 'rspectacular/plugins'
|
10
|
-
require 'rspectacular/matchers'
|
8
|
+
# require 'rspectacular/matchers'
|
data/lib/rspectacular/helpers.rb
CHANGED
@@ -1,8 +1,3 @@
|
|
1
1
|
require 'rspectacular/helpers/factories'
|
2
2
|
require 'rspectacular/helpers/null_objects'
|
3
|
-
require 'rspectacular/helpers/rails_flashes'
|
4
3
|
require 'rspectacular/helpers/session_helpers'
|
5
|
-
|
6
|
-
if defined?(Capybara::Driver::Base)
|
7
|
-
Dir[File.expand_path('../helpers/**/*.rb', __FILE__)].each { |f| require f }
|
8
|
-
end
|
data/lib/rspectacular/plugins.rb
CHANGED
data/lib/rspectacular/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspectacular
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.60.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jfelchner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -52,22 +52,9 @@ files:
|
|
52
52
|
- bin/rspectacular_test_bootstrap
|
53
53
|
- lib/rspectacular.rb
|
54
54
|
- lib/rspectacular/helpers.rb
|
55
|
-
- lib/rspectacular/helpers/date_time_select.rb
|
56
|
-
- lib/rspectacular/helpers/dialog.rb
|
57
|
-
- lib/rspectacular/helpers/facebook.rb
|
58
55
|
- lib/rspectacular/helpers/factories.rb
|
59
56
|
- lib/rspectacular/helpers/null_objects.rb
|
60
|
-
- lib/rspectacular/helpers/paypal.rb
|
61
|
-
- lib/rspectacular/helpers/rails_flashes.rb
|
62
57
|
- lib/rspectacular/helpers/session_helpers.rb
|
63
|
-
- lib/rspectacular/matchers.rb
|
64
|
-
- lib/rspectacular/matchers/active_record.rb
|
65
|
-
- lib/rspectacular/matchers/active_record/date_range_matcher.rb
|
66
|
-
- lib/rspectacular/matchers/active_record/dateliness_matcher.rb
|
67
|
-
- lib/rspectacular/matchers/active_record/persistence_matcher.rb
|
68
|
-
- lib/rspectacular/matchers/active_record/positivity_matcher.rb
|
69
|
-
- lib/rspectacular/matchers/active_record/truthfulness_matcher.rb
|
70
|
-
- lib/rspectacular/matchers/authentication.rb
|
71
58
|
- lib/rspectacular/mock_authentications/omniauth.rb
|
72
59
|
- lib/rspectacular/mock_authentications/omniauth/ebay.rb
|
73
60
|
- lib/rspectacular/mock_authentications/omniauth/facebook.rb
|
@@ -75,16 +62,15 @@ files:
|
|
75
62
|
- lib/rspectacular/plugins.rb
|
76
63
|
- lib/rspectacular/plugins/authentication.rb
|
77
64
|
- lib/rspectacular/plugins/bullet.rb
|
78
|
-
- lib/rspectacular/plugins/capybara.rb
|
79
65
|
- lib/rspectacular/plugins/carrier_wave.rb
|
80
66
|
- lib/rspectacular/plugins/code_climate.rb
|
81
67
|
- lib/rspectacular/plugins/database_cleaner.rb
|
82
68
|
- lib/rspectacular/plugins/devise.rb
|
83
69
|
- lib/rspectacular/plugins/email.rb
|
84
70
|
- lib/rspectacular/plugins/factory_girl.rb
|
71
|
+
- lib/rspectacular/plugins/fakeredis.rb
|
85
72
|
- lib/rspectacular/plugins/features.rb
|
86
73
|
- lib/rspectacular/plugins/omniauth.rb
|
87
|
-
- lib/rspectacular/plugins/paypal.rb
|
88
74
|
- lib/rspectacular/plugins/rails/engine.rb
|
89
75
|
- lib/rspectacular/plugins/rails/strong_parameters.rb
|
90
76
|
- lib/rspectacular/plugins/recaptcha.rb
|
@@ -94,11 +80,10 @@ files:
|
|
94
80
|
- lib/rspectacular/plugins/simple_cov.rb
|
95
81
|
- lib/rspectacular/plugins/singleton.rb
|
96
82
|
- lib/rspectacular/plugins/stripe.rb
|
83
|
+
- lib/rspectacular/plugins/test_after_commit.rb
|
97
84
|
- lib/rspectacular/plugins/timecop.rb
|
98
85
|
- lib/rspectacular/plugins/vcr.rb
|
99
86
|
- lib/rspectacular/plugins/webmock.rb
|
100
|
-
- lib/rspectacular/selectors.rb
|
101
|
-
- lib/rspectacular/selectors/defaults.rb
|
102
87
|
- lib/rspectacular/spec_helpers/active_record_basic.rb
|
103
88
|
- lib/rspectacular/spec_helpers/active_record_connection_setup.rb
|
104
89
|
- lib/rspectacular/spec_helpers/rails_engine.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
###
|
2
|
-
# Unscrupulously stolen from: https://raw.github.com/cucumber/cucumber-rails/master/lib/cucumber/rails/capybara/select_dates_and_times.rb
|
3
|
-
#
|
4
|
-
def select_date(date, options = {})
|
5
|
-
date = Time.parse(date)
|
6
|
-
base_dom_id = get_base_dom_id_from_label_tag(options[:from])
|
7
|
-
|
8
|
-
page.execute_script %Q{$("##{base_dom_id}_1i").val("#{date.strftime('%Y')}")}
|
9
|
-
page.execute_script %Q{$("##{base_dom_id}_2i").val("#{date.strftime('%m')}")}
|
10
|
-
page.execute_script %Q{$("##{base_dom_id}_3i").val("#{date.strftime('%d')}")}
|
11
|
-
page.execute_script %Q{$("##{base_dom_id}_datepicker").val("#{date.strftime('%m/%d/%Y')}")}
|
12
|
-
page.execute_script %Q{$("##{base_dom_id}_datepicker").change()}
|
13
|
-
end
|
14
|
-
|
15
|
-
def select_time(time, options = {})
|
16
|
-
time = Time.zone.parse(time)
|
17
|
-
base_dom_id = get_base_dom_id_from_label_tag(options[:from])
|
18
|
-
|
19
|
-
find(:xpath, ".//select[@id='#{base_dom_id}_4i']").select(time.strftime '%I %p')
|
20
|
-
find(:xpath, ".//select[@id='#{base_dom_id}_5i']").select(time.min.to_s.rjust(2, '0'))
|
21
|
-
|
22
|
-
page.execute_script %Q{$("##{base_dom_id}_datepicker").change()}
|
23
|
-
end
|
24
|
-
|
25
|
-
def select_datetime(datetime, options = {})
|
26
|
-
select_date(datetime, options)
|
27
|
-
select_time(datetime, options)
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
# @example "event_starts_at_"
|
33
|
-
def get_base_dom_id_from_label_tag(field)
|
34
|
-
find(:xpath, ".//label[contains(., '#{field}')]")['for'].gsub(/(_[1-5]i)$/, '')
|
35
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
def fill_in_facebook_login_form(options = {})
|
2
|
-
facebook_user = options[:with]
|
3
|
-
|
4
|
-
sleep 1
|
5
|
-
|
6
|
-
within sf('the Facebook login form') do
|
7
|
-
fill_in 'Email', :with => facebook_user['email']
|
8
|
-
fill_in 'Password', :with => facebook_user['password']
|
9
|
-
click_link_or_button 'Log In'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def log_in_to_facebook(user)
|
14
|
-
###
|
15
|
-
# We use this URL due to how selenium throws an error if you
|
16
|
-
# interact with items that are off the visible area of the
|
17
|
-
# page
|
18
|
-
#
|
19
|
-
visit 'https://www.facebook.com/login.php'
|
20
|
-
|
21
|
-
sleep 3
|
22
|
-
|
23
|
-
fill_in 'Email', :with => user['email']
|
24
|
-
fill_in 'Password', :with => user['password']
|
25
|
-
|
26
|
-
click_link_or_button 'Log In'
|
27
|
-
end
|
28
|
-
|
29
|
-
def log_out_of_facebook
|
30
|
-
click_link idsf('the Facebook account menu')
|
31
|
-
click_button 'Log Out'
|
32
|
-
end
|
33
|
-
|
34
|
-
def authenticate_with_facebook
|
35
|
-
visit '/users/auth/facebook'
|
36
|
-
end
|
37
|
-
|
38
|
-
def click_facebook_tab(tab_name)
|
39
|
-
find(:xpath, %Q{.//span[starts-with(., '#{tab_name}')]/../..}).click()
|
40
|
-
end
|
41
|
-
|
42
|
-
def remove_app_from_authorized_apps_at_facebook(app_name)
|
43
|
-
visit 'http://www.facebook.com/settings?tab=applications'
|
44
|
-
|
45
|
-
page.should_not have_content 'You have not authorized any apps to interact with your Facebook account.'
|
46
|
-
page.should have_content app_name
|
47
|
-
|
48
|
-
find("input[type='button'][title='Remove']").click()
|
49
|
-
|
50
|
-
sleep 1
|
51
|
-
|
52
|
-
click_link_or_button 'Remove'
|
53
|
-
|
54
|
-
sleep 1
|
55
|
-
|
56
|
-
page.should_not have_content app_name
|
57
|
-
|
58
|
-
log_out_of_facebook
|
59
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
def log_in_to_paypal_sandbox(email, password)
|
2
|
-
visit 'https://developer.paypal.com'
|
3
|
-
|
4
|
-
if page.has_button? 'Log In'
|
5
|
-
fill_in 'Email', :with => email
|
6
|
-
fill_in 'Password', :with => password
|
7
|
-
click_link_or_button 'Log In'
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def log_out_of_paypal
|
12
|
-
visit 'https://www.paypal.com/us/cgi-bin/webscr?cmd=_logout'
|
13
|
-
end
|
14
|
-
|
15
|
-
def log_out_of_paypal_sandbox
|
16
|
-
visit 'https://developer.paypal.com'
|
17
|
-
|
18
|
-
if page.has_link? 'Log Out'
|
19
|
-
click_link 'Log Out'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def fill_in_paypal_login_form(email, password)
|
24
|
-
fill_in 'Email', :with => email
|
25
|
-
fill_in 'PayPal password', :with => password
|
26
|
-
click_link_or_button 'Log In'
|
27
|
-
|
28
|
-
check 'esignOpt'
|
29
|
-
click_link_or_button 'Agree and Continue'
|
30
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
if defined? ActiveRecord
|
2
|
-
# require 'rspectacular/active_record/date_range_matcher'
|
3
|
-
# require 'rspectacular/active_record/dateliness_matcher'
|
4
|
-
# require 'rspectacular/active_record/persistence_matcher'
|
5
|
-
# require 'rspectacular/active_record/positivity_matcher'
|
6
|
-
# require 'rspectacular/active_record/truthfulness_matcher'
|
7
|
-
|
8
|
-
# module RSpec
|
9
|
-
# module Matchers
|
10
|
-
# include Rspectacular::ActiveRecord::Matchers
|
11
|
-
# end
|
12
|
-
# end
|
13
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
module Rspectacular
|
2
|
-
module ActiveRecord
|
3
|
-
module Matchers
|
4
|
-
class DateRangeMatcher
|
5
|
-
include Shoulda::ActiveRecord::Helpers
|
6
|
-
|
7
|
-
def initialize(dates)
|
8
|
-
@begin_field = dates[:from].to_s
|
9
|
-
@end_field = dates[:to].to_s
|
10
|
-
|
11
|
-
@begin_method = "#{dates[:from].to_s}=".to_sym
|
12
|
-
@end_method = "#{dates[:to].to_s}=".to_sym
|
13
|
-
end
|
14
|
-
|
15
|
-
def matches?(rangeable)
|
16
|
-
@rangeable = rangeable
|
17
|
-
beginning_date = Date.today
|
18
|
-
ending_date = Date.today - 1
|
19
|
-
|
20
|
-
rangeable.send(@begin_method, beginning_date)
|
21
|
-
rangeable.send(@end_method, ending_date)
|
22
|
-
|
23
|
-
rangeable.valid?
|
24
|
-
|
25
|
-
rangeable.errors[@begin_field].include?("must be on or before #{ending_date.to_s}") &&
|
26
|
-
rangeable.errors[@end_field].include?("must be on or after #{beginning_date.to_s}")
|
27
|
-
end
|
28
|
-
|
29
|
-
def failure_message
|
30
|
-
"#{@rangeable_class} should only accept a valid date range from #{@begin_field} to #{@end_field}, got: #{pretty_error_messages(@rangeable)}"
|
31
|
-
end
|
32
|
-
|
33
|
-
def negative_failure_message
|
34
|
-
"#{@rangeable_class} shouldn't accept a valid date range from #{@begin_field} to #{@end_field}, got: #{pretty_error_messages(@rangeable)}"
|
35
|
-
end
|
36
|
-
|
37
|
-
def description
|
38
|
-
"should be contain a valid range for #{@rangeable_class}"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def validate_date_range(dates)
|
43
|
-
DateRangeMatcher.new(dates)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Rspectacular
|
2
|
-
module ActiveRecord
|
3
|
-
module Matchers
|
4
|
-
class DatelinessMatcher
|
5
|
-
include Shoulda::ActiveRecord::Helpers
|
6
|
-
|
7
|
-
def initialize(date_field)
|
8
|
-
@date_field = date_field.to_s
|
9
|
-
@date_method = "#{date_field.to_s}=".to_sym
|
10
|
-
end
|
11
|
-
|
12
|
-
def matches?(dateable)
|
13
|
-
@dateable = dateable
|
14
|
-
dateable.send(@date_method, Date.today)
|
15
|
-
|
16
|
-
dateable.valid?
|
17
|
-
|
18
|
-
!dateable.errors[@date_field].include?("is not a valid date")
|
19
|
-
end
|
20
|
-
|
21
|
-
def failure_message
|
22
|
-
"Expected #{@date_field} to contain a valid date, got: #{pretty_error_messages(@dateable)}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def negative_failure_message
|
26
|
-
"Expected #{@date_field} to contain an invalid date, got: #{pretty_error_messages(@dateable)}"
|
27
|
-
end
|
28
|
-
|
29
|
-
def description
|
30
|
-
"should be contain a valid date"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def validate_dateliness_of(date)
|
35
|
-
DatelinessMatcher.new(date)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Rspectacular
|
2
|
-
module ActiveRecord
|
3
|
-
module Matchers
|
4
|
-
class PersistenceMatcher
|
5
|
-
def initialize(persistable, options)
|
6
|
-
@persistable_class = persistable.is_a?(Class) ? persistable : persistable.class
|
7
|
-
@desired_attributes = options[:with] || persistable.attributes
|
8
|
-
@desired_attributes = @desired_attributes.reject {|k,v| ['id', 'created_at', 'updated_at'].include? k}
|
9
|
-
end
|
10
|
-
|
11
|
-
def matches?(subject)
|
12
|
-
@persistable_class.where(@desired_attributes).first
|
13
|
-
end
|
14
|
-
|
15
|
-
def failure_message
|
16
|
-
"Expected to find an object saved with #{@desired_attributes}, didn't find one."
|
17
|
-
end
|
18
|
-
|
19
|
-
def negative_failure_message
|
20
|
-
"Didn't expect to find an object saved with #{@desired_attributes}, but got one anyway"
|
21
|
-
end
|
22
|
-
|
23
|
-
def description
|
24
|
-
"should be an instance of #{@expected_class_name}"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def persist(desired_object, options = {})
|
29
|
-
PersistenceMatcher.new(desired_object, options)
|
30
|
-
end
|
31
|
-
|
32
|
-
alias :persist_the :persist
|
33
|
-
alias :persist_a :persist
|
34
|
-
alias :persist_an :persist
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Rspectacular
|
2
|
-
module ActiveRecord
|
3
|
-
module Matchers
|
4
|
-
class PositivityMatcher < Shoulda::ActiveRecord::Matchers::ValidateNumericalityOfMatcher
|
5
|
-
def matches?(positivitable)
|
6
|
-
super(positivitable)
|
7
|
-
|
8
|
-
disallows_zero_values &&
|
9
|
-
disallows_negative_values
|
10
|
-
end
|
11
|
-
|
12
|
-
def failure_message
|
13
|
-
"Expected #{@attribute.to_s} to be a positive number, got: #{pretty_error_messages(@attribute)}"
|
14
|
-
end
|
15
|
-
|
16
|
-
def negative_failure_message
|
17
|
-
"Expected #{@attribute.to_s} to be a negative number, got: #{pretty_error_messages(@attribute)}"
|
18
|
-
end
|
19
|
-
|
20
|
-
def disallows_negative_values
|
21
|
-
disallows_value_of(-1) &&
|
22
|
-
disallows_value_of(-100)
|
23
|
-
end
|
24
|
-
|
25
|
-
def disallows_zero_values
|
26
|
-
disallows_value_of(0)
|
27
|
-
end
|
28
|
-
|
29
|
-
def description
|
30
|
-
"should be contain a positive number"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def validate_positivity_of(date)
|
35
|
-
PositivityMatcher.new(date)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module Rspectacular
|
2
|
-
module ActiveRecord
|
3
|
-
module Matchers
|
4
|
-
class TruthfulnessMatcher < Shoulda::ActiveRecord::Matchers::ValidationMatcher
|
5
|
-
def matches?(truthable)
|
6
|
-
super(truthable)
|
7
|
-
|
8
|
-
allows_true &&
|
9
|
-
allows_false &&
|
10
|
-
disallows_nil
|
11
|
-
end
|
12
|
-
|
13
|
-
def allows_true
|
14
|
-
allows_value_of(true)
|
15
|
-
end
|
16
|
-
|
17
|
-
def allows_false
|
18
|
-
allows_value_of(false)
|
19
|
-
end
|
20
|
-
|
21
|
-
def disallows_nil
|
22
|
-
disallows_value_of(nil)
|
23
|
-
end
|
24
|
-
|
25
|
-
def description
|
26
|
-
"should accept only boolean true or false values"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def validate_truthfulness_of(truthteller)
|
31
|
-
TruthfulnessMatcher.new(truthteller)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Rspectacular
|
2
|
-
module Matchers
|
3
|
-
module Authentication
|
4
|
-
def it_should_require_authentication_for(*actions)
|
5
|
-
actions.each do |action_parts|
|
6
|
-
method, action, params = action_parts
|
7
|
-
|
8
|
-
params ||= {}
|
9
|
-
params.reverse_merge! :id => 1
|
10
|
-
|
11
|
-
it "#{method.upcase} ##{action} should require login" do
|
12
|
-
send(method, action, params)
|
13
|
-
|
14
|
-
response.should redirect_to(new_user_session_path)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def it_should_not_require_authentication_for(*actions)
|
20
|
-
actions.each do |action_parts|
|
21
|
-
method, action, params = action_parts
|
22
|
-
|
23
|
-
params ||= {}
|
24
|
-
params.reverse_merge! :id => 1
|
25
|
-
|
26
|
-
it "#{method.upcase} ##{action} should not require login" do
|
27
|
-
send(method, action, params)
|
28
|
-
|
29
|
-
response.should_not redirect_to(new_user_session_path)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
RSpec.configure do |config|
|
38
|
-
config.extend Rspectacular::Matchers::Authentication, :type => :controller
|
39
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
##############################################################################
|
2
|
-
# Capybara Plugin
|
3
|
-
##############################################################################
|
4
|
-
#
|
5
|
-
# This plugin does not attempt to require capybara. It assumes that if you're
|
6
|
-
# using capybara, you're probably using something like Bundler which has already
|
7
|
-
# required it for you.
|
8
|
-
#
|
9
|
-
# If this is not the case, you will need to require it prior to requiring
|
10
|
-
# rspectacular.
|
11
|
-
#
|
12
|
-
# The same goes for capybara-webkit. It must be required before rspectacular.
|
13
|
-
#
|
14
|
-
begin
|
15
|
-
require 'capybara/rspec'
|
16
|
-
require 'capybara/rails'
|
17
|
-
|
18
|
-
if defined?(Capybara::Driver::Base)
|
19
|
-
Capybara.register_driver :chrome do |app|
|
20
|
-
Capybara::Selenium::Driver.new(app, :browser => :chrome)
|
21
|
-
end
|
22
|
-
|
23
|
-
if defined?(Capybara::Webkit)
|
24
|
-
Capybara.javascript_driver = :webkit
|
25
|
-
else
|
26
|
-
Capybara.javascript_driver = :selenium
|
27
|
-
end
|
28
|
-
|
29
|
-
RSpec.configure do |config|
|
30
|
-
config.before(:each, :js => true) do
|
31
|
-
page.driver.reset!
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
Capybara.configure do |config|
|
36
|
-
config.match = :prefer_exact
|
37
|
-
config.ignore_hidden_elements = true
|
38
|
-
config.visible_text_only = true
|
39
|
-
end
|
40
|
-
|
41
|
-
if defined?(Chamber)
|
42
|
-
Capybara.default_host = Chamber.env.http.host_with_port
|
43
|
-
Capybara.app_host = Chamber.env.http.base_url
|
44
|
-
Capybara.server_port = Chamber.env.http.port
|
45
|
-
end
|
46
|
-
end
|
47
|
-
rescue LoadError
|
48
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
##############################################################################
|
2
|
-
# PayPal Plugin
|
3
|
-
##############################################################################
|
4
|
-
|
5
|
-
RSpec.configure do |config|
|
6
|
-
config.before(:each, :js => true, :paypal => true) do
|
7
|
-
require 'rspectacular/helpers/paypal'
|
8
|
-
|
9
|
-
log_in_to_paypal_sandbox
|
10
|
-
end
|
11
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require File.expand_path('../selectors/defaults', __FILE__)
|
2
|
-
|
3
|
-
def fsf(*args)
|
4
|
-
selector = sf(*args)
|
5
|
-
selector_format = selector.starts_with?('.//') ? :xpath : :css
|
6
|
-
|
7
|
-
page.find(selector_format, selector)
|
8
|
-
end
|
9
|
-
|
10
|
-
def idsf(*args)
|
11
|
-
id_selector = sf(*args)
|
12
|
-
id_selector.starts_with?('#') ? id_selector[1..-1] : id_selector
|
13
|
-
end
|
14
|
-
|
15
|
-
def sf(*args)
|
16
|
-
selector_description = args[0]
|
17
|
-
selector_entry = Rspectacular.selectors.find { |regex, selector| selector_description.match regex }
|
18
|
-
|
19
|
-
fail "Cannot find selector for '#{selector_description}'. Please add it to the list of selectors." if selector_entry.nil?
|
20
|
-
|
21
|
-
selector = selector_entry[1]
|
22
|
-
|
23
|
-
if selector.respond_to? :call
|
24
|
-
selector.call(*args)
|
25
|
-
else
|
26
|
-
selector
|
27
|
-
end
|
28
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
module Rspectacular
|
2
|
-
def self.selectors
|
3
|
-
default_selectors
|
4
|
-
end
|
5
|
-
|
6
|
-
def self.default_selectors
|
7
|
-
{
|
8
|
-
/the Facebook application/ => lambda do
|
9
|
-
frame_element = find 'html#facebook div#pagelet_app_runner iframe'
|
10
|
-
frame_element[:id]
|
11
|
-
end,
|
12
|
-
|
13
|
-
/the flash(.*)/ => lambda do |*args|
|
14
|
-
flash_type = args[0][/the flash(.*)/, 1]
|
15
|
-
flash_type_class = flash_type.strip
|
16
|
-
flash_type_class = flash_type_class.empty? ? '' : ".#{flash_type_class}"
|
17
|
-
|
18
|
-
".flash#{flash_type_class} p"
|
19
|
-
end,
|
20
|
-
|
21
|
-
###
|
22
|
-
# Facebook
|
23
|
-
#
|
24
|
-
/the Facebook login form/ => 'html#facebook form#login_form',
|
25
|
-
/the Facebook page timeline nav bar/ => 'html#facebook #fbTimelineNavTopRow',
|
26
|
-
/the Facebook account menu/ => '#navAccountLink',
|
27
|
-
|
28
|
-
###
|
29
|
-
# PayPal
|
30
|
-
#
|
31
|
-
/the "Pay with PayPal" button/ => 'input[alt="Check out with PayPal"]',
|
32
|
-
|
33
|
-
###
|
34
|
-
# Forms
|
35
|
-
#
|
36
|
-
/the errors for (.*)/ => lambda { "#{sf $1}+div.error" },
|
37
|
-
|
38
|
-
###
|
39
|
-
# Windows
|
40
|
-
#
|
41
|
-
/the most recently opened window/ => lambda { page.driver.browser.window_handles.last },
|
42
|
-
/the alert dialog/ => lambda { page.driver.browser.switch_to.alert },
|
43
|
-
|
44
|
-
###
|
45
|
-
# Date Picker Buttons
|
46
|
-
#
|
47
|
-
/the date picker button for today/ => '.ui-datepicker-today',
|
48
|
-
|
49
|
-
###
|
50
|
-
# Model Links
|
51
|
-
#
|
52
|
-
/the (.*) button for/ => lambda { "##{$1.gsub(/ /, '_')}_#{args[0].class.name.underscore}_#{args[0].id}_link" }
|
53
|
-
}
|
54
|
-
end
|
55
|
-
end
|