conversational 0.3.2 → 0.4.0
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/.gitignore +4 -7
- data/Gemfile +4 -0
- data/Gemfile.lock +32 -0
- data/README.markdown +23 -177
- data/Rakefile +6 -35
- data/conversational.gemspec +19 -69
- data/lib/conversational/conversation.rb +177 -98
- data/lib/conversational/version.rb +4 -0
- data/lib/conversational.rb +2 -3
- data/spec/conversation_spec.rb +188 -20
- data/spec/spec_helper.rb +3 -23
- metadata +76 -78
- data/VERSION +0 -1
- data/features/configure_blank_topic.feature +0 -9
- data/features/configure_exclusion_conversations.feature +0 -20
- data/features/configure_unknown_topic.feature +0 -9
- data/features/find_existing_conversation.feature +0 -21
- data/features/find_or_create_with.feature +0 -33
- data/features/retrieve_conversation_details.feature +0 -13
- data/features/step_definitions/conversation_steps.rb +0 -60
- data/features/step_definitions/pickle_steps.rb +0 -87
- data/features/support/conversation.rb +0 -2
- data/features/support/email_spec.rb +0 -1
- data/features/support/env.rb +0 -58
- data/features/support/mail.rb +0 -6
- data/features/support/paths.rb +0 -33
- data/features/support/pickle.rb +0 -24
- data/features/support/sample_conversation.rb +0 -3
- data/lib/conversational/active_record_additions.rb +0 -121
- data/lib/conversational/conversation_definition.rb +0 -98
- data/lib/generators/conversational/migration/USAGE +0 -5
- data/lib/generators/conversational/migration/migration_generator.rb +0 -23
- data/lib/generators/conversational/migration/templates/migration.rb +0 -14
- data/lib/generators/conversational/skeleton/USAGE +0 -6
- data/lib/generators/conversational/skeleton/skeleton_generator.rb +0 -17
- data/lib/generators/conversational/skeleton/templates/conversation.rb +0 -3
- data/spec/active_record_additions_spec.rb +0 -120
- data/spec/conversation_definition_spec.rb +0 -248
- data/spec/support/conversation.rb +0 -3
metadata
CHANGED
@@ -1,103 +1,101 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: conversational
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 3
|
8
|
-
- 2
|
9
|
-
version: 0.3.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- David Wilkie
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
date: 2011-09-15 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: &78477010 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *78477010
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: i18n
|
27
|
+
requirement: &78476800 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *78476800
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &78476580 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *78476580
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: simplecov
|
49
|
+
requirement: &78476370 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *78476370
|
58
|
+
description: Allows you to instansiate conversations based on keywords
|
59
|
+
email:
|
60
|
+
- dwilkie@gmail.com
|
23
61
|
executables: []
|
24
|
-
|
25
62
|
extensions: []
|
26
|
-
|
27
|
-
|
28
|
-
- README.markdown
|
29
|
-
files:
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
30
65
|
- .gitignore
|
66
|
+
- Gemfile
|
67
|
+
- Gemfile.lock
|
31
68
|
- MIT-LICENSE
|
32
69
|
- README.markdown
|
33
70
|
- Rakefile
|
34
|
-
- VERSION
|
35
71
|
- conversational.gemspec
|
36
|
-
- features/configure_blank_topic.feature
|
37
|
-
- features/configure_exclusion_conversations.feature
|
38
|
-
- features/configure_unknown_topic.feature
|
39
|
-
- features/find_existing_conversation.feature
|
40
|
-
- features/find_or_create_with.feature
|
41
|
-
- features/retrieve_conversation_details.feature
|
42
|
-
- features/step_definitions/conversation_steps.rb
|
43
|
-
- features/step_definitions/pickle_steps.rb
|
44
|
-
- features/support/conversation.rb
|
45
|
-
- features/support/email_spec.rb
|
46
|
-
- features/support/env.rb
|
47
|
-
- features/support/mail.rb
|
48
|
-
- features/support/paths.rb
|
49
|
-
- features/support/pickle.rb
|
50
|
-
- features/support/sample_conversation.rb
|
51
72
|
- lib/conversational.rb
|
52
|
-
- lib/conversational/active_record_additions.rb
|
53
73
|
- lib/conversational/conversation.rb
|
54
|
-
- lib/conversational/
|
55
|
-
- lib/generators/conversational/migration/USAGE
|
56
|
-
- lib/generators/conversational/migration/migration_generator.rb
|
57
|
-
- lib/generators/conversational/migration/templates/migration.rb
|
58
|
-
- lib/generators/conversational/skeleton/USAGE
|
59
|
-
- lib/generators/conversational/skeleton/skeleton_generator.rb
|
60
|
-
- lib/generators/conversational/skeleton/templates/conversation.rb
|
61
|
-
- spec/active_record_additions_spec.rb
|
62
|
-
- spec/conversation_definition_spec.rb
|
74
|
+
- lib/conversational/version.rb
|
63
75
|
- spec/conversation_spec.rb
|
64
76
|
- spec/spec_helper.rb
|
65
|
-
|
66
|
-
has_rdoc: true
|
67
|
-
homepage: http://github.com/dwilkie/conversational
|
77
|
+
homepage: ''
|
68
78
|
licenses: []
|
69
|
-
|
70
79
|
post_install_message:
|
71
|
-
rdoc_options:
|
72
|
-
|
73
|
-
require_paths:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
74
82
|
- lib
|
75
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
84
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
|
81
|
-
|
82
|
-
version: "0"
|
83
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
90
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
- 0
|
90
|
-
version: "0"
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
91
95
|
requirements: []
|
92
|
-
|
93
|
-
|
94
|
-
rubygems_version: 1.3.7
|
96
|
+
rubyforge_project: conversational
|
97
|
+
rubygems_version: 1.8.5
|
95
98
|
signing_key:
|
96
99
|
specification_version: 3
|
97
|
-
summary: Have
|
98
|
-
test_files:
|
99
|
-
- spec/conversation_spec.rb
|
100
|
-
- spec/active_record_additions_spec.rb
|
101
|
-
- spec/conversation_definition_spec.rb
|
102
|
-
- spec/spec_helper.rb
|
103
|
-
- spec/support/conversation.rb
|
100
|
+
summary: Have topic based conversations
|
101
|
+
test_files: []
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.2
|
@@ -1,9 +0,0 @@
|
|
1
|
-
Feature: Specify a blank conversation topic template
|
2
|
-
In order to converse when the topic is blank
|
3
|
-
As a Conversation user
|
4
|
-
I want to be able to specify a conversation template to use when the topic is blank
|
5
|
-
|
6
|
-
Scenario: Specify a blank conversation topic
|
7
|
-
Given I configured Conversation with the following: Conversation.blank_topic_subclass = SampleConversation
|
8
|
-
When I start up a conversation with an blank topic
|
9
|
-
Then the conversation details should be a SampleConversation
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Feature: Configure exclusion conversations
|
2
|
-
In order to allow conversations to exist in a project that should not be found
|
3
|
-
when using Conversation.details or Conversation.find_or_create_with
|
4
|
-
As a Conversation user
|
5
|
-
I want to be able to configure which conversations should be excluded
|
6
|
-
|
7
|
-
Scenario Outline: Configure exclusion conversations
|
8
|
-
Given I configured Conversation with the following: <configuration>
|
9
|
-
And a conversation exists with topic: "sample", with: "someone@example.com"
|
10
|
-
Then the conversation details should be nil
|
11
|
-
|
12
|
-
Examples:
|
13
|
-
| configuration |
|
14
|
-
| Conversation.exclude [SampleConversation] |
|
15
|
-
| Conversation.exclude SampleConversation |
|
16
|
-
| Conversation.exclude "sample_conversation" |
|
17
|
-
| Conversation.exclude "SampleConversation" |
|
18
|
-
| Conversation.exclude :sample_conversation |
|
19
|
-
| Conversation.exclude /sample/i |
|
20
|
-
| Conversation.exclude [/sample/, "sample_conversation", SampleConversation] |
|
@@ -1,9 +0,0 @@
|
|
1
|
-
Feature: Specify an unknown conversation topic template
|
2
|
-
In order to converse when the topic is unknown
|
3
|
-
As a Conversation user
|
4
|
-
I want to be able to specify a conversation template to use when the topic is unknown
|
5
|
-
|
6
|
-
Scenario: Specify an unknown conversation topic
|
7
|
-
Given I configured Conversation with the following: Conversation.unknown_topic_subclass = SampleConversation
|
8
|
-
When I start up a conversation with an unknown topic
|
9
|
-
Then the conversation details should be a SampleConversation
|
@@ -1,21 +0,0 @@
|
|
1
|
-
Feature: Find existing conversations
|
2
|
-
In order to find an active conversation with a user
|
3
|
-
As a Conversation user
|
4
|
-
I want to be able to find the conversation easily
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given a conversation exists with topic: "sample", with: "someone@example.com"
|
8
|
-
|
9
|
-
Scenario: Find an open conversation updated within the last 24 hours
|
10
|
-
Given 23 hours have elapsed since the conversation was last updated
|
11
|
-
Then I should be able to find a conversation with: "someone@example.com"
|
12
|
-
|
13
|
-
Scenario: Find an open conversation updated more than that 24 hours
|
14
|
-
Given 24 hours have elapsed since the conversation was last updated
|
15
|
-
Then I should not be able to find a conversation with: "someone@example.com"
|
16
|
-
|
17
|
-
Scenario: Find a finished conversation
|
18
|
-
Given 1 hour has elapsed since the conversation was last updated
|
19
|
-
And the conversation is finished
|
20
|
-
Then I should not be able to find a conversation with: "someone@example.com"
|
21
|
-
|
@@ -1,33 +0,0 @@
|
|
1
|
-
Feature: Find existing conversation or create a new one
|
2
|
-
In order to easily create a new conversation if an existing one cannot be found
|
3
|
-
As a Conversation user
|
4
|
-
I want to be able to call find_or_create_with supplying who with and the topic
|
5
|
-
|
6
|
-
Scenario: No conversations exist
|
7
|
-
Given no conversations exist with: "someone"
|
8
|
-
When I call find_or_create_with("someone", "sample")
|
9
|
-
Then a conversation should exist with topic: "sample", with: "someone"
|
10
|
-
|
11
|
-
Scenario: A recent conversation exists
|
12
|
-
Given a conversation exists with topic: "sample", with: "someone"
|
13
|
-
When I call find_or_create_with("someone", "sample")
|
14
|
-
Then 1 conversations should exist
|
15
|
-
|
16
|
-
Scenario: An old conversation exists
|
17
|
-
Given a conversation exists with topic: "sample", with: "someone"
|
18
|
-
And 24 hours have elapsed since the conversation was last updated
|
19
|
-
When I call find_or_create_with("someone", "sample")
|
20
|
-
Then 2 conversations should exist
|
21
|
-
|
22
|
-
Scenario: An finished conversation exists
|
23
|
-
Given a conversation exists with topic: "sample", with: "someone"
|
24
|
-
And the conversation is finished
|
25
|
-
When I call find_or_create_with("someone", "sample")
|
26
|
-
Then 2 conversations should exist
|
27
|
-
|
28
|
-
Scenario: No conversation exists and the subclass has been excluded
|
29
|
-
Given a conversation exists with topic: "sample", with: "someone"
|
30
|
-
And I configured Conversation with the following: Conversation.exclude [SampleConversation]
|
31
|
-
When I call find_or_create_with("someone", "sample")
|
32
|
-
Then 1 conversations should exist
|
33
|
-
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: Get the conversation specifics
|
2
|
-
In order to get the specific conversation based on the topic and then move it along
|
3
|
-
As a Conversation user
|
4
|
-
I want to be able to get the specific conversation from the general one based off the topic
|
5
|
-
|
6
|
-
Scenario: Get the details from a conversation instance
|
7
|
-
Given a conversation exists with topic: "sample", with: "someone@example.com"
|
8
|
-
Then the conversation details should be a SampleConversation
|
9
|
-
|
10
|
-
Scenario: Get the details from a conversation instance
|
11
|
-
Given a conversation exists with topic: "sample", with: "someone@example.com"
|
12
|
-
And I configured Conversation with the following: Conversation.exclude [SampleConversation]
|
13
|
-
Then conversation.details(:include_all => true) should be a SampleConversation
|
@@ -1,60 +0,0 @@
|
|
1
|
-
Given /^(an|\d+) hours? (?:has|have) elapsed since #{capture_model} was last updated$/ do |time, conversation|
|
2
|
-
conversation = model!(conversation)
|
3
|
-
time = parse_email_count(time)
|
4
|
-
Conversation.record_timestamps = false
|
5
|
-
conversation.updated_at = time.hours.ago
|
6
|
-
conversation.save!
|
7
|
-
Conversation.record_timestamps = true
|
8
|
-
end
|
9
|
-
|
10
|
-
Given /^#{capture_model} is (.+)$/ do |conversation, state|
|
11
|
-
conversation = model!(conversation)
|
12
|
-
conversation.state = state
|
13
|
-
conversation.save!
|
14
|
-
end
|
15
|
-
|
16
|
-
Given /^no conversations exist with: "([^\"]*)"/ do |with|
|
17
|
-
find_models("conversation", "with: \"#{with}\"").each do |instance|
|
18
|
-
instance.destroy
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
Given /^I configured Conversation with the following: (.+)$/ do |configuration|
|
23
|
-
instance_eval(configuration)
|
24
|
-
end
|
25
|
-
|
26
|
-
When /^I start a new conversation(?: with #{capture_fields})?$/ do |fields|
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
When /^I call find_or_create_with\("([^\"]*)", "([^\"]*)"\)$/ do |with, topic|
|
31
|
-
Conversation.find_or_create_with(with, topic)
|
32
|
-
end
|
33
|
-
|
34
|
-
When /^I start up a conversation with an? (blank|unknown) topic$/ do |template_type|
|
35
|
-
topic = ""
|
36
|
-
topic = "unknown" if template_type == "unknown"
|
37
|
-
Given "a conversation exists with topic: \"#{topic}\", with: \"someone\""
|
38
|
-
end
|
39
|
-
|
40
|
-
Then /^the conversation details should be a (\w+)$/ do |template_name|
|
41
|
-
model!("conversation").details.class.should == template_name.constantize
|
42
|
-
end
|
43
|
-
|
44
|
-
Then /^I should (not )?be able to find a conversation with: "([^\"]*)"$/ do |negative, with|
|
45
|
-
conversation = Conversation.with(with).last
|
46
|
-
unless negative
|
47
|
-
conversation.should == model!("conversation")
|
48
|
-
else
|
49
|
-
conversation.should be_nil
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
Then /^#{capture_model} details should (?:be|have) (?:an? )?#{capture_predicate}$/ do |name, predicate|
|
54
|
-
model!(name).details.should send("be_#{predicate.gsub(' ', '_')}")
|
55
|
-
end
|
56
|
-
|
57
|
-
Then /^conversation\.details\(:include_all => true\) should be a SampleConversation$/ do
|
58
|
-
model!("conversation").details(:include_all => true).class.should == SampleConversation
|
59
|
-
end
|
60
|
-
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# this file generated by script/generate pickle
|
2
|
-
|
3
|
-
# create a model
|
4
|
-
Given(/^#{capture_model} exists?(?: with #{capture_fields})?$/) do |name, fields|
|
5
|
-
create_model(name, fields)
|
6
|
-
end
|
7
|
-
|
8
|
-
# create n models
|
9
|
-
Given(/^(\d+) #{capture_plural_factory} exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
|
10
|
-
count.to_i.times { create_model(plural_factory.singularize, fields) }
|
11
|
-
end
|
12
|
-
|
13
|
-
# create models from a table
|
14
|
-
Given(/^the following #{capture_plural_factory} exists?:?$/) do |plural_factory, table|
|
15
|
-
create_models_from_table(plural_factory, table)
|
16
|
-
end
|
17
|
-
|
18
|
-
# find a model
|
19
|
-
Then(/^#{capture_model} should exist(?: with #{capture_fields})?$/) do |name, fields|
|
20
|
-
find_model!(name, fields)
|
21
|
-
end
|
22
|
-
|
23
|
-
# not find a model
|
24
|
-
Then(/^#{capture_model} should not exist(?: with #{capture_fields})?$/) do |name, fields|
|
25
|
-
find_model(name, fields).should be_nil
|
26
|
-
end
|
27
|
-
|
28
|
-
# find models with a table
|
29
|
-
Then(/^the following #{capture_plural_factory} should exists?:?$/) do |plural_factory, table|
|
30
|
-
find_models_from_table(plural_factory, table).should_not be_any(&:nil?)
|
31
|
-
end
|
32
|
-
|
33
|
-
# find exactly n models
|
34
|
-
Then(/^(\d+) #{capture_plural_factory} should exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
|
35
|
-
find_models(plural_factory.singularize, fields).size.should == count.to_i
|
36
|
-
end
|
37
|
-
|
38
|
-
# assert equality of models
|
39
|
-
Then(/^#{capture_model} should be #{capture_model}$/) do |a, b|
|
40
|
-
model!(a).should == model!(b)
|
41
|
-
end
|
42
|
-
|
43
|
-
# assert model is in another model's has_many assoc
|
44
|
-
Then(/^#{capture_model} should be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
45
|
-
model!(owner).send(association).should include(model!(target))
|
46
|
-
end
|
47
|
-
|
48
|
-
# assert model is not in another model's has_many assoc
|
49
|
-
Then(/^#{capture_model} should not be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
50
|
-
model!(owner).send(association).should_not include(model!(target))
|
51
|
-
end
|
52
|
-
|
53
|
-
# assert model is another model's has_one/belongs_to assoc
|
54
|
-
Then(/^#{capture_model} should be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
55
|
-
model!(owner).send(association).should == model!(target)
|
56
|
-
end
|
57
|
-
|
58
|
-
# assert model is not another model's has_one/belongs_to assoc
|
59
|
-
Then(/^#{capture_model} should not be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
|
60
|
-
model!(owner).send(association).should_not == model!(target)
|
61
|
-
end
|
62
|
-
|
63
|
-
# assert model.predicate?
|
64
|
-
Then(/^#{capture_model} should (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
|
65
|
-
model!(name).should send("be_#{predicate.gsub(' ', '_')}")
|
66
|
-
end
|
67
|
-
|
68
|
-
# assert not model.predicate?
|
69
|
-
Then(/^#{capture_model} should not (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
|
70
|
-
model!(name).should_not send("be_#{predicate.gsub(' ', '_')}")
|
71
|
-
end
|
72
|
-
|
73
|
-
# model.attribute.should eql(value)
|
74
|
-
# model.attribute.should_not eql(value)
|
75
|
-
Then(/^#{capture_model}'s (\w+) (should(?: not)?) be #{capture_value}$/) do |name, attribute, expectation, expected|
|
76
|
-
actual_value = model(name).send(attribute)
|
77
|
-
expectation = expectation.gsub(' ', '_')
|
78
|
-
|
79
|
-
case expected
|
80
|
-
when 'nil', 'true', 'false'
|
81
|
-
actual_value.send(expectation, send("be_#{expected}"))
|
82
|
-
when /^-?[0-9_]+$/
|
83
|
-
actual_value.send(expectation, eql(expected.to_i))
|
84
|
-
else
|
85
|
-
actual_value.to_s.send(expectation, eql(expected))
|
86
|
-
end
|
87
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'email_spec/cucumber'
|
data/features/support/env.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
-
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
-
# files.
|
6
|
-
|
7
|
-
ENV["RAILS_ENV"] ||= "test"
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
9
|
-
|
10
|
-
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
|
11
|
-
require 'cucumber/rails/rspec'
|
12
|
-
require 'cucumber/rails/world'
|
13
|
-
require 'cucumber/rails/active_record'
|
14
|
-
require 'cucumber/web/tableish'
|
15
|
-
|
16
|
-
require 'capybara/rails'
|
17
|
-
require 'capybara/cucumber'
|
18
|
-
require 'capybara/session'
|
19
|
-
require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
|
20
|
-
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
21
|
-
# order to ease the transition to Capybara we set the default here. If you'd
|
22
|
-
# prefer to use XPath just remove this line and adjust any selectors in your
|
23
|
-
# steps to use the XPath syntax.
|
24
|
-
Capybara.default_selector = :css
|
25
|
-
|
26
|
-
# If you set this to false, any error raised from within your app will bubble
|
27
|
-
# up to your step definition and out to cucumber unless you catch it somewhere
|
28
|
-
# on the way. You can make Rails rescue errors and render error pages on a
|
29
|
-
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
|
30
|
-
#
|
31
|
-
# If you set this to true, Rails will rescue all errors and render error
|
32
|
-
# pages, more or less in the same way your application would behave in the
|
33
|
-
# default production environment. It's not recommended to do this for all
|
34
|
-
# of your scenarios, as this makes it hard to discover errors in your application.
|
35
|
-
ActionController::Base.allow_rescue = false
|
36
|
-
|
37
|
-
# If you set this to true, each scenario will run in a database transaction.
|
38
|
-
# You can still turn off transactions on a per-scenario basis, simply tagging
|
39
|
-
# a feature or scenario with the @no-txn tag. If you are using Capybara,
|
40
|
-
# tagging with @culerity or @javascript will also turn transactions off.
|
41
|
-
#
|
42
|
-
# If you set this to false, transactions will be off for all scenarios,
|
43
|
-
# regardless of whether you use @no-txn or not.
|
44
|
-
#
|
45
|
-
# Beware that turning transactions off will leave data in your database
|
46
|
-
# after each scenario, which can lead to hard-to-debug failures in
|
47
|
-
# subsequent scenarios. If you do this, we recommend you create a Before
|
48
|
-
# block that will explicitly put your database in a known state.
|
49
|
-
Cucumber::Rails::World.use_transactional_fixtures = true
|
50
|
-
# How to clean your database when transactions are turned off. See
|
51
|
-
# http://github.com/bmabey/database_cleaner for more info.
|
52
|
-
if defined?(ActiveRecord::Base)
|
53
|
-
begin
|
54
|
-
require 'database_cleaner'
|
55
|
-
DatabaseCleaner.strategy = :truncation
|
56
|
-
rescue LoadError => ignore_if_database_cleaner_not_present
|
57
|
-
end
|
58
|
-
end
|
data/features/support/mail.rb
DELETED
data/features/support/paths.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
module NavigationHelpers
|
2
|
-
# Maps a name to a path. Used by the
|
3
|
-
#
|
4
|
-
# When /^I go to (.+)$/ do |page_name|
|
5
|
-
#
|
6
|
-
# step definition in web_steps.rb
|
7
|
-
#
|
8
|
-
def path_to(page_name)
|
9
|
-
case page_name
|
10
|
-
|
11
|
-
when /the home\s?page/
|
12
|
-
'/'
|
13
|
-
|
14
|
-
# Add more mappings here.
|
15
|
-
# Here is an example that pulls values out of the Regexp:
|
16
|
-
#
|
17
|
-
# when /^(.*)'s profile page$/i
|
18
|
-
# user_profile_path(User.find_by_login($1))
|
19
|
-
|
20
|
-
else
|
21
|
-
begin
|
22
|
-
page_name =~ /the (.*) page/
|
23
|
-
path_components = $1.split(/\s+/)
|
24
|
-
self.send(path_components.push('path').join('_').to_sym)
|
25
|
-
rescue Object => e
|
26
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
27
|
-
"Now, go and add a mapping in #{__FILE__}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
World(NavigationHelpers)
|
data/features/support/pickle.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# this file generated by script/generate pickle [paths] [email]
|
2
|
-
#
|
3
|
-
# Make sure that you are loading your factory of choice in your cucumber environment
|
4
|
-
#
|
5
|
-
# For machinist add: features/support/machinist.rb
|
6
|
-
#
|
7
|
-
# require 'machinist/active_record' # or your chosen adaptor
|
8
|
-
# require File.dirname(__FILE__) + '/../../spec/blueprints' # or wherever your blueprints are
|
9
|
-
# Before { Sham.reset } # to reset Sham's seed between scenarios so each run has same random sequences
|
10
|
-
#
|
11
|
-
# For FactoryGirl add: features/support/factory_girl.rb
|
12
|
-
#
|
13
|
-
# require 'factory_girl'
|
14
|
-
# require File.dirname(__FILE__) + '/../../spec/factories' # or wherever your factories are
|
15
|
-
#
|
16
|
-
# You may also need to add gem dependencies on your factory of choice in <tt>config/environments/cucumber.rb</tt>
|
17
|
-
|
18
|
-
require 'pickle/world'
|
19
|
-
# Example of configuring pickle:
|
20
|
-
#
|
21
|
-
# Pickle.configure do |config|
|
22
|
-
# config.adapters = [:machinist]
|
23
|
-
# config.map 'I', 'myself', 'me', 'my', :to => 'user: "me"'
|
24
|
-
# end
|