motion-prime 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGVhYzU1YWVlZDBhZTZlMzhkY2VjYjA0Y2ZiMGM4YjAyZTQyZDIyZA==
4
+ NmUyZDc0MTg4NTY2NDE5MzMwNjI1NDgxMjI2ZDIzYzIwNWEzMWI5Nw==
5
5
  data.tar.gz: !binary |-
6
- NmFkNjhlMzIyYWRlNzdkYzUxM2VlZGE4ZWZjNDYzYmIwYThhOTZmZQ==
6
+ ZGJkMWQ4NWM0NjVhMzVhMWI1NzBjMGM2M2EyNTE3ZDllZjhjNjBjMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTJhOGI3ZTNkMzNlY2E4ZTI5Yzk1ZDNlZTYyNTRiNTM4ZjU4NGY2ZDlhOWRk
10
- ZGNlNjlhM2FlMDcxNmQ3YWI2Zjk4ZmE5MzY2OTY0ZjRiOTQ5YTU2ODY3YTY4
11
- OGYxZmJlN2E4M2MyMjA4MjllODRmNDYyNTFiMGY2NGIyZTYwNTA=
9
+ MjNjNjNiMGEzMzVlOTAwM2EyNTkxZDlhZGY2YmMwMGE2ZDk2ZTIyNWUwNjYw
10
+ YmYxNDRjOThiZGJlM2IxNTNkZWNiMzI5ZjcyNDZmY2I3YWEwNjQ0MjYzNmMx
11
+ MzlmMjk1YjI0MjZjMGE1NTg4NDFkMzlkNTgwZTczZWUwMDZmZDE=
12
12
  data.tar.gz: !binary |-
13
- MzczYzhkMjM0ZmJjYmExZTcxZTE0ZTExNzFkNDliNDg4NGFjYWFlNTdiOGVk
14
- ODE4MzI1OGMxNmI1MDE1NGU0NjEyODY2YWNjMDQ3Zjg0Mjc3ZmVmNTQ4OWE3
15
- YzQ0YmU5YjFiNjg3ODIyYTE0ODI4MTBkMDM2MjQ0NjhjY2Q3MDU=
13
+ NTE1MzZiZDA2NWMwOWQ4YjdjNThmNjMzMmMwOTY2ZGY4Y2IwZGU0OWFmMjc0
14
+ ZjMxZjg1Yjc4MDkwZGZlYzgwZTlkNDM2YTZiYzE0ODQ5M2FlNGVmZGFhN2Rl
15
+ MTRjZjMwNzVkMmYyNmM1NzUzZTg3Y2ZkNzczZTI5YjRiNDFiYTM=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.8.1
2
+ * renamed submit element in submit field to button element.
3
+ * renamed date_picker element in date_picker field to input element.
4
+ * improved model associations.
5
+ * bug fixes.
6
+
1
7
  === 0.8.0
2
8
  * Simpler syntax for using fonts. See prime_bootstrap.
3
9
  * All style things moved from default prime template to bootstrap template.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- motion-prime (0.8.0)
4
+ motion-prime (0.8.1)
5
5
  afmotion (~> 2.0.0)
6
6
  bubble-wrap (~> 1.4.0)
7
7
  cocoapods
data/README.md CHANGED
@@ -11,19 +11,19 @@ MotionPrime is yet another framework written on RubyMotion for creating really f
11
11
 
12
12
  ## Getting Started
13
13
 
14
- ### 1. Install MotionPrime:
14
+ #### 1. Install MotionPrime:
15
15
 
16
16
  $ gem install motion-prime
17
17
 
18
- ### 2. Create empty MotionPrime project:
19
-
20
- $ prime new myapp
21
-
22
- ### 3. Or create bootstrap MotionPrime project:
18
+ #### 2a. Create [bootstrap](https://github.com/motionprime/prime_bootstrap) project:
23
19
 
24
20
  $ prime bootstrap myapp
25
21
 
26
- ### 4. Run application
22
+ #### 2b. OR create empty project:
23
+
24
+ $ prime new myapp
25
+
26
+ #### 3. Run application
27
27
 
28
28
  $ rake
29
29
 
data/ROADMAP.md CHANGED
@@ -1,7 +1,5 @@
1
- === 0.8.1
2
- * rename submit element in submit field to button element
3
- * rename date_picker element in date_picker field to input element
4
- * Rename model to data in sections.
1
+ === 0.8.2
2
+ * Move api_client and model sync mixin to prime_api gem.
5
3
 
6
4
  === 0.9.0
7
5
  * bug: if mp label do not have text and was set as hidden, it should unhide after setting text
@@ -21,4 +19,5 @@
21
19
  * add cell preload for reverse scrolling table.
22
20
  * add computed_options.get(), this will allow to make sure that options is computed.
23
21
  * add testing framework
24
- * add DSL for ViewStyles#setValue conditions
22
+ * add DSL for ViewStyles#setValue conditions
23
+ * add embed/regular has many types. embedded by default.
data/files/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'http://rubygems.org'
3
3
  gem 'motion-cocoapods', '~> 1.4.0'
4
4
  gem 'motion-support', '~> 0.2.4'
5
5
 
6
- gem 'motion-prime', '0.7.2'
6
+ gem 'motion-prime', '0.8.1'
7
7
 
8
8
  # add reside menu for sidebar support
9
9
  gem 'prime_reside_menu', '~> 0.1.4'
@@ -1,5 +1,5 @@
1
1
  class AppDelegate < Prime::BaseAppDelegate
2
2
  def on_load(app, options)
3
- open_screen :home, sidebar: true
3
+ # open_screen :home, sidebar: true
4
4
  end
5
5
  end
@@ -113,6 +113,13 @@ module MotionPrime
113
113
  if is_cell_section
114
114
  @styles += compute_cell_style_options(style_sources, has_errors)
115
115
  end
116
+
117
+ # styles got from mixins option
118
+ mixin_styles = style_sources.map do |source|
119
+ normalize_object(source.delete(:mixins), section)
120
+ end.flatten.map{ |m| :"_mixin_#{m}" }
121
+ @styles += mixin_styles
122
+
116
123
  # don't use present? here, it's slower, while this method should be very fast
117
124
  if section && section.name && section.name != '' && name && name != ''
118
125
  # using for base sections
@@ -123,13 +130,7 @@ module MotionPrime
123
130
  normalize_object(source.delete(:styles), section)
124
131
  end.flatten
125
132
 
126
- # styles got from mixins option
127
- mixin_styles = style_sources.map do |source|
128
- normalize_object(source.delete(:mixins), section)
129
- end.flatten.map{ |m| :"_mixin_#{m}" }
130
-
131
133
  @styles += custom_styles
132
- @styles += mixin_styles
133
134
  # puts @view_class.to_s + @styles.inspect, ''
134
135
  @styles
135
136
  end
@@ -22,9 +22,9 @@ module MotionPrime
22
22
  #
23
23
  # @param key [Symbol] association name
24
24
  # @return url [String] url to use in model association sync
25
- def association_sync_url(key, options)
25
+ def association_sync_url(key, options, sync_options = {})
26
26
  url = options[:sync_url]
27
- url = url.call(self) if url.is_a?(Proc)
27
+ url = url.call(self, sync_options) if url.is_a?(Proc)
28
28
  normalize_sync_url(url)
29
29
  end
30
30
 
@@ -228,7 +228,7 @@ module MotionPrime
228
228
  def fetch_has_many(key, options = {}, sync_options = {}, &block)
229
229
  use_callback = block_given?
230
230
  NSLog("SYNC: started sync for #{key} in #{self.class_name_without_kvo}")
231
- api_client.get association_sync_url(key, options) do |response, status_code|
231
+ api_client.get association_sync_url(key, options, sync_options) do |response, status_code|
232
232
  data = options[:sync_key] && response ? response[options[:sync_key]] : response
233
233
  if data
234
234
  fetch_has_many_with_attributes(key, data, sync_options)
@@ -251,7 +251,7 @@ module MotionPrime
251
251
  model = old_collection.detect{ |model| model.id == attributes[:id]}
252
252
  unless model
253
253
  model = model_class.new
254
- self.send(:"#{key}_bag") << model
254
+ self.send(key).add(model)
255
255
  end
256
256
  model.fetch_with_attributes(attributes, save_associations: sync_options[:save])
257
257
  model.save if sync_options[:save] && model.has_changed?
@@ -267,10 +267,10 @@ module MotionPrime
267
267
  self.store.save_interval = 1
268
268
  end
269
269
 
270
- def fetch_has_one(key, options = {}, &block)
270
+ def fetch_has_one(key, options = {}, sync_options = {}, &block)
271
271
  use_callback = block_given?
272
272
  NSLog("SYNC: started sync for #{key} in #{self.class_name_without_kvo}")
273
- api_client.get association_sync_url(key, options) do |response, status_code|
273
+ api_client.get association_sync_url(key, options, sync_options) do |response, status_code|
274
274
  data = options.has_key?(:sync_key) ? response[options[:sync_key]] : response
275
275
  if data.present?
276
276
  fetch_has_one_with_attributes(key, data, save_associations: sync_options[:save])
@@ -20,64 +20,102 @@ module MotionPrime
20
20
  super all(*args)
21
21
  end
22
22
 
23
+ # Initialize a new object and add to collection.
24
+ #
25
+ # @example:
26
+ # project.users.new(name: "Bob", age: 10)
27
+ #
28
+ # @params attributes [Hash] attributes beeing assigned to model
29
+ # @return MotionPrime::Model unsaved model
23
30
  def new(attributes = {})
24
- model_class.new(attributes).tap do |model|
31
+ record = model_class.new(attributes).tap do |model|
25
32
  set_inverse_relation_for(model)
26
33
  end
34
+ add(record)
27
35
  end
28
36
 
29
- def define_inverse_relation(options)
30
- # TODO: handle different relation types (habtm, has_one...)
31
- @inverse_relation_name = name = options[:name].to_sym
32
- self.class_eval do
33
- define_method name do
34
- options[:instance]
35
- end
36
- alias_method :inverse_relation, name
37
- end
38
-
39
- @inverse_relation_key = inverse_relation._associations[association_name][:foreign_key].try(:to_sym)
37
+ # Add model record to association collection.
38
+ #
39
+ # @example:
40
+ # project.users.new(name: "Bob", age: 10)
41
+ #
42
+ # @params record [Prime::Model] model which will be added to collection.
43
+ # @return MotionPrime::Model model
44
+ def add(record)
45
+ self.bag << record
46
+ record
40
47
  end
41
48
 
42
- def all(*args)
43
- return [] unless bag.store.present?
44
- find_options = find_options(args[0])
45
- sort_options = sort_options(args[1])
46
- data = if sort_options.present? # TODO: check bag items count
49
+ # Return all association records.
50
+ #
51
+ # @example:
52
+ # project.users.all
53
+ # project.users.all(age: 10)
54
+ #
55
+ # @params find_options [Hash] finder options.
56
+ # @params sort_options [Hash] sorting options.
57
+ # @return Array<MotionPrime::Model> association records
58
+ def all(find_options = nil, sort_options = nil)
59
+ find_options = build_find_options(find_options)
60
+ sort_options = build_sort_options(sort_options)
61
+
62
+ data = if bag.store.present?
47
63
  bag.find(find_options, sort_options)
48
64
  else
49
- bag.to_a.select { |entity| find_options.all? { |field, value| entity.send(field) == value } }
65
+ bag.to_a.select do |entity|
66
+ find_options.all? { |field, value| entity.info[field] == value }
67
+ end
50
68
  end
51
69
  set_inverse_relation_for(data)
52
70
  data
53
71
  end
54
72
 
55
- def set_inverse_relation_for(models)
56
- [*models].each do |model|
57
- model.send("#{inverse_relation_name}=", inverse_relation)
58
- end if model_inverse_relation_name.present?
59
- end
60
-
61
- def find_options(options)
62
- options ||= {}
63
- options.merge!(bag_key: bag.key)
64
- if inverse_relation_key.present?
65
- {inverse_relation_key => inverse_relation.id}.merge options
66
- else
67
- options
68
- end
69
- end
70
-
71
- def sort_options(options)
72
- options || {sort: model_class.default_sort_options}
73
- end
74
-
75
73
  def model_class
76
74
  @model_class ||= @association_name.classify.constantize
77
75
  end
78
76
 
77
+ # Remove all association records.
78
+ #
79
+ # @example:
80
+ # project.users.delete_all
81
+ #
82
+ # @return Array<MotionPrime::Model> association records
79
83
  def delete_all
80
84
  all.each { |obj| obj.delete }
81
85
  end
86
+
87
+ private
88
+ def build_find_options(options)
89
+ options ||= {}
90
+ options.merge!(bag_key: bag.key)
91
+ if inverse_relation_key.present?
92
+ {inverse_relation_key => inverse_relation.id}.merge options
93
+ else
94
+ options
95
+ end
96
+ end
97
+
98
+ def build_sort_options(options)
99
+ options || {sort: model_class.default_sort_options}
100
+ end
101
+
102
+ def set_inverse_relation_for(models)
103
+ [*models].each do |model|
104
+ model.send("#{inverse_relation_name}=", inverse_relation)
105
+ end if model_inverse_relation_name.present?
106
+ end
107
+
108
+ def define_inverse_relation(options)
109
+ # TODO: handle different relation types (habtm, has_one...)
110
+ @inverse_relation_name = name = options[:name].to_sym
111
+ self.class_eval do
112
+ define_method name do
113
+ options[:instance]
114
+ end
115
+ alias_method :inverse_relation, name
116
+ end
117
+
118
+ @inverse_relation_key = inverse_relation._associations[association_name][:foreign_key].try(:to_sym)
119
+ end
82
120
  end
83
121
  end
@@ -23,14 +23,15 @@ module MotionPrime
23
23
  return unless section_options
24
24
  @sections = {}
25
25
  section_options.map do |name, options|
26
- @sections[name] = create_section(options.clone)
26
+ section = create_section(options.clone)
27
+ @sections[name] = section if section
27
28
  end
28
29
  end
29
30
 
30
31
  def create_section(options)
31
32
  section_class = class_factory("#{options.delete(:name)}_section")
32
33
  options = normalize_options(options).merge(screen: self)
33
- section_class.new(options)
34
+ !options.has_key?(:if) || options[:if] ? section_class.new(options) : nil
34
35
  end
35
36
 
36
37
  def render_sections
@@ -4,14 +4,14 @@ module MotionPrime
4
4
  element :label, type: :label do
5
5
  default_label_options
6
6
  end
7
- element :date_picker, type: :date_picker do
7
+ element :input, type: :date_picker do
8
8
  options[:input] || {}
9
9
  end
10
10
 
11
- after_render :bind_date_picker
11
+ after_render :bind_input
12
12
 
13
- def bind_date_picker
14
- picker = view(:date_picker)
13
+ def bind_input
14
+ picker = view(:input)
15
15
  picker.setDelegate form
16
16
  unless picker.date
17
17
  picker.setDate NSDate.date, animated: true
@@ -22,7 +22,7 @@ module MotionPrime
22
22
  end
23
23
 
24
24
  def dealloc
25
- picker = view(:date_picker)
25
+ picker = view(:input)
26
26
  picker.setDelegate nil
27
27
  super
28
28
  end
@@ -1,14 +1,14 @@
1
1
  module MotionPrime
2
2
  class SubmitFieldSection < BaseFieldSection
3
- element :submit, type: :button do
3
+ element :button, type: :button do
4
4
  {title: options[:name].to_s.titleize}.merge(options[:button] || {})
5
5
  end
6
6
  element :error_message, type: :error_message, text: proc { all_errors.join("\n") if observing_errors? }
7
7
 
8
- after_render :bind_submit
8
+ after_render :bind_button
9
9
 
10
- def bind_submit
11
- view(:submit).on :touch do
10
+ def bind_button
11
+ view(:button).on :touch do
12
12
  form.send(options[:action]) if options[:action]
13
13
  end
14
14
  end
@@ -9,7 +9,7 @@ module MotionPrime
9
9
  # == Basic Sample
10
10
  # class MyLoginForm < MotionPrime::FormSection
11
11
  # field :email, label: { text: 'E-mail' }, input: { placeholder: 'Your E-mail' }
12
- # field :submit, title: 'Login', type: :submit
12
+ # field :submit, button: { title: 'Login' }, type: :submit, action: :on_submit
13
13
  #
14
14
  # def on_submit
15
15
  # email = view("email:input").text
@@ -46,11 +46,6 @@ MotionPrime::Styles.define :base do
46
46
  style :google_map,
47
47
  top: 0, left: 0, right: 0, bottom: 0
48
48
 
49
- style :date_picker, :form_field_date_picker,
50
- width: 300,
51
- height: 150,
52
- top: 30, left: 0
53
-
54
49
  style :spinner,
55
50
  annular: true,
56
51
  center: proc { screen.view.center }, width: 37, height: 37,
@@ -63,6 +63,11 @@ MotionPrime::Styles.define :base_form do
63
63
  top: 30,
64
64
  bottom: 0
65
65
 
66
+ style :date_field_input,
67
+ width: 300,
68
+ height: 150,
69
+ top: 30, left: 0
70
+
66
71
  style :select_field_button,
67
72
  background_color: :white,
68
73
  left: 0,
@@ -1,3 +1,3 @@
1
1
  module MotionPrime
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
@@ -33,6 +33,15 @@ class Autobot < MotionPrime::Model
33
33
  attribute :name
34
34
  end
35
35
 
36
+ class Organization < MotionPrime::Model
37
+ attribute :name
38
+ has_many :projects
39
+ end
40
+
41
+ class Project < MotionPrime::Model
42
+ attribute :title
43
+ end
44
+
36
45
  module CustomModule; end
37
46
  class CustomModule::Car < MotionPrime::Model
38
47
  attribute :name
@@ -40,8 +49,9 @@ class CustomModule::Car < MotionPrime::Model
40
49
  end
41
50
  Car = CustomModule::Car
42
51
 
43
- def stub_user(name, age, created_at)
52
+ def stub_user(name, age, created_at, id = nil)
44
53
  user = User.new
54
+ user.id = id || 1
45
55
  user.name = name
46
56
  user.age = age
47
57
  user.created_at = created_at
@@ -0,0 +1,57 @@
1
+ describe "Prime::AssociationCollection" do
2
+ before do
3
+ MotionPrime::Store.connect
4
+ end
5
+
6
+ after do
7
+ MotionPrime::Store.shared_store.clear
8
+ end
9
+
10
+ describe "#new" do
11
+ before do
12
+ @organization = Organization.new
13
+ @project = @organization.projects.new(title: 'test')
14
+ end
15
+
16
+ it "should instanciate model with given attributes" do
17
+ @project.title.should == 'test'
18
+ end
19
+
20
+ it "should add model to association collection" do
21
+ @organization.projects.include?(@project).should.be.true
22
+ end
23
+ end
24
+
25
+ describe "#add" do
26
+ before do
27
+ @organization = Organization.new
28
+ @project = Project.new(title: 'test')
29
+ @organization.projects.add(@project)
30
+ end
31
+
32
+ it "should add model to association collection" do
33
+ @organization.projects.include?(@project).should.be.true
34
+ end
35
+ end
36
+
37
+ describe "#all" do
38
+ before do
39
+ @organization = Organization.new
40
+ puts "count 1: #{@organization.projects.count}"
41
+ project = Project.new(title: 'test 1')
42
+ @organization.projects.add(project)
43
+ puts "count 2: #{@organization.projects.count}"
44
+ project = Project.new(title: 'test 2')
45
+ @organization.projects.add(project)
46
+ puts "count 3: #{@organization.projects.count}"
47
+ end
48
+
49
+ it "should return all records by default" do
50
+ @organization.projects.all.count.should == 2
51
+ end
52
+
53
+ it "should return filter records by first hash" do
54
+ @organization.projects.all(title: 'test 1').count.should == 1
55
+ end
56
+ end
57
+ end
@@ -3,7 +3,7 @@ describe "Prime::Model Finder" do
3
3
  MotionPrime::Store.connect
4
4
  @store = MotionPrime::Store.shared_store
5
5
 
6
- user = stub_user("Bob", 10, Time.now)
6
+ user = stub_user("Bob", 10, Time.now, 15)
7
7
  user.save
8
8
 
9
9
  user2 = stub_user("Amy", 11, Time.now)
@@ -18,8 +18,8 @@ describe "Prime::Model Finder" do
18
18
  end
19
19
 
20
20
  describe "::find" do
21
- it "search object traditional way: supply key, operator and value" do
22
- users = User.find(:name, NSFEqualTo, "Bob")
21
+ it "search object traditional way using id" do
22
+ users = User.find(15)
23
23
  users.should.not.be.nil
24
24
  users.is_a?(Array).should.be.true
25
25
 
@@ -100,31 +100,16 @@ describe "Prime::Model Finder" do
100
100
  user.age.should.be == 59
101
101
  end
102
102
 
103
- it "find object" do
104
- users = User.find(:name, NSFEqualTo, "Bob")
105
- users.size.should == 1
106
-
107
- user = users.first
108
- user.name.should == "Bob"
109
- user.class.should == User
110
- end
111
-
112
103
  it "find object with quote" do
113
104
  stub_user("Bob'd", 49, Time.now).save
114
105
 
115
- users = User.find(:name, NSFEqualTo, "Bob'd")
106
+ users = User.find(:name => { NSFEqualTo => "Bob'd"})
116
107
  users.size.should == 1
117
108
 
118
109
  user = users.first
119
110
  user.name.should == "Bob'd"
120
111
  user.class.should == User
121
112
  end
122
-
123
- it "only return objects of the class" do
124
- car = Car.create(:name => "Honda")
125
- Car.find.size.should == 1
126
- Car.find.first.key.should == car.key
127
- end
128
113
  end
129
114
 
130
115
  describe "::find_by_key" do
@@ -173,7 +158,9 @@ describe "Prime::Model Finder" do
173
158
  Car.all.size.should == 1
174
159
  Car.all.first.key.should == car.key
175
160
  end
161
+ end
176
162
 
163
+ describe "::find_keys" do
177
164
  it "only return objects of the class" do
178
165
  car = Car.create(:name => "Honda")
179
166
  Car.find_keys.size.should == 1
@@ -102,22 +102,22 @@ describe MotionPrime::Model do
102
102
  end
103
103
 
104
104
  it "update existing objects" do
105
- user = stub_user("Bob", 10, Time.now)
105
+ user = stub_user("Bob", 10, Time.now, 15)
106
106
  user.save
107
107
 
108
- user1 = User.find(:name, NSFEqualTo, "Bob").first
108
+ user1 = User.find(15).first
109
109
  user1.name = "Dom"
110
110
  user1.save
111
111
 
112
- user2 = User.find(:name, NSFEqualTo, "Dom").first
112
+ user2 = User.find(15).first
113
113
  user2.key.should == user.key
114
114
  end
115
115
 
116
116
  it "create with nil field" do
117
- user = stub_user("Bob", 10, nil)
117
+ user = stub_user("Bob", 10, nil, 15)
118
118
  user.save
119
119
 
120
- user1 = User.find(:name, NSFEqualTo, "Bob").first
120
+ user1 = User.find(15).first
121
121
  user1.name.should == "Bob"
122
122
  user1.created_at.should.be.nil
123
123
  end
@@ -125,10 +125,10 @@ describe MotionPrime::Model do
125
125
  it "create model in file store" do
126
126
  MotionPrime::Store.connect(:file)
127
127
 
128
- user = stub_user("Bob", 10, nil)
128
+ user = stub_user("Bob", 10, nil, 15)
129
129
  user.save
130
130
 
131
- user1 = User.find(:name, NSFEqualTo, "Bob").first
131
+ user1 = User.find(15).first
132
132
  user1.name.should == "Bob"
133
133
  user1.created_at.should.be.nil
134
134
 
@@ -142,6 +142,9 @@ describe MotionPrime::Model do
142
142
  end
143
143
 
144
144
  describe "without id" do
145
+ before do
146
+ @user.id = nil
147
+ end
145
148
  it "should not be persisted" do
146
149
  @user.persisted?.should == false
147
150
  end
@@ -167,15 +170,15 @@ describe MotionPrime::Model do
167
170
 
168
171
  describe "#delete" do
169
172
  it "delete object" do
170
- user = stub_user("Bob", 10, Time.now)
173
+ user = stub_user("Bob", 10, Time.now, 15)
171
174
  user.save
172
175
 
173
- users = User.find(:name, NSFEqualTo, "Bob")
176
+ users = User.find(15)
174
177
  users.should.not.be.nil
175
178
  users.count.should == 1
176
179
 
177
180
  user.delete
178
- users = User.find(:name, NSFEqualTo, "Bob")
181
+ users = User.find(15)
179
182
  users.should.not.be.nil
180
183
  users.count.should == 0
181
184
  User.count.should == 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-prime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Haziev
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-08 00:00:00.000000000 Z
12
+ date: 2014-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -355,6 +355,7 @@ files:
355
355
  - spec/helpers/init.rb
356
356
  - spec/helpers/models.rb
357
357
  - spec/helpers/screens.rb
358
+ - spec/models/association_collection_spec.rb
358
359
  - spec/models/associations_spec.rb
359
360
  - spec/models/bag_spec.rb
360
361
  - spec/models/errors_spec.rb
@@ -397,6 +398,7 @@ test_files:
397
398
  - spec/helpers/init.rb
398
399
  - spec/helpers/models.rb
399
400
  - spec/helpers/screens.rb
401
+ - spec/models/association_collection_spec.rb
400
402
  - spec/models/associations_spec.rb
401
403
  - spec/models/bag_spec.rb
402
404
  - spec/models/errors_spec.rb