Permalink
Browse files

const_get fails on a namespaced object.

  • Loading branch information...
1 parent 7d80ee1 commit 5263f6eb437f474b62da5eefc1f20ea9f714edd2 @aantix committed Jan 9, 2013
View
@@ -29,6 +29,7 @@ spec/dummy/tmp/
*.sassc
.rspec
.redcar/
+spec/dummy/log/*.log
.sass-cache
/config/config.yml
/config/database.yml
View
@@ -4,6 +4,7 @@ PATH
udd: User Driven Development (0.0.1)
localtunnel
rails (~> 3.2.9)
+ rturk
turkee
GEM
View
@@ -1,6 +1,6 @@
module Udd
class Test < ActiveRecord::Base
- attr_accessible :task
+ attr_accessible :task, :url
belongs_to :task, :class_name => "Turkee::TurkeeTask"
end
end
View
@@ -12,13 +12,17 @@ def initialize
def run(test)
create_tunnel
- turkee_task = Turkee::TurkeeTask.create_hit(@tunnel['host'], test["title"], test["description"], nil,
+ turkee_task = Turkee::TurkeeTask.create_hit(host, test["title"], test["description"], "Udd::Test".constantize,
NUM_ASSIGNMENTS, test["reward"], LIFETIME, DURATION,
{}, {}, {:form_url => test['url']})
Test.create!(:url => test['url'], :task => turkee_task)
end
+ def host
+ @tunnel['host']
+ end
+
def create_tunnel
@tunnel = LocalTunnel::Tunnel.new(3000, nil)
@tunnel.register_tunnel
@@ -1,6 +1,7 @@
# Go to this page https://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key
# to retrieve your AWS/Mechanical Turk access keys.
+require "rturk"
AWSACCESSKEYID = 'XXXXXXXXXXXXXXXXXX'
AWSSECRETACCESSKEY = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYY'

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,96 +0,0 @@
-Connecting to database specified by database.yml
-  (2.1ms) select sqlite_version(*)
-  (0.3ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
-Connecting to database specified by database.yml
-  (1.5ms) select sqlite_version(*)
-  (0.7ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
-Connecting to database specified by database.yml
-  (1.4ms) select sqlite_version(*)
-  (0.3ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
-Connecting to database specified by database.yml
-  (1.6ms) select sqlite_version(*)
-  (0.3ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.0ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
-Connecting to database specified by database.yml
-  (1.6ms) select sqlite_version(*)
-  (0.3ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.0ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
-Connecting to database specified by database.yml
-  (1.6ms) select sqlite_version(*)
-  (0.3ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
-Connecting to database specified by database.yml
-  (2.3ms) select sqlite_version(*)
-  (0.3ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.0ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
-Connecting to database specified by database.yml
-  (1.5ms) select sqlite_version(*)
-  (0.3ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
-Connecting to database specified by database.yml
-  (1.6ms) select sqlite_version(*)
-  (0.3ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.1ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
-Connecting to database specified by database.yml
-  (1.6ms) select sqlite_version(*)
-  (0.3ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.0ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
-Connecting to database specified by database.yml
-  (1.6ms) select sqlite_version(*)
-  (0.3ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.0ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
-Connecting to database specified by database.yml
-  (1.5ms) select sqlite_version(*)
-  (0.3ms) CREATE TABLE "turkee_tasks" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "hit_url" varchar(255), "sandbox" boolean, "task_type" varchar(255), "hit_title" text, "hit_description" text, "hit_id" varchar(255), "hit_reward" decimal(10,2), "hit_num_assignments" integer, "hit_lifetime" integer, "form_url" varchar(255), "completed_assignments" integer DEFAULT 0, "complete" boolean, "expired" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "turkee_flow_id" integer, "hit_duration" integer)
-  (0.1ms) CREATE TABLE "surveys" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "answer" varchar(255)) 
-  (0.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
-  (0.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
-  (0.0ms) SELECT version FROM "schema_migrations"
-  (0.0ms) INSERT INTO "schema_migrations" (version) VALUES ('1')
@@ -10,7 +10,8 @@
end
it "creates the appropriate HIT (turkee task) and Test" do
- Turkee::TurkeeTask.expects(:create_hit).once
+ #Turkee::TurkeeTask.expects(:create_hit).once
+ @creator.stubs(:host).returns("http://abc123.localtunnel.io")
@creator.expects(:create_tunnel).once
@creator.run(@test)
View
@@ -8,37 +8,8 @@
require 'active_record'
require 'rake'
-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
-ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
-ActiveRecord::Schema.define(:version => 1) do
- create_table :turkee_tasks do |t|
- t.string "hit_url"
- t.boolean "sandbox"
- t.string "task_type"
- t.text "hit_title"
- t.text "hit_description"
- t.string "hit_id"
- t.decimal "hit_reward", :precision => 10, :scale => 2
- t.integer "hit_num_assignments"
- t.integer "hit_lifetime"
- t.string "form_url"
- t.integer "completed_assignments", :default => 0
- t.boolean "complete"
- t.boolean "expired"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "turkee_flow_id"
- t.integer "hit_duration"
- end
-
- create_table :surveys do |t|
- t.string :answer
- end
-end
-
-
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
View
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
s.add_dependency "rails", "~> 3.2.9"
s.add_dependency "turkee"
+ s.add_dependency "rturk"
s.add_dependency "localtunnel"
# s.add_dependency "jquery-rails"

0 comments on commit 5263f6e

Please sign in to comment.