Permalink
Browse files

Fixing active_wrapper inclusion in rakefile, fake data spec working

  • Loading branch information...
winton committed Aug 30, 2010
1 parent 5e0ad99 commit bfffb09dd3248c00fa0d19ca83c586cae08c7051
View
@@ -3,6 +3,7 @@ require File.dirname(__FILE__) + '/lib/a_b_front_end/gems'
ABFrontEnd::Gems.require(:rake)
require 'rake'
+require 'active_wrapper/tasks'
require 'rake/gempackagetask'
require 'spec/rake/spectask'
@@ -3,13 +3,18 @@
if environment == :development
get '/spec/fake_data' do
- if request.cookies['site_name'] && request.cookies['test_name']
+ response.set_cookie('a_b', :value => nil, :path => '/')
+ response.set_cookie('a_b_i', :value => nil, :path => '/')
+
+ if request.cookies['category_name'] && request.cookies['site_name'] && request.cookies['test_name']
categories = ABPlugin::Config.categories
site = ABPlugin.site request.cookies['site_name']
if site != false
+ @category = request.cookies['category_name']
@test = request.cookies['test_name']
ABPlugin::Config.categories site['categories']
end
+ response.set_cookie('category_name', :value => nil, :path => '/')
response.set_cookie('site_name', :value => nil, :path => '/')
response.set_cookie('test_name', :value => nil, :path => '/')
end
@@ -23,7 +23,7 @@ class Gems
:gemspec => [ :active_wrapper, :haml, :lilypad, :'rack-flash', :sinatra ],
:gemspec_dev => [ :cucumber, :rspec, :'rack-test' ],
:lib => [ :active_wrapper, :haml, :lilypad, :'rack-flash', :sinatra ],
- :rake => [ :rake, :rspec ],
+ :rake => [ :active_wrapper, :rake, :rspec ],
:spec => [ :'rack-test', :rspec ]
}
@@ -69,10 +69,10 @@
}
});
if (!found) { %>
+ %td 0
%td -
%td -
%td -
- %td -
- %td -
+ %td ?
<% } %>
<% }); %>
@@ -8,6 +8,7 @@
= js 'spec/fake_data'
%script{ :type => 'text/javascript' }
:erb
+ window.category = <%= @category.to_json %>;
window.test = <%= @test.to_json %>;
<% if @test %>
reset_a_b();
View
@@ -371,6 +371,8 @@ window.A_B = new function() {
this.Datastore = Datastore;
this.Test = Test;
+ this.categories = function() { return categories; };
+
// Global methods
window.a_b = function(c, t, e) {
@@ -1,5 +1,3 @@
-window.testing = true;
-
function wait(msg, fn) {
var alert = $('<div id="alert"/>')
.html(msg + ":&nbsp;&nbsp;")
@@ -12,35 +10,48 @@ function wait(msg, fn) {
padding: '8px'
})
.prependTo('body')
- .append('<input type="text" />')
+ .append(
+ $('<input type="text" />')
+ .keyup(function(e) {
+ if (e.keyCode == 13)
+ submit();
+ })
+ .focus()
+ )
.append(
$('<a href="#"/>')
.html('Continue')
.css({
'color': 'yellow',
'margin-left': 10
})
- .click(function() {
- fn($('input', alert).val());
- alert.remove();
- return false;
- })
+ .click(submit)
);
+ function submit() {
+ fn($('input', alert).val());
+ alert.remove();
+ return false;
+ }
}
module('fake data');
test('should create some fake data', function() {
- stop();
- if (window.test) {
- // do tests
+ if (window.category && window.test) {
+ start();
+ expect(2);
+ equals(typeof a_b(window.category, window.test).visit(), 'string');
+ equals(typeof a_b(window.category, window.test).convert(), 'string');
} else {
stop();
wait("Enter site name", function(site_name) {
- wait("Enter test name", function(test_name) {
- A_B.Cookies.set('site_name', site_name);
- A_B.Cookies.set('test_name', test_name);
- window.location.reload();
+ wait("Enter category name", function(category_name) {
+ wait("Enter test name", function(test_name) {
+ A_B.Cookies.set('category_name', category_name);
+ A_B.Cookies.set('site_name', site_name);
+ A_B.Cookies.set('test_name', test_name);
+ window.location.reload();
+ });
});
});
}

0 comments on commit bfffb09

Please sign in to comment.