rad_bag 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'rake_ext'
2
+
3
+ project(
4
+ name: "bag",
5
+ official_name: "rad_bag",
6
+ summary: "Simple and handy Organizer",
7
+ gem: true,
8
+
9
+ author: "Alexey Petrushin",
10
+ homepage: "http://github.com/alexeypetrushin/rad_bag"
11
+ )
@@ -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
@@ -0,0 +1,7 @@
1
+ # config.gem 'sunspot', lib: 'sunspot'
2
+ # config.gem 'sunspot_rails', lib: 'sunspot/rails'
3
+
4
+ if respond_to? :fake_gem
5
+ fake_gem 'rad_kit'
6
+ fake_gem 'rad_users'
7
+ end
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,3 @@
1
+ # Invormation Organizer and Collboration support for Rad Kit Framework
2
+
3
+ Copyright (c) Alexey Petrushin http://petrush.in, released under the AGPL license.
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Notes" do
4
+ with_controllers
5
+ set_controller Controllers::Notes
6
+ login_as :manager
7
+
8
+ it_should_behave_like "Items Controller CRUD"
9
+ end
@@ -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
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Miscellaneous" do
4
+ with_models
5
+ login_as :manager
6
+
7
+ it "items should be polymorphic" do
8
+ Factory.create :note
9
+ Models::Item.first.should be_a(Models::Note)
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe "item" do
4
+ with_models
5
+ login_as :manager
6
+ end
@@ -0,0 +1,10 @@
1
+ require 'rspec_ext'
2
+
3
+ require 'rad'
4
+ require 'rad/spec'
5
+
6
+ rad.bag
7
+
8
+ require 'kit/spec'
9
+ require 'users/spec'
10
+ require 'bag/spec'
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: []