Permalink
Browse files

Setting test categories in spec action instead of config yaml, prepar…

…ing for fake data spec
  • Loading branch information...
1 parent 99a917b commit fc78c54bc0c2187b58f2d64ac6acf804a0a2c3a8 @winton committed Aug 23, 2010
View
16 config/a_b.yml
@@ -1,16 +1,2 @@
token: UAkc328OcjMVFbPAE5bo
-url: http://localhost:9394
-# For specs
-site: test
-categories:
- - name: Category
- tests:
- - id: 1
- name: Test
- variants:
- - id: 2
- name: v1
- - id: 3
- name: v2
- - id: 4
- name: v3
+url: http://localhost:9394
View
24 lib/a_b_front_end/controller/spec.rb
@@ -3,8 +3,32 @@
if environment == :development
get '/spec/js' do
+ site = ABPlugin::Config.site
+ categories = ABPlugin::Config.categories
+
+ ABPlugin::Config.categories [
+ {
+ :name => 'Category',
+ :tests => [
+ {
+ :id => 1,
+ :name => 'Test',
+ :variants => [
+ { :id => 2, :name => 'v1' },
+ { :id => 3, :name => 'v2' },
+ { :id => 4, :name => 'v3' }
+ ]
+ }
+ ]
+ }
+ ]
+
ABPlugin::API.spec_js_setup
+
haml :'spec/js', :layout => false
+
+ ABPlugin::Config.site site
+ ABPlugin::Config.categories categories
end
end
end
View
19 lib/a_b_front_end/view/spec/fake_data.haml
@@ -0,0 +1,19 @@
+!!! 1.1
+%html
+ %head
+ = css 'qunit'
+ = js 'jquery'
+ = js 'a_b'
+ = js 'qunit'
+ = js 'spec/fake_data'
+ %script{ :type => 'text/javascript' }
+ :erb
+ reset_a_b();
+ function reset_a_b() {
+ <%= a_b %>
+ }
+ %body
+ %h1{ :id => "qunit-header" } a_b fake data
+ %h2{ :id => "qunit-banner" }
+ %h2{ :id => "qunit-userAgent" }
+ %ol{ :id => "qunit-tests" }
View
4 lib/a_b_front_end/view/spec/js.haml
@@ -5,15 +5,15 @@
= js 'jquery'
= js 'a_b'
= js 'qunit'
- = js 'spec'
+ = js 'spec/js'
%script{ :type => 'text/javascript' }
:erb
reset_a_b();
function reset_a_b() {
<%= a_b %>
}
%body
- %h1{ :id => "qunit-header" } a_b
+ %h1{ :id => "qunit-header" } a_b.js
%h2{ :id => "qunit-banner" }
%h2{ :id => "qunit-userAgent" }
%ol{ :id => "qunit-tests" }
View
0 public/js/spec/fake_data.js
No changes.
View
0 public/js/spec.js → public/js/spec/js.js
File renamed without changes.

0 comments on commit fc78c54

Please sign in to comment.