Skip to content

Instantly share code, notes, and snippets.

@timfong888
Last active October 12, 2015 22:23
Show Gist options
  • Save timfong888/8c7d3f8880bb90a17a79 to your computer and use it in GitHub Desktop.
Save timfong888/8c7d3f8880bb90a17a79 to your computer and use it in GitHub Desktop.
require_relative "../iron.io/refactor_bot_response"
require_relative "../iron.io/survey_class"
# http://jakegoulding.com/presentations/rspec-structure/#slide-32
# https://railsadventures.wordpress.com/2013/09/25/11-steps-to-make-your-rspec-specs-awesome/
# https://semaphoreci.com/community/tutorials/rspec-subject-helpers-hooks-and-exception-handling
RSpec.describe Survey do
describe "#new for a repeating survey for bot_client_id = x" do
bot_client_id = "x"
subject(:survey) {Survey.new(bot_client_id, repeating: true)}
context "user completed the survey" do
before {survey.completed(json_answers)}
it "receives json_answers"
it "has an instance variable @responses that is a Hash" do
expect(survey.responses).to be_a(Hash)
end
it "creates a hash that corresponds to the json_answers blob"
end
end
describe "#calculate_score(score_method)" do
context "a score needs to be calculated using method = pam_score" do
it "accepts a score_method called pam_score" do
end
it "creates a @score instance variable with the score" do
expect(self.score).to eq(10)
end
it "converts a 'strongly disagree' response to value -1" do
end
it "converts a 'disagree' response to value 0" do
end
it "converts a 'agree' response to value 1"
it "adds them together"
end
end
describe "#score_as_predicate" do
context "AIML wants to access the score via predicate name 'score_predicate'" do
it "creates a predicate of the predicate name with the score for bot_client_id" do
let{:br} {BotResponse.new(bot_client_id, 'kaya what is my score_predicate', 'test')}
expect(br.outbound_text).to eq('your score_predicate is 10')
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment