meta_magic 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dc285e8ff71bf0be888b963d4d6e9126f45f9d3
4
- data.tar.gz: 8309a282e1625f2186e75c5760f9b59b901b12b3
3
+ metadata.gz: 47adca38fb9a0e7482ba9df09c3fe4688cb2ad50
4
+ data.tar.gz: fbe9c8fa3bd504fddb69192d89570c79e167d7fc
5
5
  SHA512:
6
- metadata.gz: 8694ca89a0e8ee8544810793bcd24f7983c22097201273a4c4a1e42f8fdc3d26aa649988e4b6453292d5a9d82ad31f76e5b81cda3355f2b3979fc631086afce6
7
- data.tar.gz: 3e21446f5702fd7cc78f479f34b95ed128978777e2250be51cc15d8ea6df5dfb4aab718ec43a2d4df0f62520fbe060b4585539a52ad27b55929e519a8f608740
6
+ metadata.gz: c7a6c4919f0f98acac4545757c58fc3923418670d9e6029cb9029de5ade8447d9eefc8c267f681e92ffec571f6a513d1aec67e442ff9cee69373c6ba1056b978
7
+ data.tar.gz: d5795263714e5365195fc7a198be41bdda1de513d18c399c3a76a29e6a51dd21992420fabed6edddb065299f149a4e978361bca1e1dcce5caa0b28aa859b2feb
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
6
+
7
+ notifications:
8
+ email:
9
+ - johnotander@gmail.com
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # MetaMagic
2
2
 
3
- Under development.
3
+ [![Build Status](https://travis-ci.org/johnotander/meta_magic.svg?branch=master)](https://travis-ci.org/johnotander/meta_magic)
4
+
5
+ _Currently under development._
4
6
 
5
7
  ## Installation
6
8
 
@@ -18,7 +20,7 @@ Or install it yourself as:
18
20
 
19
21
  ## Usage
20
22
 
21
- TODO: Write usage instructions here
23
+
22
24
 
23
25
  ## Contributing
24
26
 
@@ -11,5 +11,9 @@ module MetaMagic
11
11
  def set_model_instance_variable
12
12
  send(:"set_#{ controller_name.classify.underscore.downcase }")
13
13
  end
14
+
15
+ def get_model_class
16
+ controller_name.classify.constantize
17
+ end
14
18
  end
15
19
  end
@@ -1,3 +1,3 @@
1
1
  module MetaMagic
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/meta_magic.gemspec CHANGED
@@ -20,7 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'activesupport'
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.5"
24
- spec.add_development_dependency "rake"
25
- spec.add_development_dependency "rspec"
23
+ spec.add_development_dependency 'bundler', '~> 1.5'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'rspec'
26
+ spec.add_development_dependency 'actionpack'
26
27
  end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe MetaMagic::Controller do
4
+
5
+ let(:controller) { FakeThingsController.new }
6
+
7
+ subject { controller }
8
+
9
+ it { should respond_to(:get_model_class) }
10
+ it { should respond_to(:get_model_instance_variable) }
11
+ it { should respond_to(:set_model_instance_variable) }
12
+
13
+ it 'should return the correct model class' do
14
+ expect(subject.get_model_class).to eq(FakeThing)
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe MetaMagic::Helper do
4
+
5
+ let(:helper) { FakeHelper.new }
6
+
7
+ subject { helper }
8
+
9
+ it { should respond_to(:object_path) }
10
+ it { should respond_to(:objects_path) }
11
+ end
data/spec/spec_helper.rb CHANGED
@@ -2,10 +2,20 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'rspec'
4
4
 
5
+ require 'action_controller'
5
6
  require 'meta_magic'
6
7
 
7
- I18n.enforce_available_locales = false
8
-
9
8
  RSpec.configure do |config|
10
9
  config.color_enabled = true
11
10
  end
11
+
12
+ class FakeHelper
13
+ include MetaMagic::Helper
14
+ end
15
+
16
+ class FakeThing
17
+ end
18
+
19
+ class FakeThingsController < ActionController::Base
20
+ include MetaMagic::Controller
21
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meta_magic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Otander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-22 00:00:00.000000000 Z
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: actionpack
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Want to get a path to an AR object, but don't know what the object is?
70
84
  Want to set a controller's instance variable, but don't know what controller you're
71
85
  in. Meta Magic can help.
@@ -76,6 +90,7 @@ extensions: []
76
90
  extra_rdoc_files: []
77
91
  files:
78
92
  - ".gitignore"
93
+ - ".travis.yml"
79
94
  - Gemfile
80
95
  - LICENSE.txt
81
96
  - README.md
@@ -85,6 +100,8 @@ files:
85
100
  - lib/meta_magic/helper.rb
86
101
  - lib/meta_magic/version.rb
87
102
  - meta_magic.gemspec
103
+ - spec/controller_spec.rb
104
+ - spec/helper_spec.rb
88
105
  - spec/spec_helper.rb
89
106
  homepage: https://github.com/johnotander/meta_magic
90
107
  licenses:
@@ -112,4 +129,7 @@ specification_version: 4
112
129
  summary: Meta Magic concerns for abstract, object-agnostic views, controllers, and
113
130
  models.
114
131
  test_files:
132
+ - spec/controller_spec.rb
133
+ - spec/helper_spec.rb
115
134
  - spec/spec_helper.rb
135
+ has_rdoc: