with_model 0.1.5 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.2
2
+
3
+ Remove the buggy attr_accessor method for accessing with_model classes. Now
4
+ there is only the constant available in the example group.
5
+
1
6
  ### 0.1.5
2
7
 
3
8
  WithModel::Base is now marked as an abstract_class, which makes polymorphic
data/README.rdoc CHANGED
@@ -74,14 +74,6 @@ In an RSpec example group, call +with_model+ and inside its block pass it a +tab
74
74
  BlogPost.should be
75
75
  end
76
76
 
77
- it "can be accessed as a local variable" do
78
- blog_post.should be
79
- end
80
-
81
- it "can be accessed as an instance variable" do
82
- @blog_post.should be
83
- end
84
-
85
77
  it "has the module" do
86
78
  BlogPost.include?(SomeModule).should be_true
87
79
  end
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ environments = %w[rspec1 rspec2]
5
5
  major, minor, revision = RUBY_VERSION.split(".").map{|str| str.to_i }
6
6
 
7
7
  in_environment = lambda do |environment, command|
8
- sh %Q{export BUNDLE_GEMFILE="gemfiles/#{environment}/Gemfile"; bundle --quiet && bundle exec #{command}}
8
+ sh %Q{export BUNDLE_GEMFILE="gemfiles/#{environment}/Gemfile"; bundle update && bundle exec #{command}}
9
9
  end
10
10
 
11
11
  in_all_environments = lambda do |command|
@@ -3,6 +3,7 @@ source :rubygems
3
3
  # gemspec :path => File.join(File.dirname(__FILE__), '..')
4
4
 
5
5
  gem "mixico"
6
+ gem "rake"
6
7
 
7
8
  group :test do
8
9
  gem "autotest"
@@ -16,10 +16,6 @@ module WithModel
16
16
  original_const_defined = Object.const_defined?(const_name)
17
17
  original_const_value = Object.const_get(const_name) if original_const_defined
18
18
 
19
- example_group.class_eval do
20
- attr_accessor name
21
- end
22
-
23
19
  model = Class.new(WithModel::Base)
24
20
 
25
21
  example_group.before do
@@ -28,7 +24,6 @@ module WithModel
28
24
  set_table_name table_name
29
25
  self.class_eval(&dsl.model_initialization)
30
26
  end
31
- send("#{name}=", model)
32
27
  end
33
28
 
34
29
  example_group.after do
@@ -1,3 +1,3 @@
1
1
  module WithModel
2
- VERSION = "0.1.5"
2
+ VERSION = "0.2"
3
3
  end
data/spec/readme_spec.rb CHANGED
@@ -42,14 +42,6 @@
42
42
  BlogPost.should be
43
43
  end
44
44
 
45
- it "can be accessed as a local variable" do
46
- blog_post.should be
47
- end
48
-
49
- it "can be accessed as an instance variable" do
50
- @blog_post.should be
51
- end
52
-
53
45
  it "has the module" do
54
46
  BlogPost.include?(SomeModule).should be_true
55
47
  end
@@ -23,7 +23,7 @@ describe "a temporary ActiveRecord model created with with_model" do
23
23
  end
24
24
 
25
25
  it "should act like a normal ActiveRecord model" do
26
- record = blog_post.create!(:title => 'New blog post', :content => "Hello, world!")
26
+ record = BlogPost.create!(:title => 'New blog post', :content => "Hello, world!")
27
27
 
28
28
  record.reload
29
29
 
@@ -46,11 +46,11 @@ describe "a temporary ActiveRecord model created with with_model" do
46
46
  end
47
47
 
48
48
  it "should have methods defined in its model block" do
49
- blog_post.new(:title => 'New blog post').fancy_title.should == "Title: New blog post"
49
+ BlogPost.new(:title => 'New blog post').fancy_title.should == "Title: New blog post"
50
50
  end
51
51
 
52
52
  it "should define a constant" do
53
- BlogPost.should == blog_post
53
+ BlogPost.should be_a(Class)
54
54
  end
55
55
 
56
56
  describe ".with_model?" do
@@ -77,8 +77,7 @@ describe "a temporary ActiveRecord model created with with_model" do
77
77
 
78
78
  describe "that shadows an existing constant" do
79
79
  with_model :my_const do
80
- table do
81
- end
80
+ table {}
82
81
  end
83
82
 
84
83
  after do
@@ -86,7 +85,7 @@ describe "a temporary ActiveRecord model created with with_model" do
86
85
  end
87
86
 
88
87
  it "should shadow that constant" do
89
- MyConst.should == my_const
88
+ MyConst.should be_a(Class)
90
89
  end
91
90
  end
92
91
 
@@ -103,7 +102,8 @@ describe "a temporary ActiveRecord model created with with_model" do
103
102
  end
104
103
 
105
104
  it "should not singularize the constant name" do
106
- BlogPosts.should == blog_posts
105
+ BlogPosts.should be
106
+ lambda { BlogPost }.should raise_error(NameError)
107
107
  end
108
108
  end
109
109
 
metadata CHANGED
@@ -1,57 +1,38 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: with_model
3
- version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 5
10
- version: 0.1.5
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.2'
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Case Commons, LLC
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-05-18 00:00:00 -04:00
12
+ date: 2011-06-21 00:00:00.000000000 -04:00
19
13
  default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
22
16
  name: activerecord
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2152628080 !ruby/object:Gem::Requirement
25
18
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 9
30
- segments:
31
- - 2
32
- - 3
33
- - 5
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
34
22
  version: 2.3.5
35
23
  - - <
36
- - !ruby/object:Gem::Version
37
- hash: 63
38
- segments:
39
- - 4
40
- - 0
41
- - 0
24
+ - !ruby/object:Gem::Version
42
25
  version: 4.0.0
43
26
  type: :runtime
44
- version_requirements: *id001
27
+ prerelease: false
28
+ version_requirements: *2152628080
45
29
  description: Dynamically build a model within an Rspec context
46
- email:
30
+ email:
47
31
  - casecommons-dev@googlegroups.com
48
32
  executables: []
49
-
50
33
  extensions: []
51
-
52
34
  extra_rdoc_files: []
53
-
54
- files:
35
+ files:
55
36
  - .autotest
56
37
  - .gitignore
57
38
  - .rspec
@@ -75,38 +56,29 @@ files:
75
56
  has_rdoc: true
76
57
  homepage: https://github.com/Casecommons/with_model
77
58
  licenses: []
78
-
79
59
  post_install_message:
80
60
  rdoc_options: []
81
-
82
- require_paths:
61
+ require_paths:
83
62
  - lib
84
- required_ruby_version: !ruby/object:Gem::Requirement
63
+ required_ruby_version: !ruby/object:Gem::Requirement
85
64
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
93
- required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
70
  none: false
95
- requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- hash: 3
99
- segments:
100
- - 0
101
- version: "0"
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
102
75
  requirements: []
103
-
104
76
  rubyforge_project:
105
- rubygems_version: 1.3.7
77
+ rubygems_version: 1.6.2
106
78
  signing_key:
107
79
  specification_version: 3
108
80
  summary: Dynamically build a model within an Rspec context
109
- test_files:
81
+ test_files:
110
82
  - spec/active_record_behaviors_spec.rb
111
83
  - spec/readme_spec.rb
112
84
  - spec/spec_helper.rb