rad_store 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +11 -0
- data/lib/components/store.rb +22 -0
- data/lib/components/store.yml +1 -0
- data/lib/store/factories.rb +12 -0
- data/lib/store/gems.rb +8 -0
- data/lib/store/spec.rb +1 -0
- data/readme.md +3 -0
- data/spec/controllers/products_spec.rb +26 -0
- data/spec/emptygit +0 -0
- data/spec/spec_helper.rb +10 -0
- metadata +76 -0
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
class Rad::Store
|
2
|
+
attr_writer :order_processing_email
|
3
|
+
def order_processing_email; @order_processing_email || raise("key store.order_processing_email not defined!") end
|
4
|
+
attr_accessor :currency
|
5
|
+
end
|
6
|
+
|
7
|
+
rad.register :store, depends_on: [:kit, :users] do
|
8
|
+
require 'store/gems'
|
9
|
+
|
10
|
+
rad.configure :web, "#{__FILE__}/../../.." do |c|
|
11
|
+
c.routes
|
12
|
+
c.locales
|
13
|
+
c.asset_paths 'app/static'
|
14
|
+
c.template_paths 'app/views'
|
15
|
+
c.autoload_paths %w(lib app)
|
16
|
+
end
|
17
|
+
|
18
|
+
# config
|
19
|
+
rad.kit.items.push(:product).uniq!
|
20
|
+
|
21
|
+
Rad::Store.new
|
22
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
currency: '$'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'kit/factories'
|
2
|
+
require 'users/factories'
|
3
|
+
|
4
|
+
Factory.define :product, class: 'Models::Product', parent: :item do |p|
|
5
|
+
p.sequence(:name){|i| "product_#{i}"}
|
6
|
+
p.text "cool product"
|
7
|
+
end
|
8
|
+
|
9
|
+
Factory.define :order, class: 'Models::Order' do |o|
|
10
|
+
o.name "Alex"
|
11
|
+
o.phone "8 920 456 78 31"
|
12
|
+
end
|
data/lib/store/gems.rb
ADDED
data/lib/store/spec.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'store/factories'
|
data/readme.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Notes" do
|
4
|
+
with_controllers
|
5
|
+
set_controller Controllers::Products
|
6
|
+
login_as :manager
|
7
|
+
|
8
|
+
it_should_behave_like "Items Controller CRUD"
|
9
|
+
|
10
|
+
it "buy :js" do
|
11
|
+
product = Factory.create :product
|
12
|
+
pcall :buy, id: product.to_param, format: 'js'
|
13
|
+
response.should be_ok
|
14
|
+
end
|
15
|
+
|
16
|
+
it "checkout :js" do
|
17
|
+
rad.store.stub!(:order_processing_email).and_return('store_owner@mail.com')
|
18
|
+
rad.users.stub!(:email).and_return("my_store.com")
|
19
|
+
|
20
|
+
product = Factory.create :product
|
21
|
+
order = Factory.attributes_for :order
|
22
|
+
pcall :checkout, id: product.to_param, order: order, format: 'js'
|
23
|
+
sent_letters.size.should == 1
|
24
|
+
response.should be_ok
|
25
|
+
end
|
26
|
+
end
|
data/spec/emptygit
ADDED
File without changes
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rad_store
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alexey Petrushin
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-09-22 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rad_kit
|
16
|
+
requirement: &2773990 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2773990
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rad_users
|
27
|
+
requirement: &2773750 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2773750
|
36
|
+
description:
|
37
|
+
email:
|
38
|
+
executables: []
|
39
|
+
extensions: []
|
40
|
+
extra_rdoc_files: []
|
41
|
+
files:
|
42
|
+
- Rakefile
|
43
|
+
- readme.md
|
44
|
+
- lib/components/store.rb
|
45
|
+
- lib/components/store.yml
|
46
|
+
- lib/store/factories.rb
|
47
|
+
- lib/store/gems.rb
|
48
|
+
- lib/store/spec.rb
|
49
|
+
- spec/controllers/products_spec.rb
|
50
|
+
- spec/emptygit
|
51
|
+
- spec/spec_helper.rb
|
52
|
+
homepage: http://github.com/alexeypetrushin/rad_store
|
53
|
+
licenses: []
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirements: []
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.8.6
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: Simple Store
|
76
|
+
test_files: []
|