fracture 0.10.1 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ ## 0.11.1
2
+
3
+ * http://github.com/nigelr/fracture/issues/4
4
+ Added support for define_selector if no items added then the label is made into a selector
5
+ eg. Fracture.define_selector(:something) - sets the items as '#something'
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Fracture
1
+ # Fracture [![Gem Version](https://badge.fury.io/rb/fracture.png)](http://badge.fury.io/rb/fracture)
2
2
  Unified view testing for your view or controller specs.
3
3
 
4
4
  Fracture allows you to define text or selector once at the top of a spec file. It also allows grouping of multiple text or selectors snippets using one label.
@@ -84,7 +84,7 @@ describe ContactsController do
84
84
  it "index" do
85
85
  login_as :user # psuedo code for example
86
86
  get :index
87
- response.body.should have_fracture(:add)
87
+ response.body.should_not have_fracture(:add)
88
88
  end
89
89
  end
90
90
  end
@@ -105,6 +105,10 @@ Fracture.define_text(:edits, "Edit", "Edit All")
105
105
  ```ruby
106
106
  Fracture.define_selector(:label_1, "#an_id", ".a_class", ".another_class")
107
107
  ```
108
+ If the items is left blank then the label will be used as the item as an id selector
109
+ ```ruby
110
+ Fracture.define_selector(:label_1) # equiv. Fracture.define_selector(:label_1, '#label_1')
111
+ ```
108
112
 
109
113
  Currently there is no way to build text and selectors into one definition (future feature). Another future feature will be to support 'within'.
110
114
 
@@ -179,6 +183,7 @@ page.body.should have_only_fractures(:label_2)
179
183
 
180
184
  * Support text and selector in one fracture
181
185
  * Support qty of expected fractures on page (selector count)
186
+ * Support Rake task to display matrix of context and fractures (to see if all are covered)
182
187
 
183
188
  ## Contributing
184
189
 
@@ -16,6 +16,7 @@ class Fracture
16
16
  def self.define_selector label, *items
17
17
  @all ||= {}
18
18
  raise "#{label} has already been defined" if @all[label.to_s]
19
+ items = ["##{label}"] if items.empty?
19
20
  @all[label.to_s] = self.new(label, items.flatten, false)
20
21
  end
21
22
 
@@ -1,3 +1,3 @@
1
1
  module FractureVersion
2
- VERSION = '0.10.1'
2
+ VERSION = '0.11.1'
3
3
  end
@@ -14,6 +14,22 @@ describe Fracture do
14
14
  end
15
15
  end
16
16
 
17
+ context 'items' do
18
+ context 'items blank on define_selector' do
19
+ it 'should set item to label name starting with #' do
20
+ Fracture.define_selector(:hello).items.should == ['#hello']
21
+ end
22
+ end
23
+ context 'when items set' do
24
+ it 'should set item' do
25
+ Fracture.define_selector(:hello, '#meme').items.should == ['#meme']
26
+ end
27
+ it 'should set multiple items' do
28
+ Fracture.define_selector(:hello, '#meme', '.wtf').items.should == ['#meme', '.wtf']
29
+ end
30
+ end
31
+ end
32
+
17
33
  context "with data" do
18
34
  before do
19
35
  @first = Fracture.define_text(:a, "a")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fracture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.11.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-10 00:00:00.000000000 Z
12
+ date: 2013-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -70,6 +70,7 @@ extensions: []
70
70
  extra_rdoc_files: []
71
71
  files:
72
72
  - .gitignore
73
+ - CHANGELOG.md
73
74
  - Gemfile
74
75
  - README.md
75
76
  - Rakefile