rad_bag 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/bag/factories.rb +12 -0
- data/lib/bag/gems.rb +7 -0
- data/lib/bag/spec.rb +1 -0
- data/lib/components/bag.rb +20 -0
- data/readme.md +3 -0
- data/spec/controllers/notes_spec.rb +9 -0
- data/spec/controllers/selectors_spec.rb +43 -0
- data/spec/models/general_spec.rb +11 -0
- data/spec/models/selector_spec.rb +6 -0
- data/spec/spec_helper.rb +10 -0
- metadata +77 -0
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'kit/factories'
|
2
|
+
require 'users/factories'
|
3
|
+
|
4
|
+
Factory.define :note, class: 'Models::Note', parent: :item do |n|
|
5
|
+
n.sequence(:name){|i| "note_#{i}"}
|
6
|
+
# n.text "Some text"
|
7
|
+
n.original_text "Some text"
|
8
|
+
end
|
9
|
+
|
10
|
+
Factory.define :selector, class: 'Models::Selector', parent: :item do |s|
|
11
|
+
s.view 'line'
|
12
|
+
end
|
data/lib/bag/gems.rb
ADDED
data/lib/bag/spec.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bag/factories'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Rad::Bag
|
2
|
+
end
|
3
|
+
|
4
|
+
rad.register :bag, depends_on: [:kit, :users] do
|
5
|
+
require 'bag/gems'
|
6
|
+
|
7
|
+
rad.configure :web, "#{__FILE__}/../../.." do |c|
|
8
|
+
# c.config blank: true, override: false
|
9
|
+
c.routes
|
10
|
+
c.locales
|
11
|
+
c.template_paths 'app/views'
|
12
|
+
c.asset_paths 'app/static'
|
13
|
+
c.autoload_paths %w(lib app)
|
14
|
+
end
|
15
|
+
|
16
|
+
# config
|
17
|
+
rad.kit.items.push(:note, :selector).uniq!
|
18
|
+
|
19
|
+
Rad::Bag.new
|
20
|
+
end
|
data/readme.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Selectors" do
|
4
|
+
with_controllers
|
5
|
+
set_controller Controllers::Selectors
|
6
|
+
login_as :manager
|
7
|
+
|
8
|
+
it_should_behave_like "Items Controller CRUD"
|
9
|
+
|
10
|
+
describe "Querying" do
|
11
|
+
before do
|
12
|
+
@selector = Factory.create :selector, query: ['post']
|
13
|
+
|
14
|
+
@post = Factory.create :note, name: 'Post Name', tags: ['post']
|
15
|
+
@note = Factory.create :note, name: 'Note Name'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "set query" do
|
19
|
+
pcall :create, model: {name: 'selector', query_as_string: "post, news"}, format: 'js'
|
20
|
+
response.should be_redirect
|
21
|
+
|
22
|
+
Models::Selector.by_name('selector').query.should == ['news', 'post']
|
23
|
+
end
|
24
|
+
|
25
|
+
it "display only selected items" do
|
26
|
+
call :show, id: @selector.to_param
|
27
|
+
response.should be_ok
|
28
|
+
|
29
|
+
response.body.include?(@post.name).should be_true
|
30
|
+
response.body.include?(@note.name).should be_false
|
31
|
+
end
|
32
|
+
|
33
|
+
it "pagination" do
|
34
|
+
call :show, id: @selector.to_param, page: 1
|
35
|
+
response.should be_ok
|
36
|
+
end
|
37
|
+
|
38
|
+
it "shouldn't show non-existing selector" do
|
39
|
+
call :show, id: 'non_existing_id'
|
40
|
+
response.should be_not_found
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rad_bag
|
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: &2773910 !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: *2773910
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rad_users
|
27
|
+
requirement: &2773670 !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: *2773670
|
36
|
+
description:
|
37
|
+
email:
|
38
|
+
executables: []
|
39
|
+
extensions: []
|
40
|
+
extra_rdoc_files: []
|
41
|
+
files:
|
42
|
+
- Rakefile
|
43
|
+
- readme.md
|
44
|
+
- lib/bag/factories.rb
|
45
|
+
- lib/bag/gems.rb
|
46
|
+
- lib/bag/spec.rb
|
47
|
+
- lib/components/bag.rb
|
48
|
+
- spec/controllers/notes_spec.rb
|
49
|
+
- spec/controllers/selectors_spec.rb
|
50
|
+
- spec/models/general_spec.rb
|
51
|
+
- spec/models/selector_spec.rb
|
52
|
+
- spec/spec_helper.rb
|
53
|
+
homepage: http://github.com/alexeypetrushin/rad_bag
|
54
|
+
licenses: []
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 1.8.6
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: Simple and handy Organizer
|
77
|
+
test_files: []
|