Skip to content
Browse files

Deleted old shoulda tests, using rspec now.

  • Loading branch information...
1 parent 3cdba9c commit e4193849c2f246d23cefacaaab8a69f106e7c91b @rubiety committed
Showing with 0 additions and 129 deletions.
  1. +0 −18 test/config/database.yml
  2. +0 −85 test/nilify_blanks_test.rb
  3. +0 −12 test/schema.rb
  4. +0 −14 test/test_helper.rb
View
18 test/config/database.yml
@@ -1,18 +0,0 @@
-sqlite:
- :adapter: sqlite
- :dbfile: nilify_blanks_plugin.sqlite
-sqlite3:
- :adapter: sqlite3
- :dbfile: nilify_blanks_plugin.sqlite3
-postgresql:
- :adapter: postgresql
- :username: postgres
- :password: postgres
- :database: nilify_blanks_plugin_test
- :min_messages: ERROR
-mysql:
- :adapter: mysql
- :host: localhost
- :username: root
- :password:
- :database: nilify_blanks_plugin_test
View
85 test/nilify_blanks_test.rb
@@ -1,85 +0,0 @@
-require File.join(File.dirname(__FILE__), 'test_helper')
-
-class NilifyBlanksTest < Test::Unit::TestCase
- context "Model with nilify_blanks" do
- setup do
- class Post < ActiveRecord::Base
- nilify_blanks
- end
-
- @post = Post.new(:first_name => '', :last_name => '', :title => '', :summary => '', :body => '', :views => 0)
- @post.save
- end
-
- should "recognize all non-null columns" do
- assert_equal ['first_name', 'title', 'summary', 'body', 'views'], Post.nilify_blanks_columns
- end
-
- should "convert all blanks to nils" do
- assert_equal nil, @post.first_name
- assert_equal nil, @post.title
- assert_equal nil, @post.summary
- assert_equal nil, @post.body
- end
-
- should "leave not-null last name field alone" do
- assert_equal '', @post.last_name
- end
-
- should "leave integer views field alone" do
- assert_equal 0, @post.views
- end
- end
-
- context "Model with nilify_blanks :only => [:first_name, :title]" do
- setup do
- class PostOnlyFirstNameAndTitle < ActiveRecord::Base
- set_table_name :posts
- nilify_blanks :only => [:first_name, :title]
- end
-
- @post = PostOnlyFirstNameAndTitle.new(:first_name => '', :last_name => '', :title => '', :summary => '', :body => '', :views => 0)
- @post.save
- end
-
- should "recognize only first_name and title" do
- assert_equal ['first_name', 'title'], PostOnlyFirstNameAndTitle.nilify_blanks_columns
- end
-
- should "convert first_name and title blanks to nils" do
- assert_equal nil, @post.first_name
- assert_equal nil, @post.title
- end
-
- should "leave other fields alone" do
- assert_equal '', @post.summary
- assert_equal '', @post.body
- end
- end
-
- context "Model with nilify_blanks :except => [:first_name, :title]" do
- setup do
- class PostExceptFirstNameAndTitle < ActiveRecord::Base
- set_table_name :posts
- nilify_blanks :except => [:first_name, :title]
- end
-
- @post = PostExceptFirstNameAndTitle.new(:first_name => '', :last_name => '', :title => '', :summary => '', :body => '', :views => 0)
- @post.save
- end
-
- should "recognize only summary, body, and views" do
- assert_equal ['summary', 'body', 'views'], PostExceptFirstNameAndTitle.nilify_blanks_columns
- end
-
- should "convert summary and body blanks to nils" do
- assert_equal nil, @post.summary
- assert_equal nil, @post.body
- end
-
- should "leave other fields alone" do
- assert_equal '', @post.first_name
- assert_equal '', @post.title
- end
- end
-end
View
12 test/schema.rb
@@ -1,12 +0,0 @@
-ActiveRecord::Schema.define(:version => 0) do
-
- create_table :posts, :force => true do |t|
- t.string :first_name
- t.string :last_name, :null => false
- t.string :title
- t.text :summary
- t.text :body
- t.integer :views
- end
-
-end
View
14 test/test_helper.rb
@@ -1,14 +0,0 @@
-require 'test/unit'
-require 'rubygems'
-require 'active_record'
-require 'active_record/fixtures'
-require 'shoulda/rails'
-require File.expand_path(File.join(File.dirname(__FILE__), '../lib/nilify_blanks'))
-
-config = YAML::load(IO.read(File.join(File.dirname(__FILE__), 'config', '/database.yml')))
-ActiveRecord::Base.configurations = {'test' => config[ENV['DB'] || 'sqlite3']}
-ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
-
-load(File.dirname(__FILE__) + "/schema.rb")
-
-require File.expand_path(File.join(File.dirname(__FILE__), '../init'))

0 comments on commit e419384

Please sign in to comment.
Something went wrong with that request. Please try again.