Skip to content

Commit

Permalink
Convert double-quoted strings to single-quoted strings when there is …
Browse files Browse the repository at this point in the history
…no interpolation.

17 files were modified.
  • Loading branch information
ACRE committed Oct 18, 2013
1 parent 8e4200b commit bbbb0c4
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 145 deletions.
4 changes: 2 additions & 2 deletions features/widgets/step_definitions/widgets_steps.rb
Expand Up @@ -27,7 +27,7 @@
end

When(/^I execute "(.*?)"$/) do |code|
step "I execute the following code:", code
step 'I execute the following code:', code
end

When(/^I evaluate the following code:$/) do |code|
Expand All @@ -43,7 +43,7 @@
end

Then(/^it should return "([^"]+)"$/) do |retval|
step "it should return the following:", retval
step 'it should return the following:', retval
end

Then(/^the following should raise an exception:$/) do |code|
Expand Down
2 changes: 1 addition & 1 deletion lib/dill/conversions.rb
Expand Up @@ -18,7 +18,7 @@ def List(valstr, &block)
end

def Timeish(val)
raise ArgumentError, "can't convert nil to Timeish" if val.nil?
raise ArgumentError, 'can't convert nil to Timeish' if val.nil?

This comment has been minimized.

Copy link
@david

david Oct 19, 2013

Member

This is a bug in ACRE. (@shoe)

This comment has been minimized.

Copy link
@shoe

shoe Oct 19, 2013

Member

yep, fixed now.

return val if Date === val || Time === val || DateTime === val
Expand Down
2 changes: 1 addition & 1 deletion lib/dill/version.rb
@@ -1,3 +1,3 @@
module Dill
VERSION = "0.5.2"
VERSION = '0.5.2'
end
2 changes: 1 addition & 1 deletion lib/dill/widgets/document.rb
Expand Up @@ -3,7 +3,7 @@ class Document
include WidgetContainer

def initialize(widget_lookup_scope)
self.widget_lookup_scope = widget_lookup_scope or raise "No scope given"
self.widget_lookup_scope = widget_lookup_scope or raise 'No scope given'
end

def root
Expand Down
18 changes: 9 additions & 9 deletions spec/dill/conversions_spec.rb
Expand Up @@ -3,7 +3,7 @@
describe Dill::Conversions do
include Dill::Conversions

describe "Boolean" do
describe 'Boolean' do
['yes', 'true', true].each do |val|
it "converts #{val.inspect} to true" do
expect(Boolean(val)).to be_true
Expand All @@ -17,27 +17,27 @@
end
end

describe "List" do
it "converts an empty string to an empty list" do
describe 'List' do
it 'converts an empty string to an empty list' do
expect(List('')).to eq []
end

it "converts a blank string to an empty list" do
it 'converts a blank string to an empty list' do
expect(List(' ')).to eq []
end

it "converts a comma separated string to a list" do
it 'converts a comma separated string to a list' do
expect(List(' one, two , three four')).to eq ['one', 'two', 'three four']
end

it "transforms a comma separated string to a list" do
it 'transforms a comma separated string to a list' do
expect(List(' one, two , three four') { |v| "#{v}#{v}"}).
to eq ['oneone', 'twotwo', 'three fourthree four']
end
end

describe 'Timeish' do
it "it converts a timeish string to time" do
it 'it converts a timeish string to time' do
expect(Timeish('1 hour ago')).to be_a(Time)
end

Expand All @@ -47,8 +47,8 @@
end
end

it "converts a formatted date string to Time" do
expect(Timeish("2013-04-20 15:33:00")).to be_a(Time)
it 'converts a formatted date string to Time' do
expect(Timeish('2013-04-20 15:33:00')).to be_a(Time)
end
end
end
6 changes: 3 additions & 3 deletions spec/dill/dsl_spec.rb
Expand Up @@ -17,17 +17,17 @@ class Inner < Dill::Widget
HTML

describe '#widget' do
context "when the widget is at the top level" do
context 'when the widget is at the top level' do
Then { widget(:top).class == Top }
end

context "when the widget is unknown" do
context 'when the widget is unknown' do
When(:error) { widget(:unknown) }

Then { error == Failure(Dill::Missing) }
end

context "when the widget is not at the top level" do
context 'when the widget is not at the top level' do
When(:error) { widget(:inner) }

Then { error == Failure(Dill::Missing) }
Expand Down
30 changes: 15 additions & 15 deletions spec/dill/dynamic_value_spec.rb
@@ -1,92 +1,92 @@
require 'spec_helper'

describe Dill::DynamicValue do
describe "unchanging equality" do
describe 'unchanging equality' do
Given(:value) { Dill::DynamicValue.new { 'b' } }

Then { value == value }
Then { value == 'b' }
Then { ! (value != 'b') }
end

describe "delayed equality" do
describe 'delayed equality' do
Given(:value) { v = 'a'; Dill::DynamicValue.new { v.succ! } }

Then { value == 'd' }
end

describe "unchanging inequality" do
describe 'unchanging inequality' do
Given(:value) { Dill::DynamicValue.new { 'b' } }

Then { value != 'c'}
Then { ! (value == 'c') }
end

describe "delayed inequality" do
describe 'delayed inequality' do
Given(:value) { v = 'a'; Dill::DynamicValue.new { v.succ! } }

Then { value != 'a' }
end

describe "unchanging pattern matching" do
describe 'unchanging pattern matching' do
Given(:value) { Dill::DynamicValue.new { 'b' } }

Then { value =~ /b/ }
Then { value !~ /c/ }
end

describe "delayed pattern matching" do
describe 'delayed pattern matching' do
Given(:value) { v = 'a'; Dill::DynamicValue.new { v.succ! } }

Then { value =~ /f/ }
Then { value !~ /b/ }
end

describe "unchanging delegated comparison" do
describe 'unchanging delegated comparison' do
Given(:value) { Dill::DynamicValue.new { 'b' } }

Then { value < 'c' }
Then { value > 'a' }
end

describe "delayed delegated comparison" do
describe 'delayed delegated comparison' do
Given(:value) { v = 'a'; Dill::DynamicValue.new { v.succ! } }

Then { value > 'b' }
end

describe "inspect value" do
describe 'inspect value' do
Given(:value) { Dill::DynamicValue.new { 'b' } }

When(:inspection) { value.inspect }

Then { inspection == '"b"' }
end

describe "responds to missing" do
describe 'responds to missing' do
Given(:value) { Dill::DynamicValue.new { 'b' } }

Then { value.respond_to?(:<) }
end

describe "matching" do
describe 'matching' do
Given(:value) { Dill::DynamicValue.new { 'b' } }

context "simple match" do
context 'simple match' do
Then { value.match(/b/) }
end

context "match with block" do
context 'match with block' do
When(:result) { value.match(/b/) { |m| 'w00t!' } }

Then { result == 'w00t!' }
end

context "no match" do
context 'no match' do
Then { ! value.match(/No match/) }
end

context "no match with position" do
context 'no match with position' do
Then { ! value.match(/b/, 2) }
end
end
Expand Down
14 changes: 7 additions & 7 deletions spec/dill/text_table_spec.rb
Expand Up @@ -28,23 +28,23 @@ class BTable < ATable
let(:table) { OpenStruct.new(hashes: hashes) }

shared_examples_for 'table' do
it "passes header through" do
it 'passes header through' do
expect(t).to have_key(:passthrough)
end

it "returns passthrough value" do
it 'returns passthrough value' do
expect(t[:passthrough]).to eq 'a_str'
end

it "converts header" do
it 'converts header' do
expect(t).to have_key(:a_symbol)
end

it "returns converted header value" do
it 'returns converted header value' do
expect(t[:a_symbol]).to eq 'converted'
end

it "converts value with predefined conversion" do
it 'converts value with predefined conversion' do
expect(t[:full2]).to eq true
end
end
Expand All @@ -54,7 +54,7 @@ class BTable < ATable

it_should_behave_like 'table'

it "converts value" do
it 'converts value' do
expect(t[:full]).to eq 3
end
end
Expand All @@ -64,7 +64,7 @@ class BTable < ATable

it_should_behave_like 'table'

it "converts with overriden conversion" do
it 'converts with overriden conversion' do
expect(t[:full]).to eq 1
end
end
Expand Down
42 changes: 21 additions & 21 deletions spec/dill/widgets/field_group_spec.rb
Expand Up @@ -2,7 +2,7 @@

describe Dill::FieldGroup do
shared_examples_for 'a field' do
context "when using an auto locator" do
context 'when using an auto locator' do
Then { w.has_widget?(:auto_locator) }
end
end
Expand All @@ -29,16 +29,16 @@
check_box :auto_locator
end

context "when defining" do
context 'when defining' do
Then { w_class.field_names.include?(:unchecked_box) }
end

context "when querying" do
context 'when querying' do
Then { w.checked_box == true }
Then { w.unchecked_box == false }
end

context "when setting" do
context 'when setting' do
When { w.checked_box = false }
When { w.unchecked_box = true }

Expand Down Expand Up @@ -95,23 +95,23 @@
select :auto_locator
end

context "when defining" do
context 'when defining' do
Then { w_class.field_names.include?(:deselected) }
end

context "when querying" do
context 'when querying' do
Then { w.deselected.nil? }
Then { w.selected == "Selected option" }
Then { w.selected == 'Selected option' }
end

context "when setting" do
When { w.selected = "Unselected option" }
When { w.deselected = "One" }
When { w.by_value = "t"}
context 'when setting' do
When { w.selected = 'Unselected option' }
When { w.deselected = 'One' }
When { w.by_value = 't'}

Then { w.selected == "Unselected option" }
Then { w.deselected == "One" }
Then { w.by_value == "Two" }
Then { w.selected == 'Unselected option' }
Then { w.deselected == 'One' }
Then { w.by_value == 'Two' }
end

context 'when transforming to table' do
Expand Down Expand Up @@ -148,21 +148,21 @@
text_field :auto_locator
end

context "when defining" do
context 'when defining' do
Then { w_class.field_names.include?(:empty_field) }
end

context "when querying" do
context 'when querying' do
Then { w.empty_field.nil? }
Then { w.filled_field == "Field contents" }
Then { w.filled_field == 'Field contents' }
end

context "when setting" do
When { w.empty_field = "Some text" }
context 'when setting' do
When { w.empty_field = 'Some text' }
When { w.filled_field = nil }

Then { w.empty_field == "Some text" }
Then { w.filled_field == "" }
Then { w.empty_field == 'Some text' }
Then { w.filled_field == '' }
end

describe '#to_table' do
Expand Down
4 changes: 2 additions & 2 deletions spec/dill/widgets/finding_widgets_spec.rb
Expand Up @@ -33,7 +33,7 @@
Then { widget == 'Right' }
end

context "the widget can't be targeted unambiguously" do
context 'the widget can't be targeted unambiguously' do
GivenHTML <<-HTML
<span class="multiple">First</span>
<span class="multiple">Second</span>
Expand All @@ -50,7 +50,7 @@
Then { ambiguous == Failure(Capybara::Ambiguous) }
end
context "the widget root doesn't exist" do
context 'the widget root doesn't exist' do
GivenHTML <<-HTML
<span id="single">Single</span>
HTML
Expand Down
4 changes: 2 additions & 2 deletions spec/dill/widgets/list_item_spec.rb
Expand Up @@ -9,9 +9,9 @@
root '#item'
end

describe "#to_row" do
describe '#to_row' do
When(:row) { w.to_row }

Then { row == ["Item"] }
Then { row == ['Item'] }
end
end

0 comments on commit bbbb0c4

Please sign in to comment.