diff --git a/features/widgets/step_definitions/widgets_steps.rb b/features/widgets/step_definitions/widgets_steps.rb index 83d401b..3aac4c8 100644 --- a/features/widgets/step_definitions/widgets_steps.rb +++ b/features/widgets/step_definitions/widgets_steps.rb @@ -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| @@ -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| diff --git a/lib/dill/conversions.rb b/lib/dill/conversions.rb index 4889f4b..5e5f5b3 100644 --- a/lib/dill/conversions.rb +++ b/lib/dill/conversions.rb @@ -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? return val if Date === val || Time === val || DateTime === val diff --git a/lib/dill/version.rb b/lib/dill/version.rb index 7b122fa..a084f9d 100644 --- a/lib/dill/version.rb +++ b/lib/dill/version.rb @@ -1,3 +1,3 @@ module Dill - VERSION = "0.5.2" + VERSION = '0.5.2' end diff --git a/lib/dill/widgets/document.rb b/lib/dill/widgets/document.rb index c9f2e37..fad1162 100644 --- a/lib/dill/widgets/document.rb +++ b/lib/dill/widgets/document.rb @@ -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 diff --git a/spec/dill/conversions_spec.rb b/spec/dill/conversions_spec.rb index e22ffa5..13e07ac 100644 --- a/spec/dill/conversions_spec.rb +++ b/spec/dill/conversions_spec.rb @@ -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 @@ -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 @@ -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 diff --git a/spec/dill/dsl_spec.rb b/spec/dill/dsl_spec.rb index eda5797..0c98e9b 100644 --- a/spec/dill/dsl_spec.rb +++ b/spec/dill/dsl_spec.rb @@ -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) } diff --git a/spec/dill/dynamic_value_spec.rb b/spec/dill/dynamic_value_spec.rb index c9ea127..985d437 100644 --- a/spec/dill/dynamic_value_spec.rb +++ b/spec/dill/dynamic_value_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Dill::DynamicValue do - describe "unchanging equality" do + describe 'unchanging equality' do Given(:value) { Dill::DynamicValue.new { 'b' } } Then { value == value } @@ -9,53 +9,53 @@ 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 } @@ -63,30 +63,30 @@ 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 diff --git a/spec/dill/text_table_spec.rb b/spec/dill/text_table_spec.rb index 18725f4..aa88cee 100644 --- a/spec/dill/text_table_spec.rb +++ b/spec/dill/text_table_spec.rb @@ -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 @@ -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 @@ -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 diff --git a/spec/dill/widgets/field_group_spec.rb b/spec/dill/widgets/field_group_spec.rb index e870607..de6c844 100644 --- a/spec/dill/widgets/field_group_spec.rb +++ b/spec/dill/widgets/field_group_spec.rb @@ -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 @@ -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 } @@ -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 @@ -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 diff --git a/spec/dill/widgets/finding_widgets_spec.rb b/spec/dill/widgets/finding_widgets_spec.rb index 26624a8..f6bb932 100644 --- a/spec/dill/widgets/finding_widgets_spec.rb +++ b/spec/dill/widgets/finding_widgets_spec.rb @@ -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 First Second @@ -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 Single HTML diff --git a/spec/dill/widgets/list_item_spec.rb b/spec/dill/widgets/list_item_spec.rb index 0fb705d..ee4d1ba 100644 --- a/spec/dill/widgets/list_item_spec.rb +++ b/spec/dill/widgets/list_item_spec.rb @@ -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 diff --git a/spec/dill/widgets/list_spec.rb b/spec/dill/widgets/list_spec.rb index 53004e0..f974f18 100644 --- a/spec/dill/widgets/list_spec.rb +++ b/spec/dill/widgets/list_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' describe Dill::List do - describe "wraps HTML" do - context "using defaults" do + describe 'wraps HTML' do + context 'using defaults' do GivenHTML <<-HTML