Skip to content

Commit

Permalink
Merge 4771e9a into 3df3a88
Browse files Browse the repository at this point in the history
  • Loading branch information
madding committed Feb 27, 2019
2 parents 3df3a88 + 4771e9a commit 3f939f7
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ before_install:
- gem install bundler

rvm:
- 2.2.6
- 2.3.3

gemfile:
- gemfiles/rails-5-2-stable.gemfile
- gemfiles/rails-4-2-stable.gemfile
- gemfiles/rails-4-1-stable.gemfile
- gemfiles/rails-3-2-stable.gemfile
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace :spec do
rails-3-2-stable
rails-4-1-stable
rails-4-2-stable
rails-5-2-stable
]

mappers.each do |gemfile|
Expand Down
7 changes: 7 additions & 0 deletions gemfiles/rails-5-2-stable.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source 'https://rubygems.org'

gem 'rake', '< 11.0'
gem 'railties', '~> 5.2.0'
gem 'rspec-rails', '~> 3.8.2'

gemspec path: '../'
2 changes: 1 addition & 1 deletion simple-navigation.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Gem::Specification.new do |spec|

spec.add_runtime_dependency 'activesupport', '>= 2.3.2'

spec.add_development_dependency 'bundler', '~> 1.5'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'capybara'
spec.add_development_dependency 'coveralls', '~> 0.7'
spec.add_development_dependency 'guard-rspec', '~> 4.2'
Expand Down
3 changes: 2 additions & 1 deletion spec/initializers/have_css_matcher.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
RSpec::Matchers.define :have_css do |expected, times|
match do |actual|
selector = HTML::Selector.new(expected).select(actual)
selector = Nokogiri::HTML(actual).css(expected)

if times
expect(selector.size).to eq times
else
Expand Down
7 changes: 3 additions & 4 deletions spec/simple_navigation/renderer/breadcrumbs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ module Renderer

let(:item) { nil }
let(:options) {{ level: :all }}
let(:output) { HTML::Document.new(raw_output).root }
let(:raw_output) { renderer.render(navigation) }
let(:output) { renderer.render(navigation) }
let(:renderer) { Breadcrumbs.new(options) }

before { select_an_item(navigation[item]) if item }
Expand Down Expand Up @@ -75,15 +74,15 @@ module Renderer
let(:item) { nil }

it "doesn't render the prefix before the breadcrumbs" do
expect(raw_output).not_to match(/^<div.+>You are here: /)
expect(output).not_to match(/^<div.+>You are here: /)
end
end

context 'and there are items to render' do
let(:item) { :invoices }

it 'renders the prefix before the breadcrumbs' do
expect(raw_output).to match(/^<div.+>You are here: /)
expect(output).to match(/^<div.+>You are here: /)
end
end
end
Expand Down
9 changes: 4 additions & 5 deletions spec/simple_navigation/renderer/links_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ module Renderer
let!(:navigation) { setup_navigation('nav_id', 'nav_class') }

let(:item) { nil }
let(:options) {{ level: :all }}
let(:output) { HTML::Document.new(raw_output).root }
let(:raw_output) { renderer.render(navigation) }
let(:options) { { level: :all } }
let(:output) { renderer.render(navigation) }
let(:renderer) { Links.new(options) }

before { select_an_item(navigation[item]) if item }
Expand All @@ -29,7 +28,7 @@ module Renderer
end

it "renders the 'a' tags with the corresponding item's :html_options" do
expect(output).to have_css('a[style=float:right]')
expect(output).to have_css('a[style="float:right"]')
end

context 'when an item has a specified id' do
Expand Down Expand Up @@ -62,7 +61,7 @@ module Renderer
let(:options) {{ level: :all, join_with: ' | ' }}

it 'separates the items with the specified separator' do
expect(raw_output.scan(' | ').size).to eq 3
expect(output.scan(' | ').size).to eq 3
end
end

Expand Down
5 changes: 2 additions & 3 deletions spec/simple_navigation/renderer/list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ module Renderer
let!(:navigation) { setup_navigation('nav_id', 'nav_class') }

let(:item) { nil }
let(:options) {{ level: :all }}
let(:output) { HTML::Document.new(raw_output).root }
let(:raw_output) { renderer.render(navigation) }
let(:options) { { level: :all } }
let(:output) { renderer.render(navigation) }
let(:renderer) { List.new(options) }

before { select_an_item(navigation[item]) if item }
Expand Down

0 comments on commit 3f939f7

Please sign in to comment.