lopata 0.1.1 → 0.1.6
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.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/exe/lopata +1 -1
- data/lib/lopata.rb +54 -1
- data/lib/lopata/active_record.rb +99 -0
- data/lib/lopata/condition.rb +2 -3
- data/lib/lopata/configuration.rb +126 -0
- data/lib/lopata/environment.rb +36 -0
- data/lib/lopata/factory_bot.rb +36 -0
- data/lib/lopata/generators/app.rb +0 -2
- data/lib/lopata/generators/templates/Gemfile +0 -2
- data/lib/lopata/generators/templates/config/environments/qa.yml +0 -1
- data/lib/lopata/observers/backtrace_formatter.rb +103 -0
- data/lib/lopata/observers/base_observer.rb +17 -6
- data/lib/lopata/observers/console_output_observer.rb +63 -26
- data/lib/lopata/observers/web_logger.rb +57 -59
- data/lib/lopata/role.rb +46 -0
- data/lib/lopata/runner.rb +18 -17
- data/lib/lopata/scenario.rb +94 -34
- data/lib/lopata/scenario_builder.rb +62 -73
- data/lib/lopata/shared_step.rb +10 -4
- data/lib/lopata/step.rb +143 -44
- data/lib/lopata/version.rb +1 -1
- data/lib/lopata/world.rb +3 -1
- metadata +10 -10
- data/lib/lopata/config.rb +0 -101
- data/lib/lopata/generators/templates/.rspec +0 -3
- data/lib/lopata/generators/templates/spec/spec_helper.rb +0 -2
- data/lib/lopata/rspec/ar_dsl.rb +0 -38
- data/lib/lopata/rspec/dsl.rb +0 -39
- data/lib/lopata/rspec/role.rb +0 -75
data/lib/lopata/rspec/dsl.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
module Lopata
|
2
|
-
module RSpec
|
3
|
-
module DSL
|
4
|
-
def self.included(base)
|
5
|
-
base.extend(ClassMethods)
|
6
|
-
end
|
7
|
-
|
8
|
-
module ClassMethods
|
9
|
-
def action *contexts, &block
|
10
|
-
contexts.each do |context|
|
11
|
-
if context.is_a?(Proc)
|
12
|
-
action(&context)
|
13
|
-
else
|
14
|
-
include_context context
|
15
|
-
end
|
16
|
-
end
|
17
|
-
before(:all, &block) if block_given?
|
18
|
-
end
|
19
|
-
|
20
|
-
def setup *contexts, &block
|
21
|
-
root_setup = false
|
22
|
-
unless @doing_setup
|
23
|
-
root_setup = true
|
24
|
-
@doing_setup = true
|
25
|
-
end
|
26
|
-
action *contexts, &block
|
27
|
-
if root_setup
|
28
|
-
# action Config.after_setup if Config.after_setup
|
29
|
-
@doing_setup = false
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def teardown &block
|
34
|
-
after(:all, &block) if block_given?
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/lib/lopata/rspec/role.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
module Lopata::RSpec::Role
|
2
|
-
def self.included(base)
|
3
|
-
base.extend(ClassMethods)
|
4
|
-
end
|
5
|
-
|
6
|
-
# Filter names
|
7
|
-
def self.filter_roles *names
|
8
|
-
allowed = Lopata::Config.only_roles
|
9
|
-
selected = names.flatten.select { |n| allowed.blank? || allowed.member?(n) }
|
10
|
-
# ENV['quick'] ? [selected.first] : selected
|
11
|
-
selected
|
12
|
-
end
|
13
|
-
|
14
|
-
# http://jorgemanrubia.net/2010/01/16/using-macros-to-create-custom-example-groups-in-rspec/
|
15
|
-
module ClassMethods
|
16
|
-
def as *names, &block
|
17
|
-
return if current_role && !Lopata::RSpec::Role.filter_roles(*names).include?(current_role)
|
18
|
-
if current_role
|
19
|
-
self.class_eval(&block)
|
20
|
-
else
|
21
|
-
Lopata::RSpec::Role.filter_roles(*names).each do |name|
|
22
|
-
example_group_class = describe role_description(name), :current_role => name do
|
23
|
-
instance_exec &Lopata::Config.after_as if Lopata::Config.after_as
|
24
|
-
define_method :current_role do
|
25
|
-
name
|
26
|
-
end
|
27
|
-
end
|
28
|
-
example_group_class.class_eval(&block)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def except(*names, &block)
|
34
|
-
raise "'expecpt' block must be neseted for 'as' block" unless current_role
|
35
|
-
return if names.include? current_role
|
36
|
-
self.class_eval(&block)
|
37
|
-
end
|
38
|
-
|
39
|
-
def current_role
|
40
|
-
metadata[:current_role]
|
41
|
-
end
|
42
|
-
|
43
|
-
# To be redefined in impelemntations so RSpec descriptions to be more verbal
|
44
|
-
def role_description(name)
|
45
|
-
Lopata::Config.role_descriptions[name] || name
|
46
|
-
end
|
47
|
-
|
48
|
-
def scenario(*args, &block)
|
49
|
-
raise "scenario required a name in first argument" unless args.first.is_a? String
|
50
|
-
example_group_class = describe(*args)
|
51
|
-
example_group_class.nested_with_as(*args, &block)
|
52
|
-
end
|
53
|
-
|
54
|
-
def nested_with_as(*args, &block)
|
55
|
-
if (args.last.is_a?(Hash) && args.last[:as])
|
56
|
-
roles = args.last[:as]
|
57
|
-
roles = [roles] unless roles.is_a?(Array)
|
58
|
-
class_eval { as(*roles, &block) }
|
59
|
-
else
|
60
|
-
class_eval(&block)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
module Lopata
|
67
|
-
# Adds the #scenario method to the top-level namespace.
|
68
|
-
def self.scenario(*args, &block)
|
69
|
-
raise "scenario required a name in first argument" unless args.first.is_a? String
|
70
|
-
example_group_class = RSpec.describe(*args)
|
71
|
-
example_group_class.nested_with_as(*args, &block)
|
72
|
-
# example_group_class.register
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|