Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleaned up Test Environment for Local Testing, Added Ordering tests

  • Loading branch information...
commit aa89229b0a7b99f481e8162cd827f3dad87c3849 1 parent 128aee3
@mattvv mattvv authored
View
1  lib/parse_resource/base.rb
@@ -155,7 +155,6 @@ def create_setters_and_getters!
# @param [String] app_id the Application ID of your Parse database
# @param [String] master_key the Master Key of your Parse database
def self.load!(app_id, master_key)
- puts "App ID #{app_id} and Master key #{master_key}"
@@settings = {"app_id" => app_id, "master_key" => master_key}
end
View
2  test/active_model_lint_test.rb
@@ -1,8 +1,6 @@
require 'helper'
require 'parse_resource'
-#path = "parse_resource.yml"
-#settings = YAML.load(ERB.new(File.new(path).read).result)['test']
ParseResource::Base.load!(ENV["PARSE_RESOURCE_APPLICATION_ID"], ENV["PARSE_RESOURCE_MASTER_KEY"])
class Bowl < ParseResource
View
10 test/helper.rb
@@ -11,6 +11,13 @@
require 'vcr'
require 'webmock/test_unit'
+if ENV["PARSE_RESOURCE_APPLICATION_ID"].nil? && ENV["PARSE_RESOURCE_MASTER_KEY"].nil?
+ path = "parse_resource.yml"
+ settings = YAML.load(ERB.new(File.new(path).read).result)['test']
+ ENV["PARSE_RESOURCE_APPLICATION_ID"] = settings['app_id']
+ ENV["PARSE_RESOURCE_MASTER_KEY"] = settings['master_key']
+end
+
VCR.configure do |c|
c.cassette_library_dir = 'fixtures/vcr_cassettes'
c.hook_into :webmock # or :fakeweb
@@ -22,8 +29,5 @@
$LOAD_PATH << File.expand_path( File.dirname(__FILE__) + '/../lib/' )
require 'parse_resource'
-
-
-
class Test::Unit::TestCase
end
View
4 test/test_parse_resource.rb
@@ -1,10 +1,6 @@
require 'helper'
require 'parse_resource'
-#path = "parse_resource.yml"
-#settings = YAML.load(ERB.new(File.new(path).read).result)['test']
-#ParseResource::Base.load!(settings['app_id'], settings['master_key'])
-
ParseResource::Base.load!(ENV["PARSE_RESOURCE_APPLICATION_ID"], ENV["PARSE_RESOURCE_MASTER_KEY"])
class Post < ParseResource::Base
View
4 test/test_parse_user.rb
@@ -1,10 +1,6 @@
require 'helper'
require 'parse_resource'
-#path = "parse_resource.yml"
-#settings = YAML.load(ERB.new(File.new(path).read).result)['test']
-#ParseResource::Base.load!(settings['app_id'], settings['master_key'])
-
ParseResource::Base.load!(ENV["PARSE_RESOURCE_APPLICATION_ID"], ENV["PARSE_RESOURCE_MASTER_KEY"])
View
37 test/test_query_options.rb
@@ -1,9 +1,6 @@
require 'helper'
require 'parse_resource'
-#path = "parse_resource.yml"
-#settings = YAML.load(ERB.new(File.new(path).read).result)['test']
-#ParseResource::Base.load!(settings['app_id'], settings['master_key'])
ParseResource::Base.load!(ENV["PARSE_RESOURCE_APPLICATION_ID"], ENV["PARSE_RESOURCE_MASTER_KEY"])
@@ -21,15 +18,31 @@ class TestQueryOptions < Test::Unit::TestCase
# Event.destroy_all
#end
- #def test_order
- # e1 = Event.create(:name => "1st")
- # e2 = Event.create(:name => "2nd")
- # events = Event.order("created_at").all
- # puts events[0].created_at
- # puts events[1].created_at
- # assert_equal true, (events[0].created_at < events[1].created_at)
- # Event.destroy_all
- #end
+ def test_order_descending
+ e1 = Event.create(:name => "1st")
+ e2 = Event.create(:name => "2nd")
+ events = Event.order("name desc").all
+ Event.destroy_all
+ assert_equal true, (events[0].name == "2nd")
+ end
+
+ def test_order_ascending
+ e1 = Event.create(:name => "1st")
+ e2 = Event.create(:name => "2nd")
+ events = Event.order("name asc").all
+ Event.destroy_all
+ assert_equal true, (events[0].name == "1st")
+ end
+
+ def test_order_no_field
+ e1 = Event.create(:name => "1st")
+ e2 = Event.create(:name => "2nd")
+ events = Event.order("desc").all
+ Event.destroy_all
+ puts events[0].name
+ puts events[1].name
+ assert_equal true, (events[0].name == "1st")
+ end
def test_skip
VCR.use_cassette('test_skip', :record => :new_episodes) do
Please sign in to comment.
Something went wrong with that request. Please try again.