cookbook 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/VERSION +1 -1
- data/app/models/cookbook/use.rb +19 -5
- data/cookbook.gemspec +3 -3
- data/lib/cookbook/mixins/acts_as_use_of.rb +13 -3
- data/lib/cookbook/mixins/acts_as_used_in.rb +23 -5
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +12 -0
- data/spec/dummy/log/test.log +7514 -0
- data/spec/models/cookbook/use_spec.rb +2 -13
- data/spec/models/how_to_spec.rb +3 -3
- data/spec/models/recipe_spec.rb +3 -3
- metadata +2 -2
@@ -42,17 +42,6 @@ RSpec.describe Cookbook::Use, type: :model do
|
|
42
42
|
it { should belong_to(:use_in) }
|
43
43
|
end
|
44
44
|
|
45
|
-
describe 'Scopes' do
|
46
|
-
describe '.recipe_uses' do
|
47
|
-
subject { Cookbook::Use.recipe_uses }
|
48
|
-
it { should include(full_use) }
|
49
|
-
end
|
50
|
-
describe '.ingredient_uses' do
|
51
|
-
subject { Cookbook::Use.ingredient_uses }
|
52
|
-
it { should include(full_use) }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
45
|
describe 'Methods' do
|
57
46
|
describe '#quantity' do
|
58
47
|
describe 'when min and max exist' do
|
@@ -61,11 +50,11 @@ RSpec.describe Cookbook::Use, type: :model do
|
|
61
50
|
end
|
62
51
|
describe 'with just min' do
|
63
52
|
subject { use_no_max_no_unit.quantity }
|
64
|
-
it { should eq '0.25' }
|
53
|
+
it { should eq '0.25' }
|
65
54
|
end
|
66
55
|
describe 'with just max' do
|
67
56
|
subject { use_no_min_no_unit.quantity }
|
68
|
-
it { should eq '2' }
|
57
|
+
it { should eq '2' }
|
69
58
|
end
|
70
59
|
end
|
71
60
|
describe '#quantity and unit' do
|
data/spec/models/how_to_spec.rb
CHANGED
@@ -7,12 +7,12 @@ RSpec.describe HowTo, type: :model do
|
|
7
7
|
it { should have_many(:uses) }
|
8
8
|
|
9
9
|
it { should_not have_many(:ingredient_uses) }
|
10
|
-
it { should_not have_many(:ingredients).through(:
|
10
|
+
it { should_not have_many(:ingredients).through(:ingredient_uses) }
|
11
11
|
|
12
12
|
it { should have_many(:supply_uses) }
|
13
|
-
it { should have_many(:supplies).through(:
|
13
|
+
it { should have_many(:supplies).through(:supply_uses) }
|
14
14
|
|
15
15
|
it { should have_many(:tool_uses) }
|
16
|
-
it { should have_many(:tools).through(:
|
16
|
+
it { should have_many(:tools).through(:tool_uses) }
|
17
17
|
end
|
18
18
|
end
|
data/spec/models/recipe_spec.rb
CHANGED
@@ -7,12 +7,12 @@ RSpec.describe Recipe, type: :model do
|
|
7
7
|
it { should have_many(:uses) }
|
8
8
|
|
9
9
|
it { should have_many(:ingredient_uses) }
|
10
|
-
it { should have_many(:ingredients).through(:
|
10
|
+
it { should have_many(:ingredients).through(:ingredient_uses) }
|
11
11
|
|
12
12
|
it { should have_many(:supply_uses) }
|
13
|
-
it { should have_many(:supplies).through(:
|
13
|
+
it { should have_many(:supplies).through(:supply_uses) }
|
14
14
|
|
15
15
|
it { should have_many(:tool_uses) }
|
16
|
-
it { should have_many(:tools).through(:
|
16
|
+
it { should have_many(:tools).through(:tool_uses) }
|
17
17
|
end
|
18
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loren Lundgren
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|