cicloid-conversational 0.3.2.pre
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 +3 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +21 -0
- data/README.markdown +240 -0
- data/Rakefile +2 -0
- data/conversational.gemspec +22 -0
- data/features/configure_blank_topic.feature +9 -0
- data/features/configure_exclusion_conversations.feature +20 -0
- data/features/configure_unknown_topic.feature +9 -0
- data/features/find_existing_conversation.feature +21 -0
- data/features/find_or_create_with.feature +33 -0
- data/features/retrieve_conversation_details.feature +13 -0
- data/features/step_definitions/conversation_steps.rb +60 -0
- data/features/step_definitions/pickle_steps.rb +87 -0
- data/features/support/conversation.rb +2 -0
- data/features/support/email_spec.rb +1 -0
- data/features/support/env.rb +58 -0
- data/features/support/mail.rb +6 -0
- data/features/support/paths.rb +33 -0
- data/features/support/pickle.rb +24 -0
- data/features/support/sample_conversation.rb +3 -0
- data/lib/conversational.rb +3 -0
- data/lib/conversational/active_record_additions.rb +122 -0
- data/lib/conversational/conversation.rb +285 -0
- data/lib/conversational/version.rb +4 -0
- data/lib/generators/conversational/migration/USAGE +5 -0
- data/lib/generators/conversational/migration/migration_generator.rb +23 -0
- data/lib/generators/conversational/migration/templates/migration.rb +14 -0
- data/lib/generators/conversational/skeleton/USAGE +6 -0
- data/lib/generators/conversational/skeleton/skeleton_generator.rb +17 -0
- data/lib/generators/conversational/skeleton/templates/conversation.rb +3 -0
- data/spec/active_record_additions_spec.rb +120 -0
- data/spec/conversation_definition_spec.rb +248 -0
- data/spec/conversation_spec.rb +34 -0
- data/spec/spec_helper.rb +24 -0
- data/spec/support/conversation.rb +3 -0
- metadata +113 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Conversational::Conversation do
|
4
|
+
|
5
|
+
describe "#details" do
|
6
|
+
let(:conversation) { Class.new }
|
7
|
+
before {
|
8
|
+
conversation.extend(Conversational::Conversation)
|
9
|
+
conversation.stub!(:topic).and_return("something")
|
10
|
+
}
|
11
|
+
context "a subclass for this topic exists" do
|
12
|
+
let(:subclass) { mock("Subclass") }
|
13
|
+
before {
|
14
|
+
Conversational::ConversationDefinition.stub!(
|
15
|
+
:find_subclass_by_topic
|
16
|
+
).and_return(subclass)
|
17
|
+
}
|
18
|
+
it "should return the instance as a subclass" do
|
19
|
+
conversation.should_receive(:becomes).with(subclass)
|
20
|
+
conversation.details
|
21
|
+
end
|
22
|
+
end
|
23
|
+
context "a subclass for this topic does not exist" do
|
24
|
+
before {
|
25
|
+
Conversational::ConversationDefinition.stub!(
|
26
|
+
:find_subclass_by_topic
|
27
|
+
).and_return(nil)
|
28
|
+
}
|
29
|
+
it "should return nil" do
|
30
|
+
conversation.details.should be_nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
2
|
+
# from the project root directory.
|
3
|
+
ENV["RAILS_ENV"] ||= 'test'
|
4
|
+
require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails)
|
5
|
+
require 'rspec/rails'
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
+
|
11
|
+
Rspec.configure do |config|
|
12
|
+
# == Mock Framework
|
13
|
+
#
|
14
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
+
#
|
16
|
+
# config.mock_with :mocha
|
17
|
+
# config.mock_with :flexmock
|
18
|
+
# config.mock_with :rr
|
19
|
+
config.mock_with :rspec
|
20
|
+
|
21
|
+
# If you'd prefer not to run each of your examples within a transaction,
|
22
|
+
# uncomment the following line.
|
23
|
+
# config.use_transactional_examples = false
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cicloid-conversational
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: 6
|
5
|
+
version: 0.3.2.pre
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- David Wilkie
|
9
|
+
- "Gustavo Barr\xC3\xB3n"
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
|
14
|
+
date: 2011-02-25 00:00:00 -06:00
|
15
|
+
default_executable:
|
16
|
+
dependencies: []
|
17
|
+
|
18
|
+
description: Have stateful or stateless conversations based a topic
|
19
|
+
email:
|
20
|
+
- dwilkie@gmail.com
|
21
|
+
- cicloid@42fu.com
|
22
|
+
executables: []
|
23
|
+
|
24
|
+
extensions: []
|
25
|
+
|
26
|
+
extra_rdoc_files: []
|
27
|
+
|
28
|
+
files:
|
29
|
+
- .gitignore
|
30
|
+
- Gemfile
|
31
|
+
- MIT-LICENSE
|
32
|
+
- README.markdown
|
33
|
+
- Rakefile
|
34
|
+
- conversational.gemspec
|
35
|
+
- features/configure_blank_topic.feature
|
36
|
+
- features/configure_exclusion_conversations.feature
|
37
|
+
- features/configure_unknown_topic.feature
|
38
|
+
- features/find_existing_conversation.feature
|
39
|
+
- features/find_or_create_with.feature
|
40
|
+
- features/retrieve_conversation_details.feature
|
41
|
+
- features/step_definitions/conversation_steps.rb
|
42
|
+
- features/step_definitions/pickle_steps.rb
|
43
|
+
- features/support/conversation.rb
|
44
|
+
- features/support/email_spec.rb
|
45
|
+
- features/support/env.rb
|
46
|
+
- features/support/mail.rb
|
47
|
+
- features/support/paths.rb
|
48
|
+
- features/support/pickle.rb
|
49
|
+
- features/support/sample_conversation.rb
|
50
|
+
- lib/conversational.rb
|
51
|
+
- lib/conversational/active_record_additions.rb
|
52
|
+
- lib/conversational/conversation.rb
|
53
|
+
- lib/conversational/version.rb
|
54
|
+
- lib/generators/conversational/migration/USAGE
|
55
|
+
- lib/generators/conversational/migration/migration_generator.rb
|
56
|
+
- lib/generators/conversational/migration/templates/migration.rb
|
57
|
+
- lib/generators/conversational/skeleton/USAGE
|
58
|
+
- lib/generators/conversational/skeleton/skeleton_generator.rb
|
59
|
+
- lib/generators/conversational/skeleton/templates/conversation.rb
|
60
|
+
- spec/active_record_additions_spec.rb
|
61
|
+
- spec/conversation_definition_spec.rb
|
62
|
+
- spec/conversation_spec.rb
|
63
|
+
- spec/spec_helper.rb
|
64
|
+
- spec/support/conversation.rb
|
65
|
+
has_rdoc: true
|
66
|
+
homepage: ""
|
67
|
+
licenses: []
|
68
|
+
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.3.1
|
86
|
+
requirements: []
|
87
|
+
|
88
|
+
rubyforge_project: conversational
|
89
|
+
rubygems_version: 1.5.2
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: Have conversations based on topic
|
93
|
+
test_files:
|
94
|
+
- features/configure_blank_topic.feature
|
95
|
+
- features/configure_exclusion_conversations.feature
|
96
|
+
- features/configure_unknown_topic.feature
|
97
|
+
- features/find_existing_conversation.feature
|
98
|
+
- features/find_or_create_with.feature
|
99
|
+
- features/retrieve_conversation_details.feature
|
100
|
+
- features/step_definitions/conversation_steps.rb
|
101
|
+
- features/step_definitions/pickle_steps.rb
|
102
|
+
- features/support/conversation.rb
|
103
|
+
- features/support/email_spec.rb
|
104
|
+
- features/support/env.rb
|
105
|
+
- features/support/mail.rb
|
106
|
+
- features/support/paths.rb
|
107
|
+
- features/support/pickle.rb
|
108
|
+
- features/support/sample_conversation.rb
|
109
|
+
- spec/active_record_additions_spec.rb
|
110
|
+
- spec/conversation_definition_spec.rb
|
111
|
+
- spec/conversation_spec.rb
|
112
|
+
- spec/spec_helper.rb
|
113
|
+
- spec/support/conversation.rb
|