canmoia 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/canmoia/concerns/order.rb +1 -1
- data/lib/canmoia/version.rb +1 -1
- data/spec/concerns/order_spec.rb +1 -41
- data/spec/dummy/app/models/item.rb +6 -1
- data/spec/dummy/log/test.log +1207 -0
- data/spec/fabricators/item_fabricator.rb +2 -2
- data/spec/support/example_groups/canmoia_order_group.rb +41 -0
- data/tmp/rspec_guard_result +1 -1
- metadata +4 -4
- data/spec/#spec_helper.rb# +0 -46
@@ -1,5 +1,5 @@
|
|
1
1
|
Fabricator(:item) do
|
2
|
-
|
3
|
-
quantity
|
2
|
+
product_price { Forgery::Monetary.money(max: 10000).to_f }
|
3
|
+
quantity { Forgery::Basic.number at_most: 1000 }
|
4
4
|
# TODO for more realistic testing on the future product
|
5
5
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
shared_examples :canmoia_order do
|
4
|
+
|
5
|
+
it 'should include Camnoia::Order module ' do
|
6
|
+
order = Fabricate :order
|
7
|
+
order.class.included_modules.should include Canmoia::Order
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should define core domain states for a Order' do
|
11
|
+
order = Fabricate :order # Order class must include Canmoia::Order
|
12
|
+
order.should respond_to :opened?
|
13
|
+
order.should respond_to :reviewing?
|
14
|
+
order.should respond_to :accepted?
|
15
|
+
order.should respond_to :rejected?
|
16
|
+
order.should respond_to :canceled?
|
17
|
+
order.should respond_to :completed?
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should compute total price in opened state ' do
|
21
|
+
order = Fabricate :order
|
22
|
+
first_item = order.items.first
|
23
|
+
|
24
|
+
order.items.sum(&:price).should == order.total
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should not compute total price after opened state' do
|
28
|
+
order = Fabricate :order
|
29
|
+
first_item = order.items.first
|
30
|
+
|
31
|
+
order.close!
|
32
|
+
|
33
|
+
closed_total = order.total
|
34
|
+
|
35
|
+
first_item.product_price += 1
|
36
|
+
|
37
|
+
order.total.should == closed_total
|
38
|
+
end
|
39
|
+
|
40
|
+
# it 'should ignore workflow_column call if workflow_column already called'
|
41
|
+
end
|
data/tmp/rspec_guard_result
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
./spec/concerns/work_spec.rb:16
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canmoia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Heitor Salazar Baldelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -340,11 +340,11 @@ files:
|
|
340
340
|
- spec/fabricators/user_fabricator.rb
|
341
341
|
- spec/spec_helper.rb
|
342
342
|
- spec/support/concern_macros.rb
|
343
|
+
- spec/support/example_groups/canmoia_order_group.rb
|
343
344
|
- spec/support/fabrication.rb
|
344
345
|
- spec/support/fabricator.rb
|
345
346
|
- spec/support/mailer_macros.rb
|
346
347
|
- tmp/rspec_guard_result
|
347
|
-
- spec/#spec_helper.rb#
|
348
348
|
homepage: http://indefini.do
|
349
349
|
licenses:
|
350
350
|
- WTFP
|
@@ -370,7 +370,6 @@ signing_key:
|
|
370
370
|
specification_version: 4
|
371
371
|
summary: Canmöia (can = order, möia = work). The core functionality of Order domain.
|
372
372
|
test_files:
|
373
|
-
- spec/#spec_helper.rb#
|
374
373
|
- spec/concerns/order_spec.rb
|
375
374
|
- spec/concerns/work_spec.rb
|
376
375
|
- spec/dummy/app/assets/javascripts/application.js
|
@@ -419,6 +418,7 @@ test_files:
|
|
419
418
|
- spec/fabricators/user_fabricator.rb
|
420
419
|
- spec/spec_helper.rb
|
421
420
|
- spec/support/concern_macros.rb
|
421
|
+
- spec/support/example_groups/canmoia_order_group.rb
|
422
422
|
- spec/support/fabrication.rb
|
423
423
|
- spec/support/fabricator.rb
|
424
424
|
- spec/support/mailer_macros.rb
|
data/spec/#spec_helper.rb#
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# Configure Rails Envinronment
|
2
|
-
ENV["RAILS_ENV"] ||= "test"
|
3
|
-
|
4
|
-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
-
|
6
|
-
require 'rspec/rails'
|
7
|
-
require 'rspec/autorun'
|
8
|
-
require 'rails/mongoid'
|
9
|
-
|
10
|
-
require 'email_spec'
|
11
|
-
require 'fabrication'
|
12
|
-
require 'forgery'
|
13
|
-
require 'database_cleaner'
|
14
|
-
|
15
|
-
Rails.backtrace_cleaner.remove_silencers!
|
16
|
-
|
17
|
-
ENGINE_ROOT_DIR = File.dirname(File.expand_path File.join(__FILE__, '..'))
|
18
|
-
|
19
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
20
|
-
# in spec/support/ and its subdirectories.
|
21
|
-
Dir["#{ENGINE_ROOT_DIR}/spec/support/**/*.rb"].each { |f| require f }
|
22
|
-
|
23
|
-
RSpec.configure do |config|
|
24
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
25
|
-
config.run_all_when_everything_filtered = true
|
26
|
-
config.filter_run :focus
|
27
|
-
|
28
|
-
# Email support
|
29
|
-
RSpec.configure do |config|
|
30
|
-
config.include EmailSpec::Helpers
|
31
|
-
config.include EmailSpec::Matchers
|
32
|
-
config.include MailerMacros
|
33
|
-
end
|
34
|
-
|
35
|
-
# Database Cleaner support
|
36
|
-
config.before(:each) do
|
37
|
-
DatabaseCleaner.strategy = :truncation, {:except => %w[ ]}
|
38
|
-
DatabaseCleaner.clean
|
39
|
-
end
|
40
|
-
|
41
|
-
# Run specs in random order to surface order dependencies. If you find an
|
42
|
-
# order dependency and want to debug it, you can fix the order by providing
|
43
|
-
# the seed, which is printed after each run.
|
44
|
-
# --seed 1234
|
45
|
-
config.order = 'random'
|
46
|
-
end
|