Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.1.0 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/simple_enum/scopes/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def generate_enum_scopes_extension_for enum, accessor
private

def define_range_scope_method(enum, accessor)
singleton_class.send(:define_method, "#{accessor.name}_between") do |min_val, max_val|
singleton_class.send(:define_method, "between_#{accessor.name.pluralize}") do |min_val, max_val|
where(accessor.source => enum[min_val]..enum[max_val])
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/simple_enum/scopes/active_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
let!(:good) { klass.create(state: :good) }

it 'returns the object in range' do
objects = klass.state_between(:bad, :very_good)
objects = klass.between_states(:bad, :very_good)
expect(objects.count).to eq(2)
expect(objects.map(&:state)).to eq %i(bad good)
end
Expand All @@ -24,7 +24,7 @@
let!(:very_good) { klass.create(state: :very_good) }

it 'returns no object' do
objects = klass.state_between(:very_bad, :good)
objects = klass.between_states(:very_bad, :good)
expect(objects).to be_empty
end
end
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'rubygems'
require 'bundler/setup'
require 'pry'

require 'rspec'
require 'active_record'
Expand Down