at 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardoc/checksums +2 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +49 -18
- data/Guardfile +11 -0
- data/LICENSE +1 -1
- data/README.md +77 -0
- data/Rakefile +58 -0
- data/VERSION +1 -1
- data/at.gemspec +47 -0
- data/lib/at.rb +15 -18
- data/lib/at/import.rb +10 -0
- data/spec/at_spec.rb +44 -0
- metadata +133 -29
- data/lib/at/core_ext.rb +0 -6
data/.yardoc/checksums
ADDED
Binary file
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/Gemfile
ADDED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
at (0.1.
|
4
|
+
at (0.1.2)
|
5
5
|
active_support (~> 3.0.0)
|
6
|
+
meta_tools (~> 0.2.7)
|
7
|
+
version (~> 1.0.0)
|
6
8
|
|
7
9
|
GEM
|
8
10
|
remote: http://rubygems.org/
|
@@ -10,28 +12,57 @@ GEM
|
|
10
12
|
active_support (3.0.0)
|
11
13
|
activesupport (= 3.0.0)
|
12
14
|
activesupport (3.0.0)
|
15
|
+
coderay (1.0.8)
|
13
16
|
diff-lcs (1.1.3)
|
14
|
-
fuubar (
|
17
|
+
fuubar (1.1.0)
|
15
18
|
rspec (~> 2.0)
|
16
|
-
rspec-instafail (~> 0.
|
17
|
-
ruby-progressbar (~> 0.0
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
19
|
+
rspec-instafail (~> 0.2.0)
|
20
|
+
ruby-progressbar (~> 1.0.0)
|
21
|
+
github-markup (0.7.4)
|
22
|
+
guard (1.5.4)
|
23
|
+
listen (>= 0.4.2)
|
24
|
+
lumberjack (>= 1.0.2)
|
25
|
+
pry (>= 0.9.10)
|
26
|
+
thor (>= 0.14.6)
|
27
|
+
guard-rspec (2.1.2)
|
28
|
+
guard (>= 1.1)
|
29
|
+
rspec (~> 2.11)
|
30
|
+
guard-yard (2.0.1)
|
31
|
+
guard (>= 1.1.0)
|
32
|
+
yard (>= 0.7.0)
|
33
|
+
listen (0.6.0)
|
34
|
+
lumberjack (1.0.2)
|
35
|
+
meta_tools (0.2.7)
|
36
|
+
method_source (0.8.1)
|
37
|
+
pry (0.9.10)
|
38
|
+
coderay (~> 1.0.5)
|
39
|
+
method_source (~> 0.8)
|
40
|
+
slop (~> 3.3.1)
|
41
|
+
rb-fsevent (0.9.2)
|
42
|
+
redcarpet (2.2.2)
|
43
|
+
rspec (2.12.0)
|
44
|
+
rspec-core (~> 2.12.0)
|
45
|
+
rspec-expectations (~> 2.12.0)
|
46
|
+
rspec-mocks (~> 2.12.0)
|
47
|
+
rspec-core (2.12.0)
|
48
|
+
rspec-expectations (2.12.0)
|
49
|
+
diff-lcs (~> 1.1.3)
|
50
|
+
rspec-instafail (0.2.4)
|
51
|
+
rspec-mocks (2.12.0)
|
52
|
+
ruby-progressbar (1.0.2)
|
53
|
+
slop (3.3.3)
|
54
|
+
thor (0.16.0)
|
55
|
+
version (1.0.0)
|
56
|
+
yard (0.8.3)
|
29
57
|
|
30
58
|
PLATFORMS
|
31
59
|
ruby
|
32
60
|
|
33
61
|
DEPENDENCIES
|
34
62
|
at!
|
35
|
-
fuubar (~>
|
36
|
-
|
37
|
-
|
63
|
+
fuubar (~> 1.1)
|
64
|
+
github-markup (~> 0.7)
|
65
|
+
guard-rspec (~> 2.1)
|
66
|
+
guard-yard (~> 2.0)
|
67
|
+
rb-fsevent (~> 0.9)
|
68
|
+
redcarpet (~> 2.2.2)
|
data/Guardfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
guard 'yard' do
|
2
|
+
watch(%r{app/.+\.rb})
|
3
|
+
watch(%r{lib/.+\.rb})
|
4
|
+
watch(%r{ext/.+\.c})
|
5
|
+
end
|
6
|
+
|
7
|
+
guard 'rspec', cli: '-c -f Fuubar' do
|
8
|
+
watch(%r{^spec/.+_spec\.rb$})
|
9
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
10
|
+
watch('spec/spec_helper.rb') { "spec" }
|
11
|
+
end
|
data/LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# At
|
2
|
+
|
3
|
+
`At` is a small library that allows you to access instance variables on an object as
|
4
|
+
if they were `attr_accessor`s for testing purposes.
|
5
|
+
|
6
|
+
Basically, `at` directly translates this:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
value = object.instance_eval { @instance_variable }
|
10
|
+
object.instance_eval { @instance_variable = "#{value}!" }
|
11
|
+
```
|
12
|
+
|
13
|
+
into this:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
value = object.at.instance_variable
|
17
|
+
object.at.instance_variable = "#{value}!"
|
18
|
+
```
|
19
|
+
|
20
|
+
## Install
|
21
|
+
|
22
|
+
### Bundler: `gem 'at'`
|
23
|
+
|
24
|
+
### RubyGems: `gem install at`
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
If I want to test the output of the `full_name` method in my `User` class
|
29
|
+
below, I would normally have three options for testing all possible outcomes;
|
30
|
+
initialize a `User` object for each test case, initialize one `User` object and
|
31
|
+
use `instance_eval` to set the instance variables individually, or create
|
32
|
+
`attr_accessor`s for each instance variable I would like to test. In Rspec, I
|
33
|
+
can use `assigns` to test the value of the instance variable, but I can't
|
34
|
+
_get_ the value of the instance variable.
|
35
|
+
|
36
|
+
`At` solves these problems.
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
require 'at'
|
40
|
+
|
41
|
+
class User
|
42
|
+
def initialize(first_name=nil, last_name=nil)
|
43
|
+
@first_name, @last_name = first_name, last_name
|
44
|
+
end
|
45
|
+
|
46
|
+
def full_name
|
47
|
+
[@first_name, @last_name].compact.join(" ")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe User, '#full_name' do
|
52
|
+
it 'should output the full name correctly' do
|
53
|
+
subject.at.first_name = 'John'
|
54
|
+
subject.at.last_name = 'Doe'
|
55
|
+
|
56
|
+
subject.full_name.should == 'John Doe'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
Check out the specs for a better usage example.
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
66
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
67
|
+
* Fork the project
|
68
|
+
* Start a feature/bugfix branch
|
69
|
+
* Commit and push until you are happy with your contribution
|
70
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
71
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
72
|
+
|
73
|
+
## Copyright
|
74
|
+
|
75
|
+
Copyright © 2012 Ryan Scott Lewis <ryan@rynet.us>.
|
76
|
+
|
77
|
+
The MIT License (MIT) - See LICENSE for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
def require_task(path)
|
4
|
+
begin
|
5
|
+
require path
|
6
|
+
|
7
|
+
yield
|
8
|
+
rescue LoadError
|
9
|
+
puts '', "Could not load '#{path}'.", 'Try to `rake gem:spec` and `bundle install` and try again.', ''
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = Gem::Specification.new do |s|
|
14
|
+
|
15
|
+
# Variables
|
16
|
+
s.name = 'at'
|
17
|
+
s.author = 'Ryan Scott Lewis'
|
18
|
+
s.email = 'ryan@rynet.us'
|
19
|
+
s.summary = 'Easily access instance variables on your objects as if they were attributes.'
|
20
|
+
|
21
|
+
# Dependencies
|
22
|
+
s.add_dependency 'version', '~> 1.0.0'
|
23
|
+
s.add_development_dependency 'guard-rspec', '~> 2.1'
|
24
|
+
s.add_development_dependency 'guard-yard', '~> 2.0'
|
25
|
+
s.add_development_dependency 'rb-fsevent', '~> 0.9'
|
26
|
+
s.add_development_dependency 'fuubar', '~> 1.1'
|
27
|
+
s.add_development_dependency 'redcarpet', '~> 2.2.2'
|
28
|
+
s.add_development_dependency 'github-markup', '~> 0.7'
|
29
|
+
|
30
|
+
# Pragmatically set variables
|
31
|
+
s.homepage = "http://github.com/RyanScottLewis/#{s.name}"
|
32
|
+
s.version = Pathname.glob('VERSION*').first.read
|
33
|
+
s.description = Pathname.glob('README*').first.read
|
34
|
+
s.require_paths = ['lib']
|
35
|
+
s.files = `git ls-files`.lines.to_a.collect { |s| s.strip }
|
36
|
+
s.executables = `git ls-files -- bin/*`.lines.to_a.collect { |s| File.basename(s.strip) }
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
desc 'Generate the gemspec defined in this Rakefile'
|
41
|
+
task :gemspec do
|
42
|
+
Pathname.new("#{spec.name}.gemspec").open('w') { |f| f.write(spec.to_ruby) }
|
43
|
+
end
|
44
|
+
|
45
|
+
require_task 'rake/version_task' do
|
46
|
+
Rake::VersionTask.new do |t|
|
47
|
+
t.with_git_tag = true
|
48
|
+
t.with_gemspec = spec
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
require 'rubygems/package_task'
|
53
|
+
Gem::PackageTask.new(spec) do |t|
|
54
|
+
t.need_zip = false
|
55
|
+
t.need_tar = false
|
56
|
+
end
|
57
|
+
|
58
|
+
task :default => :gemspec
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/at.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "at"
|
5
|
+
s.version = "0.1.3"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Ryan Scott Lewis"]
|
9
|
+
s.date = "2012-11-24"
|
10
|
+
s.description = "# At\n\n`At` is a small library that allows you to access instance variables on an object as \nif they were `attr_accessor`s for testing purposes.\n\nBasically, `at` directly translates this:\n\n```ruby\nvalue = object.instance_eval { @instance_variable }\nobject.instance_eval { @instance_variable = \"\#{value}!\" }\n```\n\ninto this:\n\n```ruby\nvalue = object.at.instance_variable\nobject.at.instance_variable = \"\#{value}!\"\n```\n\n## Install\n\n### Bundler: `gem 'at'`\n\n### RubyGems: `gem install at`\n\n## Usage\n\nIf I want to test the output of the `full_name` method in my `User` class\nbelow, I would normally have three options for testing all possible outcomes; \ninitialize a `User` object for each test case, initialize one `User` object and \nuse `instance_eval` to set the instance variables individually, or create \n`attr_accessor`s for each instance variable I would like to test. In Rspec, I \ncan use `assigns` to test the value of the instance variable, but I can't \n_get_ the value of the instance variable.\n\n`At` solves these problems.\n\n```ruby\nrequire 'at'\n\nclass User\n def initialize(first_name=nil, last_name=nil)\n @first_name, @last_name = first_name, last_name\n end\n \n def full_name\n [@first_name, @last_name].compact.join(\" \")\n end\nend\n\ndescribe User, '#full_name' do\n it 'should output the full name correctly' do\n subject.at.first_name = 'John'\n subject.at.last_name = 'Doe'\n \n subject.full_name.should == 'John Doe'\n end\nend\n```\n\nCheck out the specs for a better usage example.\n\n## Contributing\n\n* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet\n* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it\n* Fork the project\n* Start a feature/bugfix branch\n* Commit and push until you are happy with your contribution\n* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.\n* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.\n\n## Copyright\n\nCopyright \u{a9} 2012 Ryan Scott Lewis <ryan@rynet.us>.\n\nThe MIT License (MIT) - See LICENSE for further details."
|
11
|
+
s.email = "ryan@rynet.us"
|
12
|
+
s.files = [".yardoc/checksums", ".yardoc/object_types", ".yardoc/objects/root.dat", ".yardoc/proxy_types", "Gemfile", "Gemfile.lock", "Guardfile", "LICENSE", "README.md", "Rakefile", "VERSION", "at.gemspec", "lib/at.rb", "lib/at/import.rb", "spec/at_spec.rb", "spec/spec_helper.rb"]
|
13
|
+
s.homepage = "http://github.com/RyanScottLewis/at"
|
14
|
+
s.require_paths = ["lib"]
|
15
|
+
s.rubygems_version = "1.8.24"
|
16
|
+
s.summary = "Easily access instance variables on your objects as if they were attributes."
|
17
|
+
|
18
|
+
if s.respond_to? :specification_version then
|
19
|
+
s.specification_version = 3
|
20
|
+
|
21
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
22
|
+
s.add_runtime_dependency(%q<version>, ["~> 1.0.0"])
|
23
|
+
s.add_development_dependency(%q<guard-rspec>, ["~> 2.1"])
|
24
|
+
s.add_development_dependency(%q<guard-yard>, ["~> 2.0"])
|
25
|
+
s.add_development_dependency(%q<rb-fsevent>, ["~> 0.9"])
|
26
|
+
s.add_development_dependency(%q<fuubar>, ["~> 1.1"])
|
27
|
+
s.add_development_dependency(%q<redcarpet>, ["~> 2.2.2"])
|
28
|
+
s.add_development_dependency(%q<github-markup>, ["~> 0.7"])
|
29
|
+
else
|
30
|
+
s.add_dependency(%q<version>, ["~> 1.0.0"])
|
31
|
+
s.add_dependency(%q<guard-rspec>, ["~> 2.1"])
|
32
|
+
s.add_dependency(%q<guard-yard>, ["~> 2.0"])
|
33
|
+
s.add_dependency(%q<rb-fsevent>, ["~> 0.9"])
|
34
|
+
s.add_dependency(%q<fuubar>, ["~> 1.1"])
|
35
|
+
s.add_dependency(%q<redcarpet>, ["~> 2.2.2"])
|
36
|
+
s.add_dependency(%q<github-markup>, ["~> 0.7"])
|
37
|
+
end
|
38
|
+
else
|
39
|
+
s.add_dependency(%q<version>, ["~> 1.0.0"])
|
40
|
+
s.add_dependency(%q<guard-rspec>, ["~> 2.1"])
|
41
|
+
s.add_dependency(%q<guard-yard>, ["~> 2.0"])
|
42
|
+
s.add_dependency(%q<rb-fsevent>, ["~> 0.9"])
|
43
|
+
s.add_dependency(%q<fuubar>, ["~> 1.1"])
|
44
|
+
s.add_dependency(%q<redcarpet>, ["~> 2.2.2"])
|
45
|
+
s.add_dependency(%q<github-markup>, ["~> 0.7"])
|
46
|
+
end
|
47
|
+
end
|
data/lib/at.rb
CHANGED
@@ -1,42 +1,39 @@
|
|
1
|
-
require '
|
2
|
-
require 'active_support/concern'
|
1
|
+
require 'version'
|
3
2
|
|
4
3
|
module At
|
5
|
-
extend ActiveSupport::Concern
|
6
4
|
|
7
|
-
|
5
|
+
is_versioned
|
8
6
|
|
9
7
|
class MethodToInstanceVariableProxy
|
8
|
+
|
10
9
|
def initialize(parent)
|
11
10
|
@parent = parent
|
12
11
|
end
|
13
12
|
|
14
|
-
def method_missing(meth, *args
|
13
|
+
def method_missing(meth, *args)
|
15
14
|
@parent.instance_eval do
|
15
|
+
|
16
16
|
if match = meth.to_s.match(/(.*)\=$/)
|
17
17
|
value = args.length == 1 ? args.first : args
|
18
18
|
instance_variable_set("@#{match[1]}", value)
|
19
19
|
else
|
20
|
-
if
|
21
|
-
|
20
|
+
if args.empty?
|
21
|
+
instance_variable_get("@#{meth}")
|
22
22
|
else
|
23
|
-
|
24
|
-
|
25
|
-
else
|
26
|
-
value = args.length == 1 ? args.first : args
|
27
|
-
instance_variable_set("@#{meth}", value)
|
28
|
-
end
|
23
|
+
value = args.length == 1 ? args.first : args
|
24
|
+
instance_variable_set("@#{meth}", value)
|
29
25
|
end
|
30
26
|
end
|
27
|
+
|
31
28
|
end
|
32
29
|
end
|
30
|
+
|
33
31
|
end
|
34
32
|
|
35
|
-
|
36
|
-
|
37
|
-
@_method_to_instance_variable_proxy ||= MethodToInstanceVariableProxy.new(self)
|
38
|
-
end
|
33
|
+
def at
|
34
|
+
@_method_to_instance_variable_proxy ||= MethodToInstanceVariableProxy.new(self)
|
39
35
|
end
|
36
|
+
|
40
37
|
end
|
41
38
|
|
42
|
-
require 'at/
|
39
|
+
require 'at/import'
|
data/lib/at/import.rb
ADDED
data/spec/at_spec.rb
CHANGED
@@ -18,6 +18,8 @@ describe Configuration do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
#===-----------------------------------------------------------------------===#
|
22
|
+
|
21
23
|
class User
|
22
24
|
def initialize(first_name=nil, last_name=nil)
|
23
25
|
@first_name, @last_name = first_name, last_name
|
@@ -59,3 +61,45 @@ describe User do
|
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
64
|
+
|
65
|
+
#===-----------------------------------------------------------------------===#
|
66
|
+
|
67
|
+
require 'net/http'
|
68
|
+
require 'active_support/core_ext/object/to_query'
|
69
|
+
|
70
|
+
module HtmlDownloader
|
71
|
+
def base_uri(_base_uri)
|
72
|
+
@base_uri = _base_uri.gsub(/\/$/, '').gsub(/https?:\/\//, '')
|
73
|
+
end
|
74
|
+
|
75
|
+
def get(path, params={})
|
76
|
+
path.gsub!(/^\//, '')
|
77
|
+
full_path = params == {} ? "/#{path}" : "/#{path}?#{params.to_param}"
|
78
|
+
Net::HTTP.get_print(@base_uri, full_path)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class Twitter
|
83
|
+
extend HtmlDownloader
|
84
|
+
|
85
|
+
base_uri 'http://search.twitter.com'
|
86
|
+
|
87
|
+
def self.search(params={})
|
88
|
+
@cache ||= Hash.new { |h, k| h[k] = get('/search.json', params) }
|
89
|
+
@cache[params]
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
describe Twitter do
|
94
|
+
describe "#search" do
|
95
|
+
it "should not make an HTTP request for the same params twice" do
|
96
|
+
Twitter.at.cache = {
|
97
|
+
{ :q => 'test' } => "{'some':'json response'}"
|
98
|
+
}
|
99
|
+
|
100
|
+
Net::HTTP.should_receive(:get_print).never
|
101
|
+
|
102
|
+
Twitter.search(:q => "test").should == "{'some':'json response'}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: at
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,68 +9,171 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-11-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement:
|
15
|
+
name: version
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 1.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: guard-rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.1'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.1'
|
25
46
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement:
|
47
|
+
name: guard-yard
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
28
49
|
none: false
|
29
50
|
requirements:
|
30
51
|
- - ~>
|
31
52
|
- !ruby/object:Gem::Version
|
32
|
-
version: 2.
|
53
|
+
version: '2.0'
|
33
54
|
type: :development
|
34
55
|
prerelease: false
|
35
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rb-fsevent
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.9'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0.9'
|
36
78
|
- !ruby/object:Gem::Dependency
|
37
79
|
name: fuubar
|
38
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
39
81
|
none: false
|
40
82
|
requirements:
|
41
83
|
- - ~>
|
42
84
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
85
|
+
version: '1.1'
|
44
86
|
type: :development
|
45
87
|
prerelease: false
|
46
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.1'
|
47
94
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement:
|
95
|
+
name: redcarpet
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
50
97
|
none: false
|
51
98
|
requirements:
|
52
99
|
- - ~>
|
53
100
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
101
|
+
version: 2.2.2
|
55
102
|
type: :development
|
56
103
|
prerelease: false
|
57
|
-
version_requirements:
|
58
|
-
|
59
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.2.2
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: github-markup
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.7'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0.7'
|
126
|
+
description: ! "# At\n\n`At` is a small library that allows you to access instance
|
127
|
+
variables on an object as \nif they were `attr_accessor`s for testing purposes.\n\nBasically,
|
128
|
+
`at` directly translates this:\n\n```ruby\nvalue = object.instance_eval { @instance_variable
|
129
|
+
}\nobject.instance_eval { @instance_variable = \"#{value}!\" }\n```\n\ninto this:\n\n```ruby\nvalue
|
130
|
+
= object.at.instance_variable\nobject.at.instance_variable = \"#{value}!\"\n```\n\n##
|
131
|
+
Install\n\n### Bundler: `gem 'at'`\n\n### RubyGems: `gem install at`\n\n## Usage\n\nIf
|
132
|
+
I want to test the output of the `full_name` method in my `User` class\nbelow, I
|
133
|
+
would normally have three options for testing all possible outcomes; \ninitialize
|
134
|
+
a `User` object for each test case, initialize one `User` object and \nuse `instance_eval`
|
135
|
+
to set the instance variables individually, or create \n`attr_accessor`s for each
|
136
|
+
instance variable I would like to test. In Rspec, I \ncan use `assigns` to test
|
137
|
+
the value of the instance variable, but I can't \n_get_ the value of the instance
|
138
|
+
variable.\n\n`At` solves these problems.\n\n```ruby\nrequire 'at'\n\nclass User\n
|
139
|
+
\ def initialize(first_name=nil, last_name=nil)\n @first_name, @last_name = first_name,
|
140
|
+
last_name\n end\n \n def full_name\n [@first_name, @last_name].compact.join(\"
|
141
|
+
\")\n end\nend\n\ndescribe User, '#full_name' do\n it 'should output the full
|
142
|
+
name correctly' do\n subject.at.first_name = 'John'\n subject.at.last_name
|
143
|
+
= 'Doe'\n \n subject.full_name.should == 'John Doe'\n end\nend\n```\n\nCheck
|
144
|
+
out the specs for a better usage example.\n\n## Contributing\n\n* Check out the
|
145
|
+
latest master to make sure the feature hasn't been implemented or the bug hasn't
|
146
|
+
been fixed yet\n* Check out the issue tracker to make sure someone already hasn't
|
147
|
+
requested it and/or contributed it\n* Fork the project\n* Start a feature/bugfix
|
148
|
+
branch\n* Commit and push until you are happy with your contribution\n* Make sure
|
149
|
+
to add tests for it. This is important so I don't break it in a future version unintentionally.\n*
|
150
|
+
Please try not to mess with the Rakefile, version, or history. If you want to have
|
151
|
+
your own version, or is otherwise necessary, that is fine, but please isolate to
|
152
|
+
its own commit so I can cherry-pick around it.\n\n## Copyright\n\nCopyright © 2012
|
153
|
+
Ryan Scott Lewis <ryan@rynet.us>.\n\nThe MIT License (MIT) - See LICENSE for further
|
154
|
+
details."
|
155
|
+
email: ryan@rynet.us
|
60
156
|
executables: []
|
61
157
|
extensions: []
|
62
|
-
extra_rdoc_files:
|
63
|
-
- LICENSE
|
64
|
-
- VERSION
|
158
|
+
extra_rdoc_files: []
|
65
159
|
files:
|
160
|
+
- .yardoc/checksums
|
161
|
+
- .yardoc/object_types
|
162
|
+
- .yardoc/objects/root.dat
|
163
|
+
- .yardoc/proxy_types
|
164
|
+
- Gemfile
|
165
|
+
- Gemfile.lock
|
166
|
+
- Guardfile
|
66
167
|
- LICENSE
|
168
|
+
- README.md
|
169
|
+
- Rakefile
|
67
170
|
- VERSION
|
68
|
-
-
|
69
|
-
- lib/at/core_ext.rb
|
171
|
+
- at.gemspec
|
70
172
|
- lib/at.rb
|
173
|
+
- lib/at/import.rb
|
71
174
|
- spec/at_spec.rb
|
72
175
|
- spec/spec_helper.rb
|
73
|
-
homepage: http://github.com/
|
176
|
+
homepage: http://github.com/RyanScottLewis/at
|
74
177
|
licenses: []
|
75
178
|
post_install_message:
|
76
179
|
rdoc_options: []
|
@@ -82,6 +185,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
185
|
- - ! '>='
|
83
186
|
- !ruby/object:Gem::Version
|
84
187
|
version: '0'
|
188
|
+
segments:
|
189
|
+
- 0
|
190
|
+
hash: -289485452469304833
|
85
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
192
|
none: false
|
87
193
|
requirements:
|
@@ -90,10 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
196
|
version: '0'
|
91
197
|
requirements: []
|
92
198
|
rubyforge_project:
|
93
|
-
rubygems_version: 1.8.
|
199
|
+
rubygems_version: 1.8.24
|
94
200
|
signing_key:
|
95
201
|
specification_version: 3
|
96
202
|
summary: Easily access instance variables on your objects as if they were attributes.
|
97
|
-
test_files:
|
98
|
-
- spec/at_spec.rb
|
99
|
-
- spec/spec_helper.rb
|
203
|
+
test_files: []
|