incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject [39/58] [partial] Initial setup of new console
Date Tue, 08 Oct 2013 17:59:47 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/users.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/users.rb b/contrib/blur-console-old/blur-admin/spec/factories/users.rb
new file mode 100644
index 0000000..fbea5cc
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/users.rb
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+FactoryGirl.define do
+	factory :user do
+		sequence(:username)  	{|n| "user#{n}"}
+		sequence(:name)      	{|n| "user#{n}"}
+		sequence (:email)     {|n| "user#{n}@example.com"}
+		password              "password"
+		password_confirmation "password"
+		roles                 {['editor', 'admin', 'reader', 'auditor', 'searcher']}
+
+    factory :user_with_preferences do
+      after_create do |user|
+        FactoryGirl.create(:preference, :user => user)
+        FactoryGirl.create(:zookeeper_pref, :user =>user)
+      end
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/zookeeper.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/zookeeper.rb b/contrib/blur-console-old/blur-admin/spec/factories/zookeeper.rb
new file mode 100644
index 0000000..1e087c1
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/zookeeper.rb
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+FactoryGirl.define do
+  factory :zookeeper do
+    sequence (:name)      { |n| "Test Zookeeper ##{n}" }
+    sequence (:url)       { |n| "zookeeper#{n}.blur.example.com" }
+    sequence (:blur_urls) { |n| "host#{n}:40010"}
+    online_ensemble_nodes { "[\"nic-blurtop.nearinfinity.com\"]" }
+    zookeeper_status                { rand 2 }
+
+    ignore do
+      recursive_factor 3
+    end
+
+    factory :zookeeper_with_cluster do
+      after_create do |zookeeper|
+        FactoryGirl.create_list(:blur_controller, 1, :zookeeper => zookeeper)
+        FactoryGirl.create_list(:cluster, 1, :zookeeper => zookeeper)
+      end
+    end
+
+    factory :zookeeper_with_clusters do
+      after_create do |zookeeper, evaluator|
+        FactoryGirl.create_list(:blur_controller, evaluator.recursive_factor, :zookeeper => zookeeper)
+        FactoryGirl.create_list(:cluster, evaluator.recursive_factor, :zookeeper => zookeeper)
+      end
+    end
+
+    factory :zookeeper_with_blur_table, :parent => :zookeeper_with_cluster do
+      after_create do |zookeeper|
+        zookeeper.clusters.each { |cluster| FactoryGirl.create(:blur_table, :cluster => cluster) }
+        zookeeper.clusters.each { |cluster| FactoryGirl.create(:blur_shard, :cluster => cluster) }
+      end
+    end
+
+    factory :zookeeper_with_blur_tables, :parent => :zookeeper_with_cluster do
+      after_create do |zookeeper, evaluator|
+        zookeeper.clusters.each { |cluster| FactoryGirl.create_list(:blur_table, evaluator.recursive_factor, :cluster => cluster) }
+        zookeeper.clusters.each { |cluster| FactoryGirl.create_list(:blur_shard, evaluator.recursive_factor, :cluster => cluster) }
+      end
+    end
+
+    factory :zookeeper_with_blur_query, :parent => :zookeeper_with_blur_table do
+      after_create do |zookeeper|
+        zookeeper.blur_tables.each { |blur_table| FactoryGirl.create(:blur_query, :blur_table => blur_table) }
+      end
+    end
+
+    factory :zookeeper_with_blur_queries, :parent => :zookeeper_with_blur_tables do
+      after_create do |zookeeper, evaluator|
+        zookeeper.blur_tables.each { |blur_table| FactoryGirl.create_list(:blur_query, evaluator.recursive_factor, :blur_table => blur_table) }
+      end
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/fixtures/test.png
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/fixtures/test.png b/contrib/blur-console-old/blur-admin/spec/fixtures/test.png
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/helpers/application_helper_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/helpers/application_helper_spec.rb b/contrib/blur-console-old/blur-admin/spec/helpers/application_helper_spec.rb
new file mode 100644
index 0000000..2bc3045
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/helpers/application_helper_spec.rb
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+describe ApplicationHelper do  
+  describe "pluralize without count" do
+    it "returns the singular if given a 1 or '1'" do 
+      pluralize_no_count(1, 'rail').should == 'rail'
+      pluralize_no_count('1', 'rail').should == 'rail'
+    end
+
+    it 'should return the system defined plural if given a numbe larger than 1' do
+      pluralize_no_count(2, 'rail').should == 'rails'
+    end
+
+    it 'should return the given plural if given a numbe larger than 1' do
+      pluralize_no_count(2, 'rail', 'not rail').should == 'not rail'
+    end
+  end
+
+  describe "stateful nav url" do
+    it "should return an empty string if there isnt a current zookeeper" do
+      session[:current_zookeeper_id] = nil
+      stateful_nav_url('page').should == ""
+    end
+
+    it "should return an empty string if given page isnt stateful" do
+      session[:current_zookeeper_id] = 1
+      stateful_nav_url('page').should == ""
+    end
+
+    it "given a valid stateful page should return the correct page" do
+      session[:current_zookeeper_id] = 1
+      stateful_nav_url('environment').should == zookeeper_path(1)
+      stateful_nav_url('blur_table').should == zookeeper_blur_tables_path(1)
+      stateful_nav_url('blur_query').should == zookeeper_blur_queries_path(1)
+      stateful_nav_url('search').should == zookeeper_searches_path(1)
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/helpers/blur_queries_helper_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/helpers/blur_queries_helper_spec.rb b/contrib/blur-console-old/blur-admin/spec/helpers/blur_queries_helper_spec.rb
new file mode 100644
index 0000000..b8ecb4a
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/helpers/blur_queries_helper_spec.rb
@@ -0,0 +1,41 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+describe BlurQueryHelper do
+  describe "format title" do
+    it "returns the nothing when it is less than 20 chars" do
+      format_title("Simple").should == ''
+    end
+
+    it "returns a string with the ' +' with a line break" do
+      format_title("Not Very Simple +And Kind Of Long").should == "Not Very Simple<br />+And Kind Of Long"
+    end
+  end
+
+  describe "print value" do
+    it "returns the default message when given conditional evaluates to false" do 
+      print_value(false).should == 'Not Available'
+    end
+
+    it "returns the conditional when no block is given" do 
+      print_value('hello').should == 'hello'
+    end
+
+    it "executes the block when the conditional is false" do 
+      print_value(true){'hello'}.should == 'hello'
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/helpers/license_helper_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/helpers/license_helper_spec.rb b/contrib/blur-console-old/blur-admin/spec/helpers/license_helper_spec.rb
new file mode 100644
index 0000000..81d6a7f
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/helpers/license_helper_spec.rb
@@ -0,0 +1,107 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+include ApplicationHelper
+
+describe LicenseHelper do
+  before(:each) do
+    @license = FactoryGirl.create :license
+  end
+  describe "license text" do
+    before(:each) do
+      @prefix = "Licensed to: NIC on #{@license.issued_date.strftime('%d %b %Y')}."
+    end
+
+    describe 'License expiration' do
+      it 'should state no warning when the license will expire in more than 30 days' do
+        license_text(@license).should == @prefix
+      end
+
+      it 'should return No license found when the license is nil' do
+        license_text(nil).should == 'No valid license found.'
+      end
+
+      it 'should state that the license is expired when the number of days left is less than 0' do
+        @license.stub!(:expires_date).and_return Date.today.months_ago(1)
+        license_text(@license).should == @prefix + ' License is expired.'
+      end
+
+      it 'should state that the license is about to expire today when the number of days left is 0' do
+        @license.stub!(:expires_date).and_return Date.today
+        license_text(@license).should == @prefix + ' License expires today.'
+      end
+
+      it 'should state that the license will expire in x days when the number of days left is x and x is less than 30' do
+        @license.stub!(:expires_date).and_return Date.today.weeks_ago(-1)
+        license_text(@license).should == @prefix + ' License expires in 7 days.'
+      end
+    end
+
+    describe 'Node Overage' do
+      before(:each) do
+        @license.stub!(:node_overage).and_return 1
+      end
+
+      it 'should warn that you have a node overage and if you are over teh grace period then tell you to contact nic' do
+        @license.stub!(:grace_period_days_remain).and_return -2
+        license_text(@license).should == @prefix + ' There is currently 1 node over the licensed amount. Please contact Near Infinity to upgrade the license.'
+      end
+
+      it 'should warn that you have a node overage and get the correct pluralization' do
+        @license.stub!(:node_overage).and_return 2
+        @license.stub!(:grace_period_days_remain).and_return -2
+        license_text(@license).should == @prefix + ' There are currently 2 nodes over the licensed amount. Please contact Near Infinity to upgrade the license.'
+      end
+
+      it 'should warn that you have a node overage and if you are within the grace period then it should tell you how many days are left' do
+        @license.stub!(:grace_period_days_remain).and_return 3
+        license_text(@license).should == @prefix + ' There is currently 1 node over the licensed amount. 3 days left until a new license is needed.'
+      end
+    end
+
+    describe 'cluster overage' do
+      it 'should warn of a cluster overage if there are any clusters that have expired' do
+        @license.stub!(:cluster_overage).and_return 1
+        license_text(@license).should == @prefix + ' There is currently 1 cluster over the licensed amount. Please contact Near Infinity to upgrade the license.'
+      end
+
+      it 'should warn of a cluster overage if there are any clusters that have expired with correct pluralization' do
+        @license.stub!(:cluster_overage).and_return 2
+        license_text(@license).should == @prefix + ' There are currently 2 clusters over the licensed amount. Please contact Near Infinity to upgrade the license.'
+      end
+    end
+  end
+
+  describe "footer class" do
+    it 'should return false if the license is fine' do
+      footer_class(@license).should == false
+    end
+
+    it 'should return expiring_license if the license is nil' do
+      footer_class(nil).should == 'expiring_license'
+    end
+
+    it 'should return expiring_license if it is within 30 days of expiring or has expired, or if there is a cluster overage' do 
+      @license.stub!(:expires_date).and_return Date.today.weeks_ago(-1)
+      footer_class(@license).should == 'expiring_license'
+    end
+
+    it 'should return expiring_license if there is a cluster overage' do 
+      @license.stub!(:cluster_overage).and_return 1
+      footer_class(@license).should == 'expiring_license'
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/ability_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/ability_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/ability_spec.rb
new file mode 100644
index 0000000..9017a1b
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/ability_spec.rb
@@ -0,0 +1,301 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require "spec_helper"
+
+def controller_actions
+  # this method returns a hash of controllers each with an array of their respective
+  # actions.  Use this list to make sure unauthorized users are not able to access any
+  # actions in a controller.  Note that the action_methods also includes some callbacks,
+  # so this list cannot be used for determining that a user *can* do all of the actions
+  # in a controller (use cancan 2.0's 'access' for that).
+  
+  Dir[File.join Rails.root, 'app', 'controllers', '*'].each {|file| load file}
+  @controller_actions ||= ApplicationController.subclasses.reduce({}) do |memo, controller|
+    memo[controller.to_s.gsub("Controller", "").underscore.to_sym] = 
+      controller.action_methods.collect {|method| method.to_sym}
+    memo
+  end
+end
+
+describe Ability do
+  describe "when not logged in" do
+    before(:each) do
+      @ability = Ability.new(nil)
+    end
+
+    it "can create a user (register) with username, email, password" do
+      @ability.should be_able_to :new,    :users
+      @ability.should be_able_to :create, :users, :username
+      @ability.should be_able_to :create, :users, :name
+      @ability.should be_able_to :create, :users, :email
+      @ability.should be_able_to :create, :users, :password
+      @ability.should be_able_to :create, :users, :password_confirmation
+    end
+
+    it "can not create a user (register) with roles" do
+      User::ROLES.each do |role|
+        @ability.should_not be_able_to :create, :users, role
+      end
+    end
+
+    it "can create a session (log in)" do
+      @ability.should be_able_to :create, :user_sessions 
+      @ability.should be_able_to :new, :user_sessions
+    end
+
+    it "can not access pages" do
+      # actions are automatically added to this check.  Thus, you have to specifically
+      # filter actions that should be available to non logged-in users
+
+      @actions = controller_actions
+
+      #filter out actions available to non logged in users
+      @actions[:user_sessions] -= [:create, :new]
+      @actions[:users]         -= [:new, :create]
+      @actions[:errors]        -= [:error_404, :error_422, :error_500]
+
+      @actions.each do |controller, actions|
+        actions.each {|action| @ability.should_not be_able_to action, controller}
+      end
+
+    end
+  end
+
+  describe "when a user with no roles" do
+    before(:each) do
+      @user = FactoryGirl.create :user, :roles => []
+      @ability = Ability.new @user
+    end
+
+    it "can view, edit and delete itself" do
+      @ability.should be_able_to :show, @user
+      @ability.should be_able_to :edit, @user
+      @ability.should be_able_to :destroy, @user
+    end
+
+    it "can log out" do
+      @ability.should be_able_to :destroy, :user_sessions
+    end
+
+    it "can update own username, email, and password" do
+      @ability.should be_able_to :update, @user, :username
+      @ability.should be_able_to :update, @user, :name
+      @ability.should be_able_to :update, @user, :email
+      @ability.should be_able_to :update, @user, :password
+      @ability.should be_able_to :update, @user, :password_confirmation
+   end
+
+    it "can not view, edit, update, or delete other users" do
+      other_user = User.new
+      @ability.should_not be_able_to :show, other_user
+      @ability.should_not be_able_to :edit, other_user
+      @ability.should_not be_able_to :update, other_user
+      @ability.should_not be_able_to :destroy, other_user
+    end
+
+    it "can not update own roles" do
+      @ability.should_not be_able_to :update, @user, :admin
+      @ability.should_not be_able_to :update, @user, :editor 
+    end
+
+    it "can not view query_strings on blur_query page" do
+      @ability.should_not be_able_to :index, :blur_queries, :query_string
+    end
+
+    it "can not access pages" do
+      # actions are automatically added to this check.  Thus, you have to specifically
+      # filter actions that should be available to non logged-in users.
+      # NOTE:  These are just the vanilla actions, so if the action depends on what
+      # attribute is being updated, or what value an attribute is (i.e. checking to 
+      # make sure updated object is the user's) it will pass, so those cases must be
+      # tested seperately.
+
+      @actions = controller_actions
+
+      #filter out actions available to non logged in users
+      @actions[:users] -= [:show, :edit, :destroy, :update]
+      @actions[:user_sessions] -= [:destroy]
+      @actions[:errors]        -= [:error_404, :error_422, :error_500]
+
+
+      @actions.each do |controller, actions|
+        actions.each {|action| @ability.should_not be_able_to action, controller}
+      end
+
+    end
+
+  end
+
+  describe "when a reader" do
+    before(:each) do
+      @user = FactoryGirl.create :user, :roles => ['reader']
+      @ability = Ability.new @user
+    end
+
+    it "can view pages" do
+      @ability.should be_able_to :index, :blur_tables
+      @ability.should be_able_to :index, :zookeepers
+      @ability.should be_able_to :index, :blur_queries
+      @ability.should be_able_to :index, :hdfs
+      @ability.should be_able_to :index, :hdfs_metrics
+      @ability.should be_able_to :show, :blur_queries
+      @ability.should be_able_to :show, :clusters
+      @ability.should be_able_to :help, :application
+    end
+
+    it "can gather information" do
+      @ability.should be_able_to :long_running_queries, :zookeepers
+      @ability.should be_able_to :expand, :hdfs
+      @ability.should be_able_to :file_info, :hdfs
+      @ability.should be_able_to :folder_info, :hdfs
+      @ability.should be_able_to :slow_folder_info, :hdfs
+      @ability.should be_able_to :file_tree, :hdfs
+      @ability.should be_able_to :stats, :hdfs_metrics
+      @ability.should be_able_to :refresh, :blur_queries
+      @ability.should be_able_to :terms, :blur_tables
+    end
+
+    it "can not view query strings" do
+      @ability.should_not be_able_to :show, :blur_queries, :query_string
+      @ability.should_not be_able_to :index, :blur_queries, :query_string
+    end
+
+    it "can not change own column preferences" do
+      @preference = FactoryGirl.create :preference, :user_id => @user.id, :pref_type => 'column'
+      @ability.should_not be_able_to :update, @preference
+    end
+
+    it "can not change own zookeeper preference" do
+      @preference = FactoryGirl.create :preference, :user_id => @user.id, :pref_type => 'zookeeper'
+      @ability.should_not be_able_to :update, @preference
+    end
+
+  end
+
+  describe "when an editor" do
+    before(:each) do
+      @user = FactoryGirl.create :user, :roles => ['editor']
+      @ability = Ability.new @user
+    end
+  
+    it "can enable, disable, comment, and delete tables" do
+      @ability.should be_able_to :enable, :blur_tables
+      @ability.should be_able_to :disable, :blur_tables
+      @ability.should be_able_to :destroy, :blur_tables
+      @ability.should be_able_to :comment, :blur_tables
+    end
+
+    it "can cancel queries" do
+      @ability.should be_able_to :cancel, :blur_queries
+    end
+
+    it "can index shards" do
+      @ability.should be_able_to :index, :blur_shards
+    end
+
+    it "can destroy the zookeeper tree" do
+      @ability.should be_able_to :destroy, :zookeepers
+      @ability.should be_able_to :destroy, :clusters
+      @ability.should be_able_to :destroy, :blur_shards
+      @ability.should be_able_to :destroy, :blur_controllers
+    end
+
+    it "can perform destructive actions hdfs" do
+      @ability.should be_able_to :move_file, :hdfs
+      @ability.should be_able_to :delete_file, :hdfs
+      @ability.should be_able_to :mkdir, :hdfs
+      @ability.should be_able_to :upload_form, :hdfs
+      @ability.should be_able_to :upload, :hdfs
+    end
+  end
+
+  describe "when an auditor" do
+    before(:each) do
+      @user = FactoryGirl.create :user, :roles => ['auditor']
+      @ability = Ability.new @user
+    end
+  
+    it "can view blur query string" do
+      @ability.should be_able_to :index, :blur_queries, :query_string
+      @ability.should be_able_to :show, :blur_queries, :query_string
+      @ability.should be_able_to :index, :audits
+    end
+  end
+  
+  describe "when an admin" do
+    before(:each) do
+      @user = FactoryGirl.create :user, :roles => ['admin']
+      @ability = Ability.new @user
+      @other_user = User.new
+    end
+
+    it "can edit, and delete other users" do
+      @ability.should be_able_to :index, :users
+      @ability.should be_able_to :edit, @other_user
+      @ability.should be_able_to :destroy, @other_user
+    end
+
+    it "can update other users' roles" do
+      @ability.should be_able_to :update, @other_user, :roles
+    end
+
+    it "can not view other individual users" do
+      @ability.should_not be_able_to :show, @other_user
+    end
+
+    it "can not update other users' username, or password" do
+      @ability.should_not be_able_to :update, @other_user, :username
+      @ability.should_not be_able_to :update, @other_user, :password
+      @ability.should_not be_able_to :update, @other_user, :password_confirmation
+    end
+    
+    it "can update other users' email" do
+      @ability.should be_able_to :update, @other_user, :email
+    end
+
+    it "can create users with roles" do
+      @ability.should be_able_to :new, :users
+      @ability.should be_able_to :create, :users, :admin
+      @ability.should be_able_to :create, :users, :editor
+    end
+  end
+
+  describe "when a searcher" do
+    before do
+      @user = FactoryGirl.create :user, :roles => ['searcher']
+      @ability = Ability.new @user
+    end
+
+    it "can view and use the search page" do
+      @ability.should be_able_to :access, :searches
+    end
+
+    it "can change own column preferences" do
+      @preference = FactoryGirl.create :preference, :user_id => @user.id, :pref_type => 'column'
+      @ability.should be_able_to :update, @preference
+    end
+
+    it "can change own zookeeper preferences" do
+      @preference = FactoryGirl.create :preference, :user_id  => @user.id, :pref_type => 'zookeeper'
+      @ability.should be_able_to :update, @preference
+    end
+    
+    it "can change own filter preferences" do
+      @preference = FactoryGirl.create :preference, :user_id => @user.id, :pref_type => 'filter'
+      @ability.should be_able_to :update, @preference
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/admin_setting_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/admin_setting_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/admin_setting_spec.rb
new file mode 100644
index 0000000..d5deaae
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/admin_setting_spec.rb
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe AdminSetting do
+  describe "search filter" do
+    it "should create a new setting when one doesnt exist" do
+      before_count = AdminSetting.all.count
+      AdminSetting.search_filter
+      before_count.should == AdminSetting.all.count - 1
+    end
+
+    it "should return a setting when one does exist" do
+      setting = FactoryGirl.create :admin_setting, :setting => "regex_filter"
+      AdminSetting.search_filter.should == setting
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/audit_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/audit_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/audit_spec.rb
new file mode 100644
index 0000000..aafd759
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/audit_spec.rb
@@ -0,0 +1,55 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe Audit do
+  describe "log_event" do
+    it "should downcase the model and the mutation" do
+      # This test is purely for string collision and readability
+      user = FactoryGirl.create :user
+      zookeeper = FactoryGirl.create :zookeeper
+      created_audit = Audit.log_event user, "Message", "MoDeL", "MuTaTiOn", zookeeper
+      created_audit.mutation.should == "mutation"
+      created_audit.model_affected == "model"
+    end
+  end
+
+  describe "scope" do
+    it "should return the audits within the given time range" do
+      # Create a set of queries with different created at times
+      FactoryGirl.create :audit, :created_at => 10.days.ago
+      returned = [FactoryGirl.create(:audit, :created_at => 1.days.ago)]
+
+      # Grab all the audits within the last 72 hours
+      recent = Audit.recent 72, 0
+      recent.should == returned
+    end
+  end
+
+  describe "summary" do
+    it 'should return a hash with the correct data' do
+      audit = FactoryGirl.create :audit
+      summary = audit.summary
+      summary.should include(:action)
+      summary.should include(:date_audited)
+      summary.should include(:model)
+      summary.should include(:mutation)
+      summary.should include(:username)
+      summary.should include(:user)
+      summary.should include(:zookeeper_affected)
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/blur_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/blur_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/blur_controller_spec.rb
new file mode 100644
index 0000000..e562f8d
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/blur_controller_spec.rb
@@ -0,0 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe BlurController do
+  describe "as json" do
+    it "should not have the date fields" do
+      controller = FactoryGirl.create :blur_controller
+      controller.as_json.should_not include("updated_at")
+      controller.as_json.should_not include("created_at")
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/blur_query_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/blur_query_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/blur_query_spec.rb
new file mode 100644
index 0000000..60d6879
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/blur_query_spec.rb
@@ -0,0 +1,117 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe BlurQuery do
+  before(:each) do
+    @client = mock Blur::Blur::Client
+    BlurThriftClient.stub(:client).and_return(@client)
+    @client.stub :cancelQuery
+    @table = FactoryGirl.create :blur_table
+    @query = FactoryGirl.create :blur_query
+    @zookeeper = FactoryGirl.create :zookeeper
+    @query.blur_table = @table
+    @table.stub(:zookeeper).and_return(@zookeeper)
+  end
+
+  describe "cancel" do
+    context "call to client.cancelQuery is successful" do
+      it "should return true" do
+        @client.should_receive(:cancelQuery).with(@table.table_name, @query.uuid).and_return nil
+        @query.cancel.should be true
+      end
+    end
+
+    context "call to client.cancelQuery is unsuccessful" do
+      it "should return false" do
+        @client.should_receive(:cancelQuery) { raise Exception }
+        @query.cancel.should be false
+      end
+    end
+  end
+
+  describe 'state string' do
+    it 'should return running when the state is 0' do
+      @query.state = 0
+      @query.state_str.should == "Running"
+    end
+
+    it 'should return Interrupted when the state is 1' do
+      @query.state = 1
+      @query.state_str.should == "Interrupted"
+    end
+
+    it 'should return complete when the state is 2' do
+      @query.state = 2
+      @query.state_str.should == "Complete"
+    end
+
+    it 'should return nil when the state is anyhting else' do
+      @query.state = 3
+      @query.state_str.should == nil
+    end
+  end
+
+  describe 'complete' do
+    it 'should return 0 when there arent any shards' do 
+      @query.total_shards = 0
+      @query.complete.should == 0
+    end
+
+    it 'should return the number of complete over total when there are shards working' do 
+      @query.total_shards = 4
+      @query.complete_shards = 2
+      @query.complete.should == 0.5
+    end
+  end
+
+  describe 'summary' do
+    it 'should hide the query when the user does not have the proper privileges' do 
+      @user = FactoryGirl.create :user, :roles => ['reader']
+      @query.summary(@user)[:query].should be_nil
+    end
+
+    it 'should show the query when the user has the proper privileges' do 
+      @user = FactoryGirl.create :user
+      @query.summary(@user)[:query].should == @query.query_string
+    end
+
+    context 'summary_state' do
+      before(:each) do
+        @user = FactoryGirl.create :user
+      end
+
+      it 'should return the percent complete if the state is 0' do
+        @query.state = 0
+        @query.total_shards = 4
+        @query.complete_shards = 2
+        @query.summary(@user)[:status].should == '50%'
+      end
+
+      it 'should return the percent complete and interrupted if the state is 1' do
+        @query.state = 1
+        @query.total_shards = 4
+        @query.complete_shards = 2
+        @query.summary(@user)[:status].should == '(Interrupted) - 50%'
+      end
+
+      it 'should return complete if the state is 2' do
+        @query.state = 2
+        @query.summary(@user)[:status].should == 'Complete'
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/blur_shard_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/blur_shard_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/blur_shard_spec.rb
new file mode 100644
index 0000000..2d520f7
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/blur_shard_spec.rb
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe BlurShard do
+  describe "destroy_parent_cluster" do
+    before do
+      @cluster = FactoryGirl.create :cluster
+      @shard = FactoryGirl.create :blur_shard
+      @shard.stub!(:cluster).and_return @cluster
+    end
+
+    it "should do nothing when it has siblings" do
+      @cluster.stub_chain(:blur_shards, :count).and_return 1
+      @shard.destroy
+      @cluster.should_not_receive(:destroy)
+    end
+    it "should destroy the cluster when all the shards are destroyed" do
+      @cluster.stub_chain(:blur_shards, :count).and_return 0
+      @cluster.should_receive(:destroy)
+      @shard.destroy
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/blur_table_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/blur_table_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/blur_table_spec.rb
new file mode 100644
index 0000000..ca65e75
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/blur_table_spec.rb
@@ -0,0 +1,243 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe BlurTable do
+
+  before(:each) do
+    @client = mock(ThriftClient)
+    BlurThriftClient.stub!(:client).and_return(@client)
+    @table = FactoryGirl.create :blur_table
+  end
+
+  describe "as_json" do
+    it 'return the expected values' do
+      test_json = @table.as_json
+      test_json.should_not include("server")
+      test_json.should_not include("table_schema")
+      test_json.should include("queried_recently")
+      test_json.should include("server_info")
+      test_json.should include("comments")
+    end
+  end
+
+  describe "boolean state methods" do
+    describe "is_enabled?" do
+      it "should return true when the status is 4" do
+        enabled_table = FactoryGirl.create :blur_table, :table_status => 4
+        enabled_table.is_enabled?.should == true
+      end
+    end
+
+    describe "is_disabled?" do
+      it "should return true when the status is 2" do
+        enabled_table = FactoryGirl.create :blur_table, :table_status => 2
+        enabled_table.is_disabled?.should == true
+      end
+    end
+
+    describe "is_deleted?" do
+      it "should return true when the status is 0" do
+        enabled_table = FactoryGirl.create :blur_table, :table_status => 0
+        enabled_table.is_deleted?.should == true
+      end
+    end
+  end
+
+  describe "enable " do
+    it "method sends the message to enable the table through thrift" do
+      @client.should_receive(:enableTable).with @table.table_name
+      @table.enable 'test:40000'
+    end
+  end
+
+  describe "disable" do
+    it "should send the message to disable the table through thrift" do
+      @client.should_receive(:disableTable).with(@table.table_name)
+      @table.disable 'test:40000'
+    end
+  end
+
+  describe "blur_destroy" do
+    it "should send the message to remove the table through thrift with underlying false when not specified" do
+      @client.should_receive(:removeTable).with(@table.table_name, false)
+      @table.blur_destroy('test:40000').should == true
+    end
+
+    it "should send the message to remove the table through thrift with underlying true" do
+      @client.should_receive(:removeTable).with(@table.table_name, true)
+      @table.blur_destroy(true, 'test:40000').should == true
+    end
+
+    it "should return false when the destroy errors" do
+      @client.should_receive(:removeTable).with(@table.table_name, true).and_raise "Exception"
+      @table.blur_destroy(true, 'test:40000').should == false
+    end
+  end
+
+  describe "schema" do
+    it "returns the table schema in a ruby hash, with hosts as keys and array of shards as values" do
+      @table.hosts.should == JSON.parse( @table.server )
+      @table.hosts.keys.each {|host| host.should match  /Host/}
+      @table.hosts.values.flatten.each {|shard| shard.should match /shard/}
+    end
+
+    it "sorts the columns and column families alphabetically" do
+      @unsorted_table = Factory.create :blur_table,
+        :table_name => 'test_table',
+        :table_schema =>      [
+                                {
+                                  "name" => 'ColumnFamily2',
+                                  "columns" => [
+                                    {"name" => 'Column2A'},
+                                    {"name" => 'Column2B'},
+                                    {"name" => 'Column2C'}
+                                  ]
+                                },
+                                {
+                                  "name" => 'ColumnFamily1',
+                                  "columns" => [
+                                    {"name" => 'Column1A'},
+                                    {"name" => 'Column1B'},
+                                    {"name" => 'Column1C'}
+                                  ]
+                                },
+                                {
+                                  "name" => 'ColumnFamily3',
+                                  "columns" => [
+                                    {"name" => 'Column3A'},
+                                    {"name" => 'Column3B'},
+                                    {"name" => 'Column3C'}
+                                  ]
+                                }
+                              ].to_json
+
+      @sorted_table = Factory.create :blur_table,
+        :table_name => 'test-table',
+        :table_schema =>      [
+                                {
+                                  "name" => 'ColumnFamily1',
+                                  "columns" => [
+                                    {"name" => 'Column1A'},
+                                    {"name" => 'Column1B'},
+                                    {"name" => 'Column1C'}
+                                  ]
+                                },
+                                {
+                                  "name" => 'ColumnFamily2',
+                                  "columns" => [
+                                    {"name" => 'Column2A'},
+                                    {"name" => 'Column2B'},
+                                    {"name" => 'Column2C'}
+                                  ]
+                                },
+                                {
+                                  "name" => 'ColumnFamily3',
+                                  "columns" => [
+                                    {"name" => 'Column3A'},
+                                    {"name" => 'Column3B'},
+                                    {"name" => 'Column3C'}
+                                  ]
+                                }
+                              ].to_json
+
+
+        @unsorted_table.schema.should == @sorted_table.schema
+    end
+
+    it "sorts the column families by an optionally supplied block" do
+      @unsorted_table = Factory.create :blur_table,
+        :table_name => 'test_table',
+        :table_schema =>      [
+                                {
+                                  "name" => 'ColumnFamily1',
+                                  "columns" => [
+                                    {"name" => 'Column1A'},
+                                    {"name" => 'Column1B'},
+                                    {"name" => 'Column1C'}
+                                  ]
+                                },
+                                {
+                                  "name" => 'ColumnFamily2',
+                                  "columns" => [
+                                    {"name" => 'Column2A'},
+                                    {"name" => 'Column2B'},
+                                    {"name" => 'Column2C'}
+                                  ]
+                                },
+                                {
+                                  "name" => 'ColumnFamily3',
+                                  "columns" => [
+                                    {"name" => 'Column3A'},
+                                    {"name" => 'Column3B'},
+                                    {"name" => 'Column3C'}
+                                  ]
+                                }
+                              ].to_json
+
+      @reverse_sort_table = Factory.create :blur_table,
+        :table_name => 'test_table',
+        :table_schema =>      [
+                                {
+                                  "name" => 'ColumnFamily3',
+                                  "columns" => [
+                                    {"name" => 'Column3A'},
+                                    {"name" => 'Column3B'},
+                                    {"name" => 'Column3C'}
+                                  ]
+                                },
+                                {
+                                  "name" => 'ColumnFamily2',
+                                  "columns" => [
+                                    {"name" => 'Column2A'},
+                                    {"name" => 'Column2B'},
+                                    {"name" => 'Column2C'}
+                                  ]
+                                },
+                                {
+                                  "name" => 'ColumnFamily1',
+                                  "columns" => [
+                                    {"name" => 'Column1A'},
+                                    {"name" => 'Column1B'},
+                                    {"name" => 'Column1C'}
+                                  ]
+                                }
+                              ].to_json
+
+
+      @reverse_sort_table.schema.should == @unsorted_table.schema {|a, b| a['name'] <=> b['name']}
+    end
+
+    it "returns nil when the server has not been populated" do
+      blur_table = BlurTable.new
+      blur_table.server.should be nil
+    end
+  end
+
+  describe "row_count" do
+    it "returns the row count" do
+      @table.row_count = 1234567
+      @table.row_count.should == "1,234,567"
+    end
+  end
+
+  describe "terms" do
+    it "requests terms from client" do
+      @client.should_receive(:terms).with(@table.table_name, 'colFam', 'col', '', 123)
+      @table.terms('test:40000', 'colFam', 'col', '', 123)
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/cluster_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/cluster_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/cluster_spec.rb
new file mode 100644
index 0000000..7c59426
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/cluster_spec.rb
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe Cluster do
+  before(:each) do
+    @cluster = FactoryGirl.create :cluster_with_shard
+  end
+
+  describe 'as_json' do
+    it "should have the can_update and cluster_queried in the json when the blur table flag is true" do
+      test_json = @cluster.as_json({:blur_tables => true})
+      puts @cluster.can_update
+      test_json.should include("can_update")
+      test_json.should include("cluster_queried")
+    end
+
+    it "should have the can_update and cluster_queried in the json when the blur table flag is true" do
+      test_json = @cluster.as_json({:blur_tables => false})
+      puts @cluster.can_update
+      test_json.should include("shard_blur_version")
+      test_json.should include("shard_status")
+    end
+  end
+
+  describe 'shard_version' do
+    it 'should return the common blur version when there is a single version' do
+      @cluster.shard_version.should == @cluster.blur_shards.first.blur_version
+    end
+
+    it 'should return inconsistent when there are multiple blur versions' do
+      @incon_cluster = FactoryGirl.create :cluster_with_shards
+      @incon_cluster.shard_version.should == "Inconsistent Blur Versions"
+    end
+
+    it 'should return no shards message when there arent any versions' do
+      @empty_cluster = FactoryGirl.create :cluster
+      @empty_cluster.shard_version.should == "No shards in this Cluster!"
+    end
+  end
+
+  describe 'shard_status' do
+    it 'should return the correct ratio of online to offline shards' do
+      @test_cluster = FactoryGirl.create :cluster_with_shards_online
+      @test_cluster.shard_status.should == "3 | 3"
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/hdfs_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/hdfs_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/hdfs_spec.rb
new file mode 100644
index 0000000..1165515
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/hdfs_spec.rb
@@ -0,0 +1,39 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe Hdfs do
+  before :each do
+    @hdfs = FactoryGirl.create :hdfs
+    @hdfs_stat = FactoryGirl.create :hdfs_stat
+    @hdfs_stat2 = FactoryGirl.create :hdfs_stat
+    @hdfs.stub!(:hdfs_stats).and_return [@hdfs_stat2, @hdfs_stat]
+  end
+
+  it 'returns the most recent stats' do
+    @hdfs.most_recent_stats.should == @hdfs_stat
+  end
+
+  it 'returns true if stats were updated less than 1 minute ago' do
+    @hdfs_stat.created_at = Time.now
+    @hdfs.recent_stats.should == true
+  end
+
+  it 'returns false if stats were not updated in the last minute' do
+    @hdfs_stat.created_at = Time.now - 1000*2
+    @hdfs.recent_stats.should == false
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/hdfs_stat_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/hdfs_stat_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/hdfs_stat_spec.rb
new file mode 100644
index 0000000..bec3c1a
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/hdfs_stat_spec.rb
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe HdfsStat do
+  before(:each) do
+    @stat = FactoryGirl.create :hdfs_stat
+  end
+
+  it 'capacity should return the capacity in gigabytes' do
+    @stat.present_capacity = 3 * 1024**3
+    @stat.capacity.should == 3
+    @stat.capacity.kind_of? Float
+  end
+
+  it 'capacity should return the capacity in gigabytes' do
+    @stat.dfs_used_real = 3 * 1024**3
+    @stat.used.should == 3
+    @stat.capacity.kind_of? Float 
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/search_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/search_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/search_spec.rb
new file mode 100644
index 0000000..9e50b45
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/search_spec.rb
@@ -0,0 +1,91 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe Search do
+  before(:each) do
+    @user = FactoryGirl.create :user
+    @search = FactoryGirl.create :search, :user_id => @user
+  end
+
+  describe 'blur_query' do
+    it 'should create a BlurQuery object with its attributes' do
+      User.stub!(:find).and_return(@user)
+      Blur::SimpleQuery.should_receive(:new)
+      Blur::BlurQuery.should_receive(:new)
+      @search.blur_query
+    end
+  end
+
+  describe 'column_object' do
+    it 'should assign the column_object instance variable to the json parsed values when there are columns' do
+      @search.column_object
+      @search.instance_variable_get(:@column_object).should == ["family_-sep-_ColumnFamily1", 
+                                                               "column_-sep-_ColumnFamily2_-sep-_Column2A",
+                                                               "column_-sep-_ColumnFamily2_-sep-_Column2B",
+                                                               "column_-sep-_ColumnFamily3_-sep-_Column3C"]
+    end
+
+    it 'should assign the column_object instance variable to and empty array when there arent any columns' do
+      @search_without_columns = FactoryGirl.create :search, :user_id => @user, :columns => [].to_json
+      @search_without_columns.column_object
+      @search_without_columns.instance_variable_get(:@column_object).should == []
+    end
+  end
+
+  describe 'column_families' do
+    it 'should return an array of all the column families' do
+      @search.column_families.should == ['ColumnFamily1']
+    end
+  end
+
+  describe 'columns_hash' do
+    it 'should create a hash from column family name (excluding full column families) to column' do 
+      @search.columns_hash.should == {'ColumnFamily2' => ['recordId', 'Column2A', 'Column2B'], 'ColumnFamily3' => ['recordId', 'Column3C']}
+    end
+  end
+
+  describe 'selector' do
+    it 'should create a new selecrtor' do
+      Blur::Selector.should_receive(:new)
+      @search.selector
+    end
+  end
+
+  describe 'fetch_results' do
+    it 'should fetch the results from blur' do
+      mock_client = mock(HdfsThriftClient::Client)
+      mock_query = mock(Blur::BlurQuery)
+      @search.stub!(:blur_query).and_return(mock_query)
+      BlurThriftClient.should_receive(:client).with('URL').and_return(mock_client)
+      mock_client.should_receive(:query).with('NAME', mock_query)
+      @search.fetch_results('NAME', 'URL')
+    end
+  end
+
+  describe 'schema' do
+    it "should use the columns hash, column families, and the table schema to build a complete schema for the search" do
+      @blur_table = FactoryGirl.create :blur_table
+      result = @search.schema @blur_table
+      result.each do |family|
+        definition = family.last
+        keys = definition.keys
+        keys.should == ["name", "columns"]
+        definition['columns'].first['name'].should == 'recordId'
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/user_session_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/user_session_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/user_session_spec.rb
new file mode 100644
index 0000000..b0c9c9c
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/user_session_spec.rb
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe UserSession do
+  before :each do
+    activate_authlogic
+    @user_session = UserSession.new
+  end
+
+  describe "to_key" do
+    it "returns nil when it is a new record " do
+      @user_session.stub!(:new_record?).and_return(true)
+      @user_session.to_key.should be_nil
+    end
+
+    it "sends its primary key when it is a new record " do
+      @user_session.stub!(:new_record?).and_return(false)
+      @user_session.stub_chain(:class, :primary_key).and_return 1
+      @user_session.should_receive(:send).with 1
+      @user_session.to_key
+    end
+  end 
+
+  describe "persisted?" do
+    it "always returns false" do
+      @user_session.persisted?.should be_false
+    end
+  end 
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/user_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/user_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/user_spec.rb
new file mode 100644
index 0000000..168a654
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/user_spec.rb
@@ -0,0 +1,166 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe 'User Model' do
+
+  before do
+    @user = User.new( :username              => 'bob', 
+                      :email                 => 'bob@example.com',
+                      :password              => 'password',
+                      :password_confirmation => 'password')
+  end
+
+  describe 'create a user' do
+    it 'is valid with valid parameters' do
+      @user.should be_valid
+    end
+
+    it 'is invalid with no username' do
+      @user.username = nil
+      @user.should_not be_valid
+    end
+
+    it 'is invalid with no password' do
+      @user.password = nil
+      @user.password_confirmation = nil
+      @user.should_not be_valid
+    end
+    
+    it 'is invalid with no email' do
+      @user.email = nil
+      @user.should_not be_valid
+    end
+
+    it 'is invalid with invalid email' do
+      @user.email = 'invalid'
+      @user.should_not be_valid
+      @user.email = 'invalid@'
+      @user.should_not be_valid
+    end
+    
+    
+    it 'is invalid with duplicate username' do
+      @user.save
+      duplicate_user = User.new(:username              => @user.username,
+                                :email                 => 'dup_user@example.com',
+                                :password              => 'dup_password', 
+                                :password_confirmation => 'dup_password')
+      duplicate_user.should_not be_valid
+    end
+
+    it 'is invalid with duplicate email'  do
+      @user.save
+      duplicate_user = User.new(:username              => 'duplicate_user',
+                                :email                 => @user.email,
+                                :password              => 'dup_password', 
+                                :password_confirmation => 'dup_password')
+      duplicate_user.should_not be_valid
+    end
+
+    it 'is valid with long username' do
+      username = ''
+      100.times {username += 'a'}
+      @user.username = username
+      @user.should be_valid
+    end
+    
+    it 'is valid with email missing dot ending' do
+      @user.email = "tester@test"
+      @user.should be_valid
+    end
+
+    it 'is invalid with short password' do
+      password = 'abc'
+      @user.password = password
+      @user.password_confirmation = password
+      @user.should_not be_valid
+    end
+
+    it 'is valid with non alpha-numeric characters in password' do
+      password = "aA1!,.:' "
+      @user.password = password
+      @user.password_confirmation = password
+      @user.should be_valid
+    end
+  end
+
+  describe 'ability' do
+    it 'should create a new ability when an ability isnt cached' do
+      Ability.should_receive(:new).with(@user)
+      @user.ability
+    end
+  end
+
+  describe 'column preference' do
+    it 'should return your saved preference when a preference exists' do
+      user_with_preference = FactoryGirl.create :user_with_preferences
+      user_with_preference.column_preference.should == user_with_preference.preferences.first
+    end
+
+    it 'should create a new saved preference when a preference does not exist' do
+      user_without_preference = FactoryGirl.create :user
+      user_without_preference.column_preference.pref_type.should == 'column'
+      user_without_preference.column_preference.value.should == []
+    end
+  end
+
+  describe 'zookeeper_preference' do
+    it 'should return your zookeeper preference when a preference exists' do
+      user_with_preferences = FactoryGirl.create :user_with_preferences
+      user_with_preferences.zookeeper_preference.should == user_with_preferences.preferences.last
+    end
+
+    it 'should create a new zookeeper preference when a preference does not exist' do
+      user_without_preference = FactoryGirl.create :user
+      user_without_preference.zookeeper_preference.pref_type.should == 'zookeeper'
+      user_without_preference.zookeeper_preference.value.should == nil
+    end
+  end
+
+  describe 'roles' do
+    before(:each) do
+      @user_role = FactoryGirl.create :user, :roles => []
+    end
+    it 'roles= should set the roles mask to the mask of the array given' do
+      @user_role.roles = %w[editor]
+      @user_role.roles_mask = 16
+      @user_role.roles = %w[editor admin reader auditor searcher]
+      @user_role.roles_mask = 31
+    end
+
+    it 'roles should return the array of all valid roles for this user' do
+      @user_role.roles = %w[editor]
+      @user_role.roles.should == ['editor']
+    end
+
+    it 'is? should return true if the user is a specific role and false if not' do
+      @user_role.roles = %w[editor]
+      @user_role.is?(:editor).should == true
+      @user_role.is?('editor').should == true
+      @user_role.is?(:admin).should == false
+    end
+
+    it 'the dynamically defined methods should return tru if they are that role' do
+      @user_role.roles = %w[editor]
+      @user_role.editor?.should == true
+      @user_role.admin?.should == false
+      @user_role.editor.should == true
+      @user_role.admin.should == false
+    end
+  end
+end
+

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/models/zookeeper_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/models/zookeeper_spec.rb b/contrib/blur-console-old/blur-admin/spec/models/zookeeper_spec.rb
new file mode 100644
index 0000000..b13d339
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/models/zookeeper_spec.rb
@@ -0,0 +1,82 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe Zookeeper do
+  before do
+    @user = FactoryGirl.create :user_with_preferences
+    @ability = Ability.new @user
+
+    # Allow the user to perform all of the actions
+    @ability.stub!(:can?).and_return(true)
+  end
+
+  describe 'long running queries' do
+    before do
+      @zookeeper_with_queries = FactoryGirl.create :zookeeper_with_blur_queries
+      Zookeeper.stub!(:find).and_return(@zookeeper_with_queries)
+      query = @zookeeper_with_queries.blur_queries[rand @zookeeper_with_queries.blur_queries.count]
+      query.state = 0
+      query.created_at = 5.minutes.ago
+      query.save!
+    end
+
+    it "should get the long running query" do
+      stats = @zookeeper_with_queries.long_running_queries @user
+      stats.count.should == 1
+      stats[0]["state"] == 0
+    end
+  end
+
+  describe 'refresh queries' do
+    it "should get the queries within the lower range" do
+      @zookeeper = FactoryGirl.create :zookeeper
+      test = mock('BlurQuery')
+      @zookeeper.stub!(:blur_queries).and_return test
+      test.should_receive(:where).with(kind_of(String), 14, 4)
+      @zookeeper.refresh_queries 14
+    end
+  end
+
+  describe 'as json' do
+    it "should remove the online_ensemble_nodes key and add ensembles" do
+      @zookeeper = FactoryGirl.create :zookeeper
+      result = @zookeeper.as_json
+      result.should_not include("online_ensemble_nodes")
+      result.should include("ensemble")
+    end
+  end
+
+  describe 'dashboard stats' do
+    it "should call query with the large sql string" do
+      FactoryGirl.create :zookeeper
+      result = Zookeeper.dashboard_stats
+      result.first.keys.should include("name", "zookeeper_status", "id", "controller_version", "controller_offline_node", "controller_total", "shard_version", "shard_offline_node", "shard_total", "long_running_queries")
+    end
+  end
+
+  describe 'clusters with query status' do
+    it "should return the clusters with tables and their query counts" do
+      @zookeeper = FactoryGirl.create :zookeeper_with_blur_queries
+      result = @zookeeper.clusters_with_query_status(@user)
+      result.each do |cluster|
+        cluster.blur_tables.each do |table|
+          table.query_count.should_not be_nil
+        end
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/requests/admin_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/requests/admin_spec.rb b/contrib/blur-console-old/blur-admin/spec/requests/admin_spec.rb
new file mode 100644
index 0000000..5d665d5
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/requests/admin_spec.rb
@@ -0,0 +1,161 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe "Admin" do
+  before(:each) do
+    setup_tests
+    visit users_path
+  end
+
+
+  context "Page is loaded" do
+    it "should display the admin table" do
+      page.should have_css('div', :id => 'users_table')
+    end
+    it "should have the correct table headers" do
+      page.should have_content('Username')
+      page.should have_content('Name')
+      page.should have_content('Email')
+      page.should have_content('Roles')
+      page.should have_content('Actions')
+    end
+    it "should display an edit button for the user" do
+      find_link('Edit')[:href].should == edit_user_path(@user.id)
+    end
+    it "should display a button to create a new user" do
+      find_link('New User')[:href].should == new_user_path
+    end
+  end
+
+  context "A user is being edited" do
+    before(:each) do
+      visit users_path
+      click_link 'Edit'
+    end
+    it "should render the edit user form" do
+      current_path.should == edit_user_path(@user.id)
+      page.should have_field('user_name')
+      page.should have_field('user_email')
+      page.should have_field('user_password')
+      page.should have_field('user_password_confirmation')
+
+      page.should have_field('user_role_editor')
+      page.should have_field('user_role_admin')
+      page.should have_field('user_role_reader')
+      page.should have_field('user_role_auditor')
+      page.should have_field('user_role_searcher')
+      page.should have_button('Save')
+      page.should have_link('Cancel')
+    end
+    it "should allow a user's permissions to be changed" do
+      uncheck('user_role_searcher')
+      click_on('Save')
+      click_link('Edit')
+      page.should have_field('user_role_searcher', :checked => false)
+    end
+    it "should allow a user's username to be changed" do
+      fill_in 'user_username', :with => "Test"
+      click_on 'Save'
+      click_link 'Edit'
+      find_field('user_username').value.should == "Test"
+    end
+    it "should allow a user's name to be changed" do
+      fill_in 'user_name', :with =>'Test'
+      click_on 'Save'
+      click_link 'Edit'
+      find_field('user_name').value.should == 'Test'
+    end
+    it "should allow a user's email to be changed" do
+      fill_in 'user_email', :with => "test@test.com"
+      click_on 'Save'
+      click_link 'Edit'
+      find_field('user_email').value.should == "test@test.com"
+    end
+    it "should allow a user's password to be changed" do
+      fill_in 'user_password', :with => 'newpass'
+      fill_in  'user_password_confirmation', :with => 'newpass'
+      click_on 'Save'
+      click_on 'Log Out'
+      fill_in 'user_session_username', :with => @user.username
+      fill_in 'user_session_password', :with => 'newpass'
+      click_on 'Log In'
+      current_path.should == root_path
+    end
+    it "should redirect to the user's page when cancel is clicked" do
+      click_link 'Cancel'
+      current_path.should == users_path
+    end
+  end
+  context "A user is being created" do
+    before(:each) do
+      visit users_path
+      click_on 'New User'
+    end
+    it "should render the new user form" do
+      current_path.should == new_user_path
+      page.should have_field('user_name')
+      page.should have_field('user_email')
+      page.should have_field('user_password')
+      page.should have_field('user_password_confirmation')
+
+      page.should have_field('user_role_editor')
+      page.should have_field('user_role_admin')
+      page.should have_field('user_role_reader')
+      page.should have_field('user_role_auditor')
+      page.should have_field('user_role_searcher')
+      page.should have_button('Save')
+      page.should have_link('Cancel')
+    end
+    it "should allow the creation of a new user" do
+      current_path.should == new_user_path
+      create_a_user
+
+      current_path.should == users_path
+      page.all('table#users_table tr').count.should==3
+      page.find('table', :id => 'users_table').text.should have_content('test')
+      page.find('table', :id => 'users_table').text.should have_content('test name')
+      page.find('table', :id => 'users_table').text.should have_content('test@test.com')
+      page.find('table', :id => 'users_table').text.should have_content('editor, reader, auditor, searcher')
+    end
+  end
+  context "The delete user button is pressed" do
+    before(:each) do
+      visit users_path
+      click_on 'New User'
+      create_a_user
+    end
+    it "should delete a user", js: true do
+      click_on 'Delete'
+      #Capybara does not support confirmation boxes through rails so just have to assume that the user clicks yes
+      page.evaluate_script('window.confirm = function() { return true; }')
+      page.should have_content('User Removed')
+    end
+  end
+
+  def create_a_user
+    fill_in 'user_username', :with => 'test'
+    fill_in 'user_name', :with => 'test name'
+    fill_in 'user_email', :with => 'test@test.com'
+    fill_in 'user_password', :with => 'testpass'
+    fill_in 'user_password_confirmation', :with => 'testpass'
+    check 'user_role_editor'
+    check 'user_role_reader'
+    check 'user_role_auditor'
+    check 'user_role_searcher'
+    click_on 'Save'
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/requests/audits_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/requests/audits_spec.rb b/contrib/blur-console-old/blur-admin/spec/requests/audits_spec.rb
new file mode 100644
index 0000000..3af861d
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/requests/audits_spec.rb
@@ -0,0 +1,37 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe "Audits" do
+  before(:each) do
+    setup_tests
+    visit audits_path
+  end
+  context "Page is loaded" do
+    it "should show the audits table" do
+      page.should have_css('div', :id => 'audits_table')
+    end
+    it "should have the correct table headers" do
+      page.should have_content('Action Taken')
+      page.should have_content('Username')
+      page.should have_content('User')
+      page.should have_content('Zookeeper/Root Path')
+      page.should have_content('Model Affected')
+      page.should have_content('Mutation Type')
+      page.should have_content('Date')
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/requests/blur_queries_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/requests/blur_queries_spec.rb b/contrib/blur-console-old/blur-admin/spec/requests/blur_queries_spec.rb
new file mode 100644
index 0000000..c1418e4
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/requests/blur_queries_spec.rb
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe "Blur Queries" do
+  before(:each) do
+    setup_tests
+    #    wait_for_ajax
+    #wait_for_dom
+  end
+  context "Page is loaded" do
+    it "should display the correct page elements" do
+      visit zookeeper_blur_queries_path(@zookeeper.id)
+      page.should have_table('queries-table')
+      page.should have_content('User ID')
+      page.should have_content('Query')
+      page.should have_content('Table Name')
+      page.should have_content('Starting Record')
+      page.should have_content('Time Submitted')
+      page.should have_content('Status')
+      page.should have_content('Actions/Info')
+      page.should have_css('div', :class => 'range_select')
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/requests/login_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/requests/login_spec.rb b/contrib/blur-console-old/blur-admin/spec/requests/login_spec.rb
new file mode 100644
index 0000000..1813934
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/requests/login_spec.rb
@@ -0,0 +1,76 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+require 'spec_helper'
+
+describe "login" do
+  # generate a valid user
+  let(:user) { Factory.create :user }
+
+  before do
+    visit login_path
+  end
+
+  context "with valid login credentials" do
+    before do
+      fill_in 'user_session_username', :with => user.username
+      fill_in 'user_session_password', :with => user.password
+      click_button 'Log In'
+    end
+
+    it "should render the dashboard" do
+      current_path.should == root_path
+    end
+  end
+
+  context "with invalid password" do
+    before do
+      fill_in 'user_session_username', :with => user.username
+      fill_in 'user_session_password', :with => 'invalid'
+      click_button 'Log In'
+    end
+
+    it "should render the new user sessions page with apppropriate errors" do
+      current_path.should == user_sessions_path
+      page.should have_selector '#error_explanation'
+      page.should have_content 'Password is not valid'
+    end
+  end
+
+  context "with invalid username" do
+    before do
+      fill_in 'user_session_username', :with => 'invalid'
+      fill_in 'user_session_password', :with => user.password
+      click_button 'Log In'
+    end
+
+    it "should render the new user sessions page with apppropriate errors" do
+      current_path.should == user_sessions_path
+      page.should have_selector '#error_explanation'
+      page.should have_content 'Username is not valid'
+    end
+  end
+  context "with no credentials" do
+    before do
+      click_button 'Log In'
+    end
+
+    it "should render the new user sessions page with apppropriate errors" do
+      current_path.should == user_sessions_path
+      page.should have_selector '#error_explanation'
+      page.should have_content 'You did not provide any details for authentication.'
+    end
+  end
+end


Mime
View raw message