Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

start fixing specs.

  • Loading branch information...
commit 89c4f2384d6c7c5f4247589f49c830ad25216989 1 parent dc59d59
@kookster kookster authored
View
4 Gemfile.lock
@@ -62,7 +62,7 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (!= 1.3.0, ~> 1.1)
- sqlite3-ruby (1.3.2)
+ sqlite3 (1.3.5)
tilt (1.3.3)
tzinfo (0.3.31)
yamler (0.1.0)
@@ -77,4 +77,4 @@ DEPENDENCIES
rake
rcov
rspec
- sqlite3-ruby
+ sqlite3
View
2  apn_on_rails.gemspec
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('rake')
s.add_development_dependency('autotest')
- s.add_development_dependency('sqlite3-ruby')
+ s.add_development_dependency('sqlite3')
s.add_development_dependency('rspec')
s.add_development_dependency('bundler')
s.add_development_dependency('rcov')
View
6 generators/templates/apn_migrations/003_alter_apn_devices.rb
@@ -9,10 +9,8 @@ class Device < ActiveRecord::Base # :nodoc:
def self.up
add_column :apn_devices, :last_registered_at, :datetime
- APN::Device.all.each do |device|
- device.last_registered_at = device.created_at
- device.save!
- end
+ execute 'update apn_devices set last_registered_at = created_at'
+
change_column :apn_devices, :token, :string, :size => 100, :null => false
add_index :apn_devices, :token, :unique => true
end
View
7 generators/templates/apn_migrations/004_create_apn_apps.rb
@@ -1,4 +1,11 @@
class CreateApnApps < ActiveRecord::Migration # :nodoc:
+
+ module APN # :nodoc:
+ class Device < ActiveRecord::Base # :nodoc:
+ set_table_name 'apn_devices'
+ end
+ end
+
def self.up
create_table :apn_apps do |t|
t.text :apn_dev_cert
View
12 generators/templates/apn_migrations/010_alter_apn_notifications.rb
@@ -7,15 +7,15 @@ class Notification < ActiveRecord::Base # :nodoc:
end
def self.up
- unless APN::Notification.column_names.include?("custom_properties")
- add_column :apn_notifications, :custom_properties, :text
- end
+ # unless APN::Notification.column_names.include?("custom_properties")
+ add_column(:apn_notifications, :custom_properties, :text) rescue nil
+ # end
end
def self.down
- if APN::Notification.column_names.include?("custom_properties")
- remove_column :apn_notifications, :custom_properties
- end
+ # if APN::Notification.column_names.include?("custom_properties")
+ remove_column(:apn_notifications, :custom_properties) rescue nil
+ # end
end
end
View
2  lib/apn_on_rails/app/models/apn/base.rb
@@ -1,5 +1,7 @@
module APN
class Base < ActiveRecord::Base # :nodoc:
+
+ self.abstract_class = true
def self.table_name # :nodoc:
self.to_s.gsub("::", "_").tableize
View
3  spec/active_record/setup_ar.rb
@@ -1,5 +1,7 @@
require 'rubygems'
require 'active_record'
+require 'logger'
+
logger = Logger.new(STDOUT)
logger.level = Logger::INFO
@@ -7,7 +9,6 @@
db_file = File.join(File.dirname(__FILE__), 'test.db')
FileUtils.rm(db_file) if File.exists?(db_file)
-# File.open(db_file, 'w')
ActiveRecord::Base.establish_connection({
:adapter => 'sqlite3',
View
3  spec/apn_on_rails/app/models/apn/device_spec.rb
@@ -5,7 +5,8 @@
describe 'token' do
it 'should be unique' do
- device = DeviceFactory.new(:token => APN::Device.first.token)
+ t = APN::Device.first.token
+ device = DeviceFactory.new(:token => t)
device.should_not be_valid
device.errors['token'].should include('has already been taken')
View
15 spec/spec_helper.rb
@@ -1,3 +1,4 @@
+require 'rubygems'
require 'rspec'
require 'action_view'
@@ -9,9 +10,17 @@
require File.join(File.dirname(__FILE__), '..', 'lib', 'apn_on_rails')
-Dir.glob(File.join(File.dirname(__FILE__), 'factories', '*.rb')).sort.each do |f|
- require f
-end
+# Dir.glob(File.join(File.dirname(__FILE__), 'factories', '*.rb')).sort.each do |f|
+# require f
+# end
+
+require File.join(File.dirname(__FILE__), 'factories', 'app_factory.rb')
+require File.join(File.dirname(__FILE__), 'factories', 'device_factory.rb')
+require File.join(File.dirname(__FILE__), 'factories', 'group_factory.rb')
+require File.join(File.dirname(__FILE__), 'factories', 'device_grouping_factory.rb')
+require File.join(File.dirname(__FILE__), 'factories', 'group_notification_factory.rb')
+require File.join(File.dirname(__FILE__), 'factories', 'notification_factory.rb')
+require File.join(File.dirname(__FILE__), 'factories', 'pull_notification_factory.rb')
configatron.apn.cert = File.expand_path(File.join(File.dirname(__FILE__), 'rails_root', 'config', 'apple_push_notification_development.pem'))
Please sign in to comment.
Something went wrong with that request. Please try again.